opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Claude Opus 4 appears in model selector but returns "Invalid model name" error when selected

Open oweneldridge opened this issue 1 year ago • 8 comments

When using the /models command in opencode, "Claude Opus 4" appears as an option in the Anthropic model selector. However, when selecting it, the application returns an error: AI_APICallError: system: Invalid model name.

Steps to Reproduce

  1. Run opencode
  2. Authenticate with Anthropic using opencode auth login (I'm using OAuth authentication)
  3. In a new session, type /models or use ctrl+x m
  4. Select "Anthropic" from the provider list
  5. Select "Claude Opus 4" from the model list
  6. Observe the error: AI_APICallError: system: Invalid model name

Expected Behavior

Claude Opus 4 should be successfully selected and used for the session, or it should not appear in the model list if it's not properly configured.

Actual Behavior

The model appears in the selection menu but throws an error when selected, making it unusable despite being listed as an option.

Error message when selecting Claude Opus 4:

AI_APICallError: system: Invalid model name

Environment

  • opencode version: v0.1.153
  • OS: macOS darwin 24.5.0
  • Shell: /bin/zsh
  • Authentication: Anthropic OAuth
  • Installation method: homebrew

Additional Context

  • Other Claude models in the list work correctly
  • Authentication is properly configured (opencode auth list shows Anthropic oauth)
  • The issue appears to be a mismatch between the UI display name ("Claude Opus 4") and the expected backend format (likely "anthropic/claude-opus-4-20250514")

oweneldridge avatar Jun 27 '25 17:06 oweneldridge

Are you on the Max plan? Opus is not accessible on the Pro plan. If anything, it shouldn't show up in the list, but that'd require knowing which plan you are on, not sure if it's possible without additional requests to Anthropic. I also feel like it'd be quite hacky and coupled to Anthropic to have checks in place for this.

xHeaven avatar Jun 27 '25 23:06 xHeaven

Are you on the Max plan? Opus is not accessible on the Pro plan. If anything, it shouldn't show up in the list, but that'd require knowing which plan you are on, not sure if it's possible without additional requests to Anthropic. I also feel like it'd be quite hacky and coupled to Anthropic to have checks in place for this.

Great question, I'm on the Anthropic Claude Max plan and running opencode v0.1.157.

oweneldridge avatar Jun 28 '25 03:06 oweneldridge

I experience the exact same thing. Not on the Max plan but Opus is available via Claude code itself.

lvstb avatar Jul 16 '25 08:07 lvstb

this error shows up if whatever plan you're on does not grant opus access. i don't think this is a bug on the opencode side as it works for most people

thdxr avatar Jul 16 '25 19:07 thdxr

Well that is not correct. I have the pro plan so I do have rate limits. But when using Claude code I can select and use Opus.

lvstb avatar Jul 16 '25 19:07 lvstb

Well that is not correct. I have the pro plan so I do have rate limits. But when using Claude code I can select and use Opus.

This is simply not true. You can select it, yes - for whatever reason, it wasn't the case before - but you can't use it if you are not on the Max plan. See below.

Image

xHeaven avatar Jul 16 '25 20:07 xHeaven

I have run into this error on the max plan, confirmed with claude code

Image

rfhold avatar Jul 18 '25 21:07 rfhold

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

rekram1-node avatar Dec 28 '25 01:12 rekram1-node