mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-10-16 20:46:51 +08:00
Deduct cache_write_tokens and cache_creation_tokens from gross prompt/input tokens when translating OpenAI Chat Completions and Codex Responses API to Anthropic Claude Messages format to prevent downstream double-counting. Include defensive guards against int64 overflow, clamp negative input_tokens to 0, and support <= 0 fallback to cache_creation_tokens alias.