Skip to content

Map Anthropic reasoning effort by provider#1338

Open
xeophon wants to merge 1 commit into
mainfrom
fix/anthropic-reasoning-effort
Open

Map Anthropic reasoning effort by provider#1338
xeophon wants to merge 1 commit into
mainfrom
fix/anthropic-reasoning-effort

Conversation

@xeophon
Copy link
Copy Markdown
Member

@xeophon xeophon commented May 11, 2026

Summary

  • Map sampling_args.reasoning_effort to extra_body.verbosity for Anthropic models on OpenRouter/Prime OpenAI-compatible routes.
  • Map reasoning_effort to native Anthropic output_config.effort and enable adaptive thinking for Claude 4.6/4.7 when unset.
  • Add focused client tests for Claude 4.6/4.7 OpenRouter-style and native Anthropic mappings.

Verification


Note

Medium Risk
Adjusts request-parameter normalization for Anthropic/Claude models across OpenAI-compatible and native Anthropic clients, which can change generation behavior and provider compatibility for affected routes.

Overview
Adds provider-aware handling of sampling_args.reasoning_effort.

For OpenAI-compatible Anthropic/Claude models on OpenRouter/Prime (openrouter.ai/pinference.ai), reasoning_effort is now translated into extra_body.verbosity and ensures extra_body.reasoning.enabled is set, instead of sending reasoning_effort directly.

For the native Anthropic Messages client, reasoning_effort is mapped to output_config.effort, and Claude 4.6/4.7 models default thinking to {"type": "adaptive"} when not explicitly provided. New tests add lightweight recording stubs to assert these parameter rewrites and preservation of existing output_config/extra_body fields.

Reviewed by Cursor Bugbot for commit 4241702. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

1 participant