Add Anthropic Claude Opus 5 API support - #1026
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
📝 WalkthroughWalkthroughClaude Opus 5 is added to the model registry, default API modes, English localization, and Claude API request handling. Temperature omission behavior is covered by a parameterized unit test. ChangesClaude Opus 5 support
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoAdd Anthropic Claude Opus 5 API model with default + legacy migrations
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
7637455 to
5b2d6b3
Compare
There was a problem hiding this comment.
Pull request overview
Adds Anthropic Claude Opus 5 as a selectable Anthropic API model in the extension’s model registry, aligning request-shaping behavior with existing Claude Sonnet 5 handling and updating defaults/migrations so existing users move to the new Opus-tier model smoothly.
Changes:
- Register
claudeOpus5Api(claude-opus-5) in the Claude API model key list andModels, and switch the default Opus-tier API mode to Opus 5. - Update Claude API request construction to omit
temperatureand explicitly disablethinkingfor Opus 5 (matching Sonnet 5 behavior). - Add legacy migration mapping so
claudeOpus48Api(and older Opus legacy keys) canonicalize toclaudeOpus5Api, plus add the display label to the English locale.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/services/apis/claude-api.test.mjs | Extends coverage to ensure Opus 5 omits temperature and applies the same thinking-disable behavior as Sonnet 5. |
| src/services/apis/claude-api.mjs | Adds Opus 5 to the model-based rules for omitting temperature and disabling default thinking in Anthropic API requests. |
| src/config/model-key-migrations.mjs | Migrates legacy Opus keys (including claudeOpus48Api) to Opus 5 and ensures the model key group stays consistent. |
| src/config/index.mjs | Registers claudeOpus5Api in available Claude API models, adds the model preset, and updates the default API mode selection from Opus 4.8 to Opus 5. |
| src/_locales/en/main.json | Adds the English label for “Anthropic (Claude Opus 5)” so it renders consistently in the UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code Review by Qodo
Context used✅ Compliance rules (platform):
5 rules 1.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7637455e0f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "Anthropic (Claude Opus 4.5)": "Anthropic (Claude Opus 4.5)", | ||
| "Anthropic (Claude Opus 4.6)": "Anthropic (Claude Opus 4.6)", | ||
| "Anthropic (Claude Opus 4.8)": "Anthropic (Claude Opus 4.8)", | ||
| "Anthropic (Claude Opus 5)": "Anthropic (Claude Opus 5)", |
There was a problem hiding this comment.
Propagate the new model label to every locale
When any of the 12 non-English locales is active, this new key is absent from that locale's catalog and only renders through the English fallback. Add the label to each existing locale as required for newly introduced English strings.
AGENTS.md reference: AGENTS.md:L209-L215
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
No change needed. Commit 1c976a3 intentionally removed redundant model labels from non-English locales because i18next falls back to English. Only labels with actual localization differences are kept, so the English entry is sufficient here.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/services/apis/claude-api.mjs`:
- Around line 17-18: Update shouldDisableDefaultThinking so claude-opus-5 is not
treated as disabled-thinking; send thinking type adaptive while preserving
claude-sonnet-5 behavior. Update the matching assertion in
tests/unit/services/apis/claude-api.test.mjs at line 163 to expect adaptive
thinking for claude-opus-5.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5a91ff7c-169f-4056-96d4-3d685a392f2b
📒 Files selected for processing (5)
src/_locales/en/main.jsonsrc/config/index.mjssrc/config/model-key-migrations.mjssrc/services/apis/claude-api.mjstests/unit/services/apis/claude-api.test.mjs
5b2d6b3 to
657a1d7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 657a1d77ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/unit/config/migrate-user-config.test.mjs`:
- Around line 36-42: Update LEGACY_MODEL_KEY_MIGRATIONS so claudeOpus48Api
canonicalizes to claudeOpus5Api, then revise the canonicalizeModelKey test to
assert that migration and that claudeOpus5Api remains unchanged while preserving
the existing legacy migration assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 957137ef-b629-43e7-8a67-fd8bc0086df1
📒 Files selected for processing (5)
src/_locales/en/main.jsonsrc/config/index.mjssrc/services/apis/claude-api.mjstests/unit/config/migrate-user-config.test.mjstests/unit/services/apis/claude-api.test.mjs
657a1d7 to
ac8667e
Compare
Register `claude-opus-5` as the default Opus API preset while keeping Claude Opus 4.8 available as a separate selectable model. Let Opus 5 use its default adaptive thinking behavior and omit the unsupported custom temperature parameter. Add request-shaping regression coverage. References: - https://www.anthropic.com/claude-opus-5-system-card - https://www.anthropic.com/news/claude-opus-5 - https://platform.claude.com/docs/en/about-claude/models/overview - https://platform.claude.com/docs/en/about-claude/models/whats-new-opus-5
ac8667e to
37aabfd
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37aabfd409
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| model === 'claude-opus-4-7' || | ||
| model === 'claude-opus-4-8' || | ||
| model === 'claude-sonnet-5' || | ||
| model === 'claude-opus-5' |
There was a problem hiding this comment.
Report Opus 5 token-budget exhaustion
When Opus 5's always-on adaptive thinking consumes max_tokens before emitting text—particularly with the default 2,000-token limit—the API reports stop_reason: "max_tokens" in a message_delta and then sends message_stop. The current handler ignores that stop reason, records an empty answer, and reports successful completion, leaving the user with no explanation or useful retry path. The current tree no longer contains the token-limit handling referenced by the earlier localization review comment, so this remains a runtime issue for the newly exposed model.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This is valid, but the handling is not specific to Opus 5. It affects Claude streaming responses generally and requires broader stop-reason and error-propagation coverage. It will be addressed in a focused follow-up change rather than expanding this model-registration PR.
|
Code review by qodo was updated up to the latest commit 37aabfd |
Report token-limit and refusal stop reasons instead of treating incomplete responses as successful completions. Require message_stop before accepting a stream while preserving explicit abort behavior. Add localized errors and regression coverage for completion, transport, callback, and abort edge cases. Follow-up to ChatGPTBox-dev#1026.
Report token-limit, context-window, and refusal stop reasons instead of treating incomplete responses as successful completions. Require `message_stop` before accepting a stream and preserve abort behavior. Add localized errors and regression coverage for completion, transport, callback, and abort edge cases. Follow-up to ChatGPTBox-dev#1026.
Reject token, context, refusal, and nonterminal stop conditions instead of treating incomplete Claude responses as successful completions. Stop processing once a response completes and surface streamed API errors without undoing completed responses. Add localized completion errors and regression coverage for stop reasons, provider errors, transport failures, callbacks, and aborts. Follow-up to ChatGPTBox-dev#1026.
Reject token, context, refusal, and nonterminal stop conditions instead of treating incomplete Claude responses as successful completions. Stop processing once a response completes and surface streamed API errors without undoing completed responses. Add localized completion errors and regression coverage for stop reasons, provider errors, transport failures, callbacks, and aborts. Follow-up to ChatGPTBox-dev#1026.
Expose Claude Opus 5 through the Anthropic API model list using the official
claude-opus-5model identifier.Changes
temperatureparameter from Claude Opus 5 requests.Validation
npm run lintnpm test(932 tests passed)npm run buildReferences
Summary by CodeRabbit
New Features
Bug Fixes
Tests