Skip to content

v2: opencode -m provider/model no longer accepted on root command (worked in v1) #56218

In progress

Description

@rorynolan

In v1, opencode -m <provider/model> started the TUI with that model (and --agent selected an agent). In v2 the root command rejects it:

$ opencode -m fireworks-ai/accounts/fireworks/routers/glm-5p3-fast
ERROR
  Unrecognized flag: -m in command opencode

-m / --model exists only on opencode run. The root command now lists only -c, -s, --prompt, --auto, --standalone and --server.

Questions

  • Is dropping -m / --agent from the root command intentional?
  • If so, what is the supported way to launch the TUI with a given model without editing config?
  • Does OPENCODE_CONFIG_CONTENT still work in v2? The v2 config docs do not mention env vars.

Restoring -m / --agent on the root command, or adding a model env var, would help scripted workflows.

Version: opencode v2.0.31 (macOS)

Activity

  1. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for the report! You're asking for opencode -m <provider/model> and --agent to work on the root (TUI) command again, as they did in v1, so scripts can start the TUI with a specific model or agent.

    In v2.0.31, --model and --agent are defined only on opencode run. The root command never got them, so that's why you see Unrecognized flag. Maintainers will consider bringing them back.

    Related:

    On your OPENCODE_CONFIG_CONTENT question: v2 still reads it and applies it as an inline config layer on top of your config files. It's mentioned in the config docs as "Inline config". Until this is decided, it may let you set the model per launch without editing your config files.

  2. rorynolan commented on Oct 16, 2026

    @rorynolan
    Author

    Tested on v2.0.31: OPENCODE_CONFIG_CONTENT='{"model":"..."}' opencode has no effect, so it is not a workaround for the missing root -m. This matches #36990, which lists OPENCODE_CONFIG_CONTENT as ignored in v2.

    So there is currently no way to choose the TUI model per launch without editing a config file. Restoring root -m (#48163) or OPENCODE_CONFIG_CONTENT would each fix that.

  3. telsoncc commented on Oct 20, 2026

    @telsoncc

    Same issue on Windows 11 with OpenCode V2.

    My workflow relies on launching the TUI with a specific model from PowerShell aliases and scripts, for example:

    opencode -m "provider/model"

    This worked in V1 and is currently not possible in V2 without editing a config file. /models works after opening the TUI, but it adds a manual step to every session.

    PR #48163 would solve the model-selection part of this issue. Please consider merging it and also restoring --agent for the root command.

  4. Grey2k commented on Nov 1, 2026

    @Grey2k

    Thanks for fixing this - missing --model breaks a lot of automation which are developed for v1 (herdr plugins etc.)

  5. rsanchezc-pg commented on Nov 6, 2026

    @rsanchezc-pg

    Bumping this one, it would be super helpful to get it fixed.

  6. jamescube87 commented on Nov 7, 2026

    @jamescube87

    This is the most urgent issue to fix. I hope it can be addressed as soon as possible.

  7. reagle commented on Nov 11, 2026

    @reagle

    +1, --model on the root TUI would be useful. I launch opencode against a local OpenAI-compatible server through a shell alias that pins a model and reasoning variant (provider/model#variant); since v2 that alias fails with Unrecognized flag: --model in command opencode, so I have to open the TUI and pick the model with /models every time.

    I'm also unsure whether removing it was deliberate. opencode mini and opencode run both still accept -m/--model (and --agent), so if the flag was meant to be retired, why do they keep it? If it wasn't, it would be good to restore it on the root command so all three entry points take the same launch flags. Either way, a note in the v2 migration docs would help people whose scripts or aliases break.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions