Commit c7f61dd
committed
fix(ai-gateway): stop double-charging cache tokens in spend
domain.Usage.PromptTokens is cache-inclusive, but usageFromDomain mapped
it straight onto the spend wire's input_tokens while also sending the
cache read and cache creation buckets separately, so the rating side
charged cached tokens at both the input rate and the cache rate. Subtract
the cache buckets from input_tokens, matching the span emitter's
exclusive split.
Fixes langwatch#7018.1 parent d826d5a commit c7f61dd
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
0 commit comments