Fix CLIProxyApi model normalization and cross-provider pricing in Claude Code (#2393) - #2415
Fix CLIProxyApi model normalization and cross-provider pricing in Claude Code (#2393)#2415Yuxin-Qiao wants to merge 3 commits into
Conversation
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: Fix CLIProxyApi model normalization and cross-provider pricing in Claude Code (#2393) This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e31d068c69
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| inputTokens: totalPromptTokens, | ||
| cachedInputTokens: cacheReadInputTokens, | ||
| outputTokens: outputTokens, | ||
| cacheWriteInputTokens: 0, |
There was a problem hiding this comment.
Preserve cache-write tokens when pricing proxy OpenAI logs
When Claude Code logs a non-Claude model with cache_creation_input_tokens, totalPromptTokens already includes those cache-write tokens, but this call passes cacheWriteInputTokens: 0. codexCostUSD then treats the writes as ordinary uncached input, so proxy OpenAI models with cache-write tariffs (for example GPT-5.6 built-ins or models.dev cache_write rates) get incorrect costs; pass cacheCreationInputTokens as the cache-write subset instead.
Useful? React with 👍 / 👎.
|
Closing in favor of #2413 |
Fixes #2393
Summary
CLIProxyApior custom proxies in Claude Code, non-Claude models or proxy model names (e.g.cli-proxy-gpt-5.4,cli-proxy-gpt4o) logged in Claude Code resulted incostUSD = nil(unpriced / unknown model cost).cli-proxy-,proxy-,openai/,anthropic/, etc.) and model alias normalization inCostUsagePricing.claudeCostUSDso non-Claude models logged under Claude Code can resolve prices across OpenAI /models.devcatalogs.CostUsageScannerClaudeRegressionTests.swift.Verification
swift test --filter "issue 2393"(passed).make check(passed).