Skip to content

cc-switch Usage Statistics Differ from DeepSeek Official Site / Stop Updating

Quick fix

Upgrade to v3.19.2 or later, then run “Rebuild Codex Usage” once on the “Usage Statistics” page to correct historical overcounts or missing records.

Error output
codex使用deepseek v4 flash,在ccswitch使用统计部分与deepseek官网不一致,使用一段时间后就不在更新
English translation

When using DeepSeek v4 flash with Codex, the usage statistics in cc-switch differ from the DeepSeek official site and stop updating after some time.

The Codex session log importer has a counter bug: when multiple independent cumulative counters alternate within one rollout file, the old algorithm computes differences across counters, inflating usage by as much as 6 times or more. A deduplication defect when replaying snapshots can also mistake later additional usage for a duplicate and discard it, causing statistics to stop updating. These are the shared root causes of the “does not match the official site” and “stops updating” symptoms. Another independent source of discrepancies is that DeepSeek Chat format uses the provider-specific cache-hit field prompt_cache_hit_tokens (instead of the OpenAI-style prompt_tokens_details.cached_tokens). CC Switch's usage parser and Responses conversion layer previously did not read this field, so all cache hits were recorded as 0 and billed at the full input price, while the DeepSeek official site applies a discounted rate to cache hits, making costs differ. Note that the official direct endpoint currently returns both fields with the same value, so cache hits from the official direct endpoint have always been read correctly. This gap only affects relays or upstreams that pass through the documented field alone.

  1. Upgrade cc-switch to v3.19.2 or later (this version includes the session importer fix in PR #5854).

  2. Run “Rebuild Codex Usage” once on the “Usage Statistics” page (rebuild). This step is required; historical overcounted data will not disappear automatically.

  3. After rebuilding, compare the statistics with the DeepSeek official site. If they still differ or still stop updating, redact the rollout JSONL files for the affected period under ~/.codex/sessions/ and submit them in an issue for further investigation.

ToolCodex
Version3.19.1 及更早版本(v3.19.2 修复)
PlatformsWindowsmacOSLinux

This page is distilled from 22 real issues

Why is historical usage still incorrect after upgrading to v3.19.2?
The fix ensures only that newly generated data is correct; historical overcounted data will not disappear automatically. You must manually run “Rebuild Codex Usage” once on the “Usage Statistics” page for the statistics to return to accurate values.
After upgrading and rebuilding, why do Codex requests through DeepSeek still often stop updating usage statistics, requiring another rebuild to refresh them?
v3.19.2 fixed the replay deduplication defect, but some users still report needing repeated rebuilds to update statistics. Confirm that you have upgraded to v3.20.0 or later. If the issue persists, redact the rollout JSONL files for the affected period under ~/.codex/sessions/ and submit them to issue #6073 for follow-up.
Why does cc-switch show 0 cache hits when the DeepSeek official site applies a cache discount?
DeepSeek Chat format reports cache hits using its provider-specific field prompt_cache_hit_tokens. CC Switch did not previously read this field, so all cache hits were recorded as 0 and billed at the full input price. This was fixed in PR #6126; after upgrading, both the parsing and conversion layers will support this field.
Why do usage statistics differ from the official site when Claude Code connects directly to the official DeepSeek endpoint?
The official direct endpoint currently returns both the standard cached_tokens field and the documented prompt_cache_hit_tokens field with the same value, so cache hits from the official direct endpoint have always been read correctly. If there is still a discrepancy, check whether you are using a relay gateway or whether other billing conventions differ.

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.