Add --no-context-management flag for non-Anthropic API providers (OpenRouter)
Problem
When using Claude Code CLI with ANTHROPIC_BASE_URL pointed at OpenRouter (or other non-Anthropic providers), the CLI sends context-management-2025-06-27 at the protocol level. This causes OpenRouter to reject all requests with:
No endpoints available that support Anthropic's context management features
(context-management-2025-06-27). Context management requires a supported
provider (Anthropic).
What I've Tried
Built a local reverse proxy that intercepts requests between Claude CLI and OpenRouter:
- Stripped
Anthropic-Betaheader — removedcontext-management-2025-06-27from the header. ✅ Confirmed stripped. - Stripped
?beta=truequery parameter — ✅ Confirmed stripped. - Stripped
betasarray from JSON request body — removedcontext-management-2025-06-27from the body. ✅ Confirmed stripped. - Stripped ALL Anthropic beta headers — removed every beta, not just context-management. ✅ Confirmed empty.
After all four, OpenRouter still rejects with the same error. Context management appears to be embedded in the request body structure itself at a level below headers, query params, and the betas field.
Expected Behavior
A flag like --no-context-management or an environment variable like CLAUDE_DISABLE_CONTEXT_MANAGEMENT=1 that prevents Claude CLI from using context management features. This would allow the CLI to work with any OpenAI-compatible or Anthropic-compatible API provider that doesn't support this Anthropic-specific feature.
Environment
- Claude Code CLI 2.1.92
- macOS Darwin 24.6.0
- OpenRouter API (
ANTHROPIC_BASE_URL=https://openrouter.ai/api) - Models tested:
qwen/qwen3-coder:free,qwen/qwen3.6-plus:free
Reproduction
export ANTHROPIC_BASE_URL=https://openrouter.ai/api
export ANTHROPIC_AUTH_TOKEN=sk-or-...
echo "say hello" | claude -p - --model qwen/qwen3-coder:free
Impact
This blocks all non-Anthropic provider usage via Claude Code CLI, including OpenRouter's free tier models which are valuable for cost-effective parallel agent workflows.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗