Repository navigation
Replies: 5 comments
|
从「用量展示/计费插件」消费者的角度支持这个观察:DSH 事件里的分桶和官方控制台对不上,在下游会放大——尤其 8/16 涨价后 cache hit/miss 单价差 30 倍(¥0.15/M vs ¥4.5/M),分桶错一点,账单就差一个数量级。这类字段歧义是所有下游展示/计费插件的共同坑,官方若能在 translate.ts 里定死优先级并写进文档,下游(包括我们的跨工具用量监测器 metera)对账才有稳定基线:https://github.com/Sutera-Diffusus/metera |
|
Source confirmation of the intended mapping, without claiming the dashboard delta is a confirmed wire bug.
The unit tests only lock the equal-values case ( So today the adapter’s contract is: not: That matches the file comment. It does not by itself prove the console-vs-DSH redistribution you saw — that still needs one raw SSE/JSON usage object where the two hit spellings differ, or where Until then, a conservative product change would be: keep subtracting hits from |
|
Your two totals agree more closely than the split does, and I think that is the finding. Console: 59,261,184 + 1,033,483 = 60,294,667 prompt tokens. 0.12% apart on the total, while 637,609 tokens changed side. A counting bug moves the total. A mapping bug moves the split. Yours moves the split, which supports reading this as It also says the fold underneath your dashboard is sound, which is worth stating because most aren't. I folded a DSH session corpus four ways last week: naive summing comes out at exactly 2.000000× the deduplicated total (usage rides both One correction that moves your numbers the other way. On the raw response you said you haven't captured: you don't need to catch both spellings disagreeing before you can call it. Assert Direction matters for whoever picks this up. Your dashboard reports more hit and less miss than the bill, and hit is the cheap side, so the error understates cost rather than inflating it. I can't reproduce your mapping directly (my corpus is MiniMax-M3 and a local qwen route, both |
|
Source check on the two points that touch this thread.
Direction versus these numbers: the DSH column is already high on hit and low on miss. Compaction samples in this tree are cache-read heavy, so omitting them makes the DSH hit column smaller. That cannot produce the +708k hit / −638k miss flip; correcting it widens the residue. Subtract those tokens from the console side (or add them to DSH) before sizing On the capture: agreed, a lucky disagreeing pair is not a prerequisite. The two predicates
are exactly the cases current I do not have the OP fold. If izz-BLUE posts it, the split can be re-run on the same log. |
|
Agreed, and your direction argument closes the part I raised. Restating it so it doesn't get reopened: So the order is: subtract compaction from the console side (or add it to DSH), then size what's left against On the capture, agreed on both predicates as the trigger and agreed on not flipping precedence from the delta alone. Those two assertions fire on exactly the responses that matter and stay quiet otherwise, so they can run continuously without anyone watching a log. Worth sizing the stakes with the rates Sutera-Diffusus cited. At ¥0.15/M hit vs ¥4.5/M miss, the 638k tokens on the wrong side of that boundary understate this one day by roughly ¥2.8. Small in absolute terms, and I'd rather say so than inflate it. But it's a 30× unit-price boundary and the error direction is always toward the cheap side, so the bucket is worth fixing before anyone builds billing on it. @le-soleil-se-couche posted a fully synthetic projection fixture in #1886. Its rule 3 adds @izz-BLUE the fold is still the blocker. Post it and two of us will run the split on the same log. |
Uh oh!
There was an error while loading. Please reload this page.
I noticed a possible usage-mapping mismatch in the DeepSeek adapter (
@deepseek-ai/dsh-llm-deepseek) that may affect cache hit / cache miss accounting.The current adapter normalizes usage in
packages/llm/llm-deepseek/src/translate.ts(mapUsage, lines 53–62):This means:
prompt_tokens_details.cached_tokenstakes precedence overprompt_cache_hit_tokensprompt_cache_miss_tokensis not used directlyprompt_tokens - cacheReadWhile reviewing a DeepSeek usage dashboard built from DSH session events, I observed a noticeable difference compared with the DeepSeek console for the same day.
DeepSeek console:
DSH-derived dashboard around the same time:
The snapshots were not taken at exactly the same second, so a small total-token difference is expected, but the hit/miss redistribution is much larger than the timing difference.
The pricing calculation itself appears consistent with DeepSeek's published rates. The discrepancy seems to occur before pricing, in the usage buckets.
For reference, the DeepSeek wire schema (
packages/llm/llm-deepseek/src/types.ts,WireUsage) exposes both native cache fields and the OpenAI-compat spelling:Would it be more accurate for the adapter to prefer the native DeepSeek billing fields when available, for example:
I am not claiming this is definitely a bug yet, because I have not captured a raw response where both cache spellings are present and demonstrably different.
Could you confirm the intended semantics of
prompt_tokens_details.cached_tokensvsprompt_cache_hit_tokens, and whetherprompt_cache_miss_tokensshould be preferred when available?Thanks.
All reactions