Skip to content

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

Open
roomote-v0[bot] wants to merge 3 commits intomainfrom
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 3 commits intomainfrom
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

Andy Lemin and others added 2 commits May 8, 2026 13:46
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
@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

…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)
@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.

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