Map Anthropic reasoning effort by provider#1338
Open
xeophon wants to merge 1 commit into
Open
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-019e1682-ae38-76cc-bda3-d90d28b62198 Co-authored-by: Amp <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sampling_args.reasoning_efforttoextra_body.verbosityfor Anthropic models on OpenRouter/Prime OpenAI-compatible routes.reasoning_effortto native Anthropicoutput_config.effortand enable adaptive thinking for Claude 4.6/4.7 when unset.Verification
uv run ruff check --fix verifiers/clients/openai_chat_completions_client.py verifiers/clients/anthropic_messages_client.py tests/test_client_multimodal_types.pyuv run pytest tests/test_client_multimodal_types.pyanthropic/claude-opus-4.7:reasoning_effort="high": https://app.primeintellect.ai/dashboard/evaluations/rbej739yowcedihefu7sqykkreasoning_effort="xhigh": https://app.primeintellect.ai/dashboard/evaluations/gl5n8e3cv0fcesfhjwgm1bczreasoning_effort="max": https://app.primeintellect.ai/dashboard/evaluations/ieaij5d5dpnjtcmlycby2wjgNote
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_effortis now translated intoextra_body.verbosityand ensuresextra_body.reasoning.enabledis set, instead of sendingreasoning_effortdirectly.For the native Anthropic Messages client,
reasoning_effortis mapped tooutput_config.effort, and Claude 4.6/4.7 models defaultthinkingto{"type": "adaptive"}when not explicitly provided. New tests add lightweight recording stubs to assert these parameter rewrites and preservation of existingoutput_config/extra_bodyfields.Reviewed by Cursor Bugbot for commit 4241702. Bugbot is set up for automated code reviews on this repo. Configure here.