Claude Opus 4 appears in model selector but returns "Invalid model name" error when selected
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
- Run opencode
- Authenticate with Anthropic using opencode auth login (I'm using OAuth authentication)
- In a new session, type /models or use ctrl+x m
- Select "Anthropic" from the provider list
- Select "Claude Opus 4" from the model list
- 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")
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.
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.
I experience the exact same thing. Not on the Max plan but Opus is available via Claude code itself.
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
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.
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.
I have run into this error on the max plan, confirmed with claude code
[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!