Skip to content

fix: support adaptive thinking type and fix beta header handling#42

Merged
CaddyGlow merged 2 commits intoCaddyGlow:mainfrom
jhfnetboy:fix/support-adaptive-thinking
Mar 19, 2026
Merged

fix: support adaptive thinking type and fix beta header handling#42
CaddyGlow merged 2 commits intoCaddyGlow:mainfrom
jhfnetboy:fix/support-adaptive-thinking

Conversation

@jhfnetboy
Copy link
Copy Markdown
Contributor

@jhfnetboy jhfnetboy commented Mar 15, 2026

Summary

  • Add ThinkingConfigAdaptive to the Anthropic request validation schema to support Claude 4-6+ models that use thinking: {"type": "adaptive"}
  • Fix anthropic-beta header handling: use minimal required tags (claude-code-20250219, oauth-2025-04-20) and block CLI fallback headers from overwriting them

Problem

  1. Sending thinking: {"type": "adaptive"} (required for Claude 4-6 models) was rejected with a 422 validation error because the schema only accepted enabled/disabled
  2. The fallback CLI headers overwrote the anthropic-beta header with tags (e.g. fine-grained-tool-streaming-2025-05-14) that caused "The long context beta is not yet available for this subscription" errors

Changed files

  • ccproxy/llms/models/anthropic.py — Add ThinkingConfigAdaptive class and include it in ThinkingConfig union type
  • ccproxy/plugins/claude_api/adapter.py — Use minimal beta tags for OAuth auth, block CLI headers from overwriting anthropic-beta

Test 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

  • curl with thinking: {"type": "adaptive"} returns successful response
  • curl without thinking parameter still works
  • OAuth authentication works with minimal beta tags
  • E2E: EvoScientist CLI -> ccproxy -> Claude Sonnet 4-6
  • E2E: ccproxy -> Claude Opus 4-6 with adaptive thinking

Generated with Claude Code

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>
@CaddyGlow CaddyGlow force-pushed the fix/support-adaptive-thinking branch from 4d73515 to cfbe0fb Compare March 19, 2026 19:56
Support summarized/omitted display modes for adaptive thinking responses.
@CaddyGlow CaddyGlow merged commit 656dd7e into CaddyGlow:main Mar 19, 2026
14 checks passed
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.

2 participants