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.
Symptom
Section titled “Symptom”cached input tokens were often stuck around 6.5k-9.2k even for ~95k-120k token requestsThis 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).
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.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 6 real issues
- #2024会话刷新是走的配置文件环境变量的proxy还是软件里的出站proxy?
- #2350openai_responses: dynamic x-anthropic-billing-header in instructions breaks prompt caching
- #3185Azure OpenAI gpt-5.4: Chat Completions 应使用 max_completion_tokens,当前仍发送 max_tokens(v3.15.0)
- #5343[Bug] supports_reasoning_effort() 使用 strip_prefix("gpt-") 导致带前缀的自定义模型名无法触发 reasoning effort 映射
- #5388[Bug] Claude Desktop 经 Codex OAuth 本地路由时未复用 Session ID,缓存命中率约 49%
- #6116<thinking> blocks leak into assistant text on Codex chat-completions routes
- 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.
Related problems
Section titled “Related problems”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.