Skip to content

DeepSeek usage statistics show the wrong cost / cache hit rate - cc-switch

Quick fix

Upgrade to v3.16.3+, fixing input double-counting on the chat→message conversion path, streaming without usage, and wrong model billing attribution.

Error output
使用统计中的缓存命中率显示为47.8%;真实消耗 为输入374.2 万+Output 1.9 万+命中343.0 万=719.16 万
English translation

The cache hit rate in usage statistics shows 47.8%; real consumption is input 3.742M + output 19K + hits 3.430M = 7.1916M

This covers several statistics defects when cc-switch proxies models such as DeepSeek:

1. **Input tokens double-counted during chat→message protocol conversion**: when an intermediate layer such as opencode go converts the chat protocol into the message protocol, the real model name and input tokens are counted twice, inflating real consumption and diluting the cache hit rate. This has nothing to do with the official DeepSeek message protocol and affects only paths going through a chat→message conversion. 2. **No usage on streaming responses when Claude Code is proxied to an OpenAI-compatible upstream**: the proxy did not inject `stream_options.include_usage`, so Claude Code had no statistics while Codex did. 3. **Wrong Codex Session model attribution causing cross-billing**: the user was really on deepseek-v4-flash while Codex (Session) showed gpt5.5 and billed at gpt5.5 prices, with the cost charged to the deepseek account.

v3.16.2 attempted to fix input_tokens inflation in message_delta but did not cover the double counting on the chat→message conversion path; v3.16.3 fixed usage statistics on the format conversion path through #2774, and v3.16.4 added models.dev pricing import.

  1. Upgrade cc-switch to v3.16.3 or newer (v3.16.4+ preferred, which includes the models.dev pricing import).

  2. If you use a chat→message protocol conversion (opencode go, for instance), confirm after upgrading that DeepSeek-V4 input tokens are no longer double-counted. If it persists, check whether your case matches #2773 and report back.

  3. If Claude Code still has no statistics through an OpenAI-compatible upstream such as NVIDIA NIM, confirm you are on v3.16.3+, where the proxy injects stream_options.include_usage automatically.

  4. If Codex (Session) shows the wrong model (gpt5.5) and bills at the wrong price, watch whether the statistics return to normal after upgrading. If not, report back with reproduction steps.

ToolClaude Code / Codex
Version3.15.0 - 3.16.2(v3.16.3 修复流式 usage 与格式转换路径统计;v3.16.4 补充定价导入)
PlatformsWindowsmacOS
DeepSeek statistics are still wrong after upgrading to v3.16.2. Why?
v3.16.2 fixed delta token inflation in the non-standard message protocol, which does not apply to input double-counting on the chat→message conversion path. v3.16.3+ is needed to cover that case.
Why does Claude Code have no statistics while Codex does?
Before v3.16.3, proxying to an OpenAI-compatible upstream such as NVIDIA NIM did not inject stream_options.include_usage into the streaming response, so Claude Code never received usage. Fixed in v3.16.3.
Codex (Session) shows gpt5.5 and charges my DeepSeek account. What is going on?
A model attribution and billing mapping error: requests really go to deepseek-v4-flash while the statistics label them gpt5.5 and bill at that price. If it persists after upgrading, report back with reproduction information.
Does the official DeepSeek message protocol have this problem?
No. The double counting appears only on the chat→message conversion path (opencode go, for example); the official DeepSeek message protocol itself is unaffected.

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.