Skip to content

feat: add Claude Opus 4.7 support across all providers (#12287)#12301

Open
roomote-v0[bot] wants to merge 4 commits into
mainfrom
feat/claude-opus-4-7-all-providers
Open

feat: add Claude Opus 4.7 support across all providers (#12287)#12301
roomote-v0[bot] wants to merge 4 commits into
mainfrom
feat/claude-opus-4-7-all-providers

Conversation

@roomote-v0
Copy link
Copy Markdown
Contributor

@roomote-v0 roomote-v0 Bot commented May 9, 2026

Closes: #12287

Supersedes #12288 by extending Claude Opus 4.7 support beyond just Bedrock to all providers.

Changes

Bedrock (from #12288):

  • Added anthropic.claude-opus-4-7 model entry to bedrockModels
  • Added to BEDROCK_1M_CONTEXT_MODEL_IDS and BEDROCK_GLOBAL_INFERENCE_MODEL_IDS
  • Corrected model ID from anthropic.claude-opus-4-7-v1 to anthropic.claude-opus-4-7 to match the correct Bedrock identifier
  • Added adaptive thinking support: Opus 4.7 uses thinking.type: "adaptive" with output_config.effort instead of "enabled" with budget_tokens
  • Added BEDROCK_ADAPTIVE_THINKING_ONLY_MODEL_IDS constant for models requiring this thinking mode
  • Updated BedrockAdditionalModelFields interface to support the adaptive thinking type

Anthropic Direct API:

  • Added claude-opus-4-7 model entry to anthropicModels with 128K maxTokens, $5/$25 pricing, 1M context tiers
  • Added to 1M context beta flag check, prompt caching switch, and extended thinking switch in handler
  • Added to getModel() 1M context tier pricing check

OpenRouter:

  • Added anthropic/claude-opus-4.7 to prompt caching and reasoning budget model sets
  • Added maxTokens override in fetcher

Vercel AI Gateway:

  • Added anthropic/claude-opus-4.7 to prompt caching and vision+tools model sets

WebView UI:

  • Added claude-opus-4-7 to 1M context beta tier pricing check in useSelectedModel

Test Procedure

  • All 88 existing tests pass (anthropic: 64, openrouter: 24)
  • All lint checks pass across 14 packages
  • All type checks pass across 14 packages

Interactively review PR in Roo Code Cloud

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Enhancement New feature or request labels May 9, 2026
@andylemin
Copy link
Copy Markdown

@roomote Bedrock implementation in this is incorrect. Working version in #12288

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 Bot commented May 10, 2026

Fixaroo Clock   See task

Fixed Bedrock implementation to match the working version from PR #12288: corrected model ID to anthropic.claude-opus-4-7 and added adaptive thinking support (thinking.type: "adaptive" with output_config.effort instead of "enabled" with budget_tokens). All tests, lint, and type checks pass.

View commit | Revert commit

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 10, 2026
@andylemin
Copy link
Copy Markdown

@roomote Also update the description on this PR to reflect the fixes?

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 Bot commented May 10, 2026

Fixaroo Clock   See task

Updated the PR description to reflect the fixes from the latest commit: corrected Bedrock model ID (anthropic.claude-opus-4-7-v1anthropic.claude-opus-4-7), added adaptive thinking support details, and documented the new BEDROCK_ADAPTIVE_THINKING_ONLY_MODEL_IDS constant and BedrockAdditionalModelFields interface update.

@hpylsy
Copy link
Copy Markdown

hpylsy commented May 11, 2026

Thanks for pushing this forward — really appreciate having 4.7 land across all providers rather than just Bedrock.

A couple of pieces of feedback from someone running Opus 4.7 through a third-party Anthropic-compatible gateway (Kiro-backed CPAP):

Anthropic provider changes look correct. I reverse-checked the edits in src/api/providers/anthropic.ts against a working 4.7 setup — the 1M context beta flag, prompt caching switch, reasoning-budget switch, and the 200K/1M tier pricing branch all add claude-opus-4-7 in the exact same spots that claude-opus-4-6 already covers. That mirrors what we see working in production.

Small suggestion (non-blocking): every new Opus/Sonnet release touches 4–5 parallel switch/if blocks in this file (1M beta, prompt cache, extended thinking, tier pricing). Consider consolidating these into a single capability set per model in packages/types/src/providers/anthropic.ts, e.g.:

"claude-opus-4-7": {
    // ... existing fields ...
    capabilities: {
        supports1MContext: true,
        supportsPromptCache: true,
        supportsExtendedThinking: true,
    },
}

Then the handler can do if (anthropicModels[id]?.capabilities?.supports1MContext) instead of maintaining a switch per capability. This would make future model additions a one-line change in the model definition rather than a scavenger hunt across the handler. Happy to follow up with a separate PR for the refactor if the maintainers think it's worth it.

On the Bedrock fix: seeing the adaptive thinking work (thinking.type: "adaptive" + output_config.effort) makes sense given 4.7's behavior differs from 4.6 on Bedrock — good catch by @andylemin. The BEDROCK_ADAPTIVE_THINKING_ONLY_MODEL_IDS constant is a clean way to gate this.

LGTM on the Anthropic/OpenRouter/Vercel parts from my side — looking forward to getting this merged.

@andylemin
Copy link
Copy Markdown

Thanks @hpylsy, I agree it would be cleaner to use a capability hash or something to organise these config variants. I think the models will continue to expose more and evolve these over time, so is likely worthwhile.
I have been running the 4.7 model in my "Extension Development Host" for over a day now doing day-job coding and its working perfectly - no model failures or wierdness.

@andylemin
Copy link
Copy Markdown

@roomote There was an issue for new installations. When building a new VSCode Extension installer, and testing on a fresh machine with no existing settings, the new namespace creation workflow created new settings which did not remove the temperature parameter - which is not supported at all with Opus 4.7.
I have fixed this in #12288 (commit a682355) and confirmed is fixed for new installs after selecting Opus 4.7. Roomote also helped me add the missing test coverage for the fix (commit c2274d8). Can you please update this PR with these same fixes?

CC; @hpylsy

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 Bot commented May 12, 2026

Fixaroo Clock   See task

Fixed the reported issues. Ported the temperature exclusion fix and test coverage from PR #12288 (commits a682355 and c2274d8). All local checks passed (97 tests, 14 lint packages, 14 type-check packages).

View commit | Revert commit

@andylemin
Copy link
Copy Markdown

@roomote rebase this PR and fix the conflicts?

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 Bot commented May 12, 2026

Fixaroo Clock   See task

Rebased onto main and resolved the merge conflict in src/api/providers/anthropic.ts (main had removed the try/catch wrapper around the prompt-caching create call). All tests pass (97 total) and type checks pass across 10 packages.

View commit | Revert commit

Andy Lemin and others added 4 commits May 12, 2026 05:21
Add claude-opus-4-7 model definitions and references to:
- Anthropic direct API types and handler (1M context, prompt caching, extended thinking)
- OpenRouter model sets and fetcher maxTokens override
- Vercel AI Gateway prompt caching and vision+tools sets
- WebView 1M context beta tier pricing check
…port

- Rename model ID from "anthropic.claude-opus-4-7-v1" to "anthropic.claude-opus-4-7"
  to match the correct Bedrock model identifier (per PR #12288)
- Update BedrockAdditionalModelFields to support adaptive thinking type
- Add BEDROCK_ADAPTIVE_THINKING_ONLY_MODEL_IDS for Opus 4.7
- Opus 4.7 uses thinking.type: "adaptive" with output_config.effort
  instead of "enabled" with budget_tokens (which returns 400 error)
- Add supportsTemperature: false to Opus 4.7 model definition
- Conditionally exclude temperature from inferenceConfig when unsupported
- Add tests for adaptive thinking and temperature exclusion

Ported from PR #12288 commits a682355 and c2274d8
@roomote-v0 roomote-v0 Bot force-pushed the feat/claude-opus-4-7-all-providers branch from 8cfd22c to 12c4471 Compare May 12, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Add Claude Opus 4.7 support on AWS Bedrock

3 participants