fix: support adaptive thinking type and fix beta header handling#42
Merged
CaddyGlow merged 2 commits intoCaddyGlow:mainfrom Mar 19, 2026
Merged
Conversation
1. Add ThinkingConfigAdaptive to the request validation schema to
support Claude 4-6+ models that use thinking: {"type": "adaptive"}.
2. Fix anthropic-beta header handling: use minimal required tags
(claude-code-20250219, oauth-2025-04-20) and block CLI fallback
headers from overwriting them. The fallback data included tags
like fine-grained-tool-streaming-2025-05-14 that triggered
"long context beta not available" errors for some subscriptions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4d73515 to
cfbe0fb
Compare
Support summarized/omitted display modes for adaptive thinking responses.
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
ThinkingConfigAdaptiveto the Anthropic request validation schema to support Claude 4-6+ models that usethinking: {"type": "adaptive"}anthropic-betaheader handling: use minimal required tags (claude-code-20250219,oauth-2025-04-20) and block CLI fallback headers from overwriting themProblem
thinking: {"type": "adaptive"}(required for Claude 4-6 models) was rejected with a 422 validation error because the schema only acceptedenabled/disabledanthropic-betaheader with tags (e.g.fine-grained-tool-streaming-2025-05-14) that caused "The long context beta is not yet available for this subscription" errorsChanged files
ccproxy/llms/models/anthropic.py— AddThinkingConfigAdaptiveclass and include it inThinkingConfigunion typeccproxy/plugins/claude_api/adapter.py— Use minimal beta tags for OAuth auth, block CLI headers from overwritinganthropic-betaTest results
Claude Sonnet 4-6 (no thinking):
{"model":"claude-sonnet-4-6","id":"msg_01SQMx3YzCznFH7NvUxJuMSQ", "content":[{"type":"text","text":"Hello! I'm Claude, made by Anthropic."}], "stop_reason":"end_turn"}Claude Opus 4-6 (adaptive thinking):
{"model":"claude-opus-4-6","id":"msg_01EvK23seKBqAuRDmsXR2S3Y", "content":[ {"type":"thinking","thinking":"The user is asking what model I am."}, {"type":"text","text":"Hi! I'm Claude, made by Anthropic."} ],"stop_reason":"end_turn", "usage":{"input_tokens":16,"output_tokens":64}}Test plan
curlwiththinking: {"type": "adaptive"}returns successful responsecurlwithout thinking parameter still worksGenerated with Claude Code