- [Token Cache Hit Rate Overflow Defense & Financial Inversion Auto-Heal] (PR #4015, Thanks to @cubelikeplayDaniel):
- Cross-Protocol Prompt Cache Accounting Normalization: Resolved an issue under the Anthropic Claude protocol where uncached incremental prompt tokens and cached tokens are reported separately (
input_tokensvscache_read_input_tokens). When computing hit rates using raw incremental tokens as total input, the rate exceeded 100% (e.g. 108.8%). Implemented non-destructive dynamic healing acrossTokenStats,AppleBentoView, andCyberCockpitViewto restore effective full prompt context (total_input + cached), strictly clamping hit rate to[0, 100%]. (PR #4015, Thanks to @cubelikeplayDaniel) - Eliminate Cost Zeroing & Savings Inversion: Fixed
Math.max(0, total_input - cached)in cost computation erroneously clamping to 0 when incremental input was less than cached tokens, which severely deflated total expenditure and produced inverted savings exceeding total costs. Added canonical saturating additions on the backendtoken_stats.rsinsertion path to prevent future database pollution. (PR #4015, Thanks to @cubelikeplayDaniel)
- Cross-Protocol Prompt Cache Accounting Normalization: Resolved an issue under the Anthropic Claude protocol where uncached incremental prompt tokens and cached tokens are reported separately (
- [Gemini Inbound Dynamic Thinking Budget Alignment] (Fixes #4012, PR #4014, Thanks to @vecyang1):
- Restore Dynamic Thinking for
thinkingBudget: -1: Fixed an issue where client requests passingthinkingBudget: -1(Gemini SDK standard for adaptive/dynamic thinking) via the Gemini protocol were erroneously mapped to0inwrap_request_v2, causingInboundThinkingPipelineto disable thinking and strip thought chains. Accurately identifies-1as enabled dynamic thinking while strictly respecting explicitthinkingBudget: 0andincludeThoughts: falseopt-outs. (Fixes #4012, PR #4014, Thanks to @vecyang1)
- Restore Dynamic Thinking for
- [Token 缓存命中率防溢出与核算成本倒挂自愈] (PR #4015, Thanks to @cubelikeplayDaniel):
- 跨协议 Prompt 缓存记账口径归一化: 修复在 Anthropic Claude 协议下,上游响应将未命中缓存增量与缓存读取分离(
input_tokens与cache_read_input_tokens),导致前端将增量输入直接作为总输入计算时,缓存命中率异常溢出至 100% 以上(如 108.8%)的问题。在TokenStats、AppleBentoView与CyberCockpitView中引入非破坏性自愈机制,自动恢复有效完整 Prompt 上下文(total_input + cached),将命中率严格收敛于[0, 100%]。(PR #4015, Thanks to @cubelikeplayDaniel) - 根除成本截断归零与节省金额倒挂: 修复成本计算中
Math.max(0, total_input - cached)因增量输入小于缓存 token 数量而被强行截断归零、导致总支出严重低估且估算节省金额反超总支出数倍的财务核算倒挂缺陷;并在后端token_stats.rs写入层引入饱和加法规范化,杜绝未来增量数据污染 SQLite 数据库。(PR #4015, Thanks to @cubelikeplayDaniel)
- 跨协议 Prompt 缓存记账口径归一化: 修复在 Anthropic Claude 协议下,上游响应将未命中缓存增量与缓存读取分离(
- [Gemini 入站动态思考开启判定与协议对齐] (Fixes #4012, PR #4014, Thanks to @vecyang1):
What's Changed
- fix(proxy): merge object-only anyOf/oneOf unions instead of keeping one branch by @snailb1007 in #3878
New Contributors
- @snailb1007 made their first contribution in #3878
Full Changelog: v5.0.4-beta.19...v5.0.4-beta.20