Skip to content

fix: add adaptive thinking support for Claude Opus 4.7+#1125

Closed
msukkari wants to merge 2 commits intomainfrom
cursor/fix-opus-4-7-adaptive-thinking-c7a5
Closed

fix: add adaptive thinking support for Claude Opus 4.7+#1125
msukkari wants to merge 2 commits intomainfrom
cursor/fix-opus-4-7-adaptive-thinking-c7a5

Conversation

@msukkari
Copy link
Copy Markdown
Contributor

Summary

Fixes the issue where Claude Opus 4.7 returns an error: "thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior.

Claude Opus 4.7 only supports adaptive thinking mode (thinking.type: 'adaptive') and rejects the legacy budget-based thinking configuration (thinking.type: 'enabled' with budgetTokens).

Changes

Model Detection Logic

Added intelligent model detection to automatically select the appropriate thinking mode:

  • Claude Opus 4.7+: Uses adaptive thinking (the only supported mode)
  • Claude Opus 4.6 / Sonnet 4.6: Uses adaptive thinking (recommended, though both modes are still supported)
  • Older models (Sonnet 4.5, Opus 4.5, etc.): Falls back to budget-based thinking

Provider Support

Extended thinking configuration to all Anthropic-compatible providers:

  • anthropic - Direct Anthropic API
  • google-vertex-anthropic - Claude on Google Vertex AI
  • amazon-bedrock - Claude on AWS Bedrock (automatically detects Anthropic models)

New Environment Variable

Added ANTHROPIC_EFFORT to control thinking depth for models using adaptive thinking:

  • low - Minimal thinking, fastest response
  • medium - Balanced thinking
  • high (default) - Deep thinking
  • max - Maximum thinking capability

The existing ANTHROPIC_THINKING_BUDGET_TOKENS is still used for older models that require budget-based thinking.

Backwards Compatibility

This change is fully backwards compatible:

  • Older models continue to use budget-based thinking with ANTHROPIC_THINKING_BUDGET_TOKENS
  • No changes to the configuration schema or user-facing API
  • Default behavior (high effort) matches the previous intelligent behavior

Testing

  • All existing tests pass
  • Linter passes with no new warnings

Fixes #SOU-918

Linear Issue: SOU-918

Open in Web Open in Cursor 

Claude Opus 4.7 only supports adaptive thinking mode (thinking.type: 'adaptive')
and rejects the legacy budget-based thinking (thinking.type: 'enabled').

This change:
- Adds model detection to automatically use adaptive thinking for Opus 4.7+
- Uses adaptive thinking by default for Opus 4.6 and Sonnet 4.6 (recommended)
- Falls back to budget-based thinking for older models (Sonnet 4.5, etc.)
- Adds thinking support for google-vertex-anthropic and amazon-bedrock providers
- Adds ANTHROPIC_EFFORT env var to control thinking depth (low/medium/high/max)

Fixes #SOU-918

Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 59695a17-0241-4dc7-89cc-a1d1707b09c9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/fix-opus-4-7-adaptive-thinking-c7a5

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants