Skip to content

Duplicate usage records double consumption - Pi

Quick fix

When Pi uses the cc-switch local proxy, the same request may be charged twice; a verified deduplication fix is still pending.

Error output
pi 配置ccs的代理地址,会走到codex代理,然后和pi session 消耗重复记录两次消耗量多记录一倍
English translation

With pi configured to use the ccs proxy address, requests go through the codex proxy, and consumption is recorded twice in the pi session, doubling usage.

This open defect report says that after Pi is configured with a cc-switch proxy address, the same call appears in both proxy accounting and Pi session import records, doubling usage. The comments show two records with identical model, token, and time; failed requests may also appear in pairs, while the Pi session side shows a 500 normalized from `stopReason=error`.

A proposed cause is that Pi session JSONL assistant messages contain only a logical `provider` label and no `baseUrl`, so the importer cannot determine whether the call passed through the local gateway. A comment proposes matching the upstream `responseId` against an existing gateway usage record and skipping the Pi copy; however, the issue remains open, the original post provides no verified solution, and historical duplicate records are not cleaned up automatically.

  1. This issue is still open and the original post provides no verified user-side solution; follow updates to #6794. The deduplication approach proposed in comments should skip the Pi session import copy only when the upstream `responseId` matches an existing gateway usage record.

ToolPi
Version受影响:v3.20.0 - v3.20.1
PlatformsWindows

(No FAQ yet)

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.