Skip to content

x-anthropic-billing-header breaks caching - CC Switch

Quick fix

Upgrade CC Switch to v3.15.0+, which fixes the dynamic billing header breaking prefix caching in openai_responses mode.

Error output
cached input tokens were often stuck around 6.5k-9.2k even for ~95k-120k token requests

This cluster actually mixes several quite different CC Switch request conversion and proxy defects. This page addresses the fixed core problem (#2350): in `openai_responses` mode, CC Switch incorrectly injected an `x-anthropic-billing-header` containing a dynamic `cch` value at the start of the `instructions` field. Because OpenAI prompt caching matches on a prefix, that header changing on every request stopped a large, otherwise stable system prompt from ever hitting the cache.

The cluster also holds unfixed variants: Azure OpenAI `max_tokens` not being converted to `max_completion_tokens`, producing a 400 (#3185); `supports_reasoning_effort()` using `strip_prefix("gpt-")` so a model with a custom prefix never triggers reasoning mapping (#5343); Claude Desktop routing not reusing the Session ID, lowering the cache rate (#5388); and `<thinking>` tags leaking into the body on the Codex chat-completions route (#6116).

  1. Upgrade CC Switch to v3.15.0 or newer. That version fixed the dynamic `x-anthropic-billing-header` being injected into the `instructions` field in `openai_responses` mode, restoring the OpenAI prefix cache hit rate.

ToolClaude Code
Version3.14.1 (已在 3.15.0 修复)
PlatformsWindowsmacOS
Does a quota refresh use the proxy from the config file environment variables, or the outbound proxy in the app?
A quota refresh uses the CC Switch HTTP client: the global outbound proxy if one is set, otherwise the system proxy. A provider's `env` proxy settings are not used.
Why does a custom model name with a prefix (b-gpt-5.6-sol, say) not trigger reasoning effort mapping?
The current `supports_reasoning_effort()` matches with `strip_prefix("gpt-")`, requiring the model name to start with `gpt-`. A model with a custom prefix is not recognised, and this is not fixed yet.
How do I resolve Azure OpenAI gpt-5.4 returning a 400?
CC Switch still sends the old `max_tokens` parameter while Azure GPT-5.x requires `max_completion_tokens`. That parameter conversion is not fixed in CC Switch yet — watch for a later version.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.