feat: add output_config.effort support for Claude Code adaptive thinking (Opus 4.8 xhigh) - #240
Open
5h4d0wn1k wants to merge 1 commit into
Open
feat: add output_config.effort support for Claude Code adaptive thinking (Opus 4.8 xhigh)#2405h4d0wn1k wants to merge 1 commit into
5h4d0wn1k wants to merge 1 commit into
Conversation
Add output_config field to AnthropicMessagesRequest model and update extract_thinking_config_from_anthropic() to handle: - thinking.type="adaptive" with budget derived from output_config.effort - Effort levels: none(0%), low(20%), medium(50%), high(80%), xhigh(95%), max(99%) - Effort without explicit thinking field (Claude Code sends output_config alone) - Case-insensitive effort matching Claude Code on Opus 4.7+/4.8 uses adaptive thinking with effort levels instead of budget_tokens. This enables routing Claude Code through kiro-gateway with full xhigh effort support.
|
Thanks for the PR! 🎉 Before merge, we need a one-time CLA confirmation. Full CLA text: Please reply once with: You need to write once, all further messages from me can be ignored. |
zhujunsan
added a commit
to zhujunsan/kiro-gateway
that referenced
this pull request
Jul 14, 2026
Cherry-pick upstream PR jwadow#240:Claude Code Opus 4.8 使用 thinking.type=adaptive + output_config.effort,映射为 thinking budget。
|
@5h4d0wn1k could you give a try to this gateway: https://github.com/ankitcharolia/kiro-gateway It works quite well with All AI harness and actively being developed. The most important thing is that it is ACP compliant |
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
Claude Code on Opus 4.7+/4.8 uses adaptive thinking with effort levels instead of legacy
budget_tokens. This PR adds support for theoutput_config.effortparameter to the Anthropic/v1/messagesendpoint so Claude Code can route through kiro-gateway with full effort control.Changes
kiro/models_anthropic.pyoutput_config: Optional[Dict[str, Any]]field toAnthropicMessagesRequestkiro/converters_anthropic.pymax_tokensextract_thinking_config_from_anthropic()now handles:thinking.type="adaptive"— derives budget fromoutput_config.effort"XHIGH"","xHigh"" → works)"none") → thinking disabled_budget_from_effort,_thinking_config_from_effort)Testing
Verified with Claude Code v2.1.72:
output_config={"effort": "xhigh"}→ budget = 95% ofmax_tokensthinking.type="enabled"/"disabled"/Nonebehavior preservedBackground
On Claude Opus 4.8 (and 4.7), Anthropic replaced
thinking: {type: "enabled", budget_tokens: N}with adaptive thinking controlled byoutput_config.effort. Claude Code sends:{ "thinking": {"type": "adaptive"}, "output_config": {"effort": "xhigh"} }Since Kiro API only supports the legacy extended thinking via XML tag injection, the effort is converted to a budget percentage internally.