-
Notifications
You must be signed in to change notification settings - Fork 43
anthropic-beta header is hardcoded, preventing 1M context window #54
Description
Problem
In adapter.py, the anthropic-beta header is hardcoded and added to blocked_overrides, which prevents clients from passing additional beta tags.
Current code (v0.2.7):
# Line ~91
filtered_headers["anthropic-beta"] = "claude-code-20250219,oauth-2025-04-20"
# Line ~96
blocked_overrides = {"authorization", "x-api-key", "anthropic-beta"}This means Claude Max Plan subscribers cannot enable the 1M context window, which requires the context-1m-2025-08-07 beta tag. Even if the client sends this tag, it gets silently dropped by the proxy.
Impact
All requests through ccproxy-api are limited to 200K context, even for users with Max Plan 5X subscriptions that support 1M context.
Suggested Fix
Replace the hardcoded beta header with a merge strategy that preserves required tags while allowing client-provided tags to pass through:
# Keep required beta tags, but merge with client-provided tags
required_betas = {"claude-code-20250219", "oauth-2025-04-20"}
client_beta = headers.get("anthropic-beta", "")
if client_beta:
for tag in client_beta.split(","):
tag = tag.strip()
if tag:
required_betas.add(tag)
filtered_headers["anthropic-beta"] = ",".join(sorted(required_betas))And remove "anthropic-beta" from blocked_overrides:
blocked_overrides = {"authorization", "x-api-key"}This way, the proxy still enforces the required OAuth/Claude Code beta tags, but also forwards any additional beta tags from the client (such as context-1m-2025-08-07).
Workaround
Currently we manually patch adapter.py after every upgrade, which works but is not ideal.