Add --no-context-management flag for non-Anthropic API providers (OpenRouter)

Resolved 💬 3 comments Opened Apr 6, 2026 by Gab-CosmoLabs Closed Apr 10, 2026

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:

  1. Stripped Anthropic-Beta header — removed context-management-2025-06-27 from the header. ✅ Confirmed stripped.
  2. Stripped ?beta=true query parameter — ✅ Confirmed stripped.
  3. Stripped betas array from JSON request body — removed context-management-2025-06-27 from the body. ✅ Confirmed stripped.
  4. 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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗