-
[issue-5618] [BE] fix: bill LiteLLM OTel cache tokens at cache-read rate (#5643)
发布于
2026-03-17 15:15:25 +00:00 - [issue-5618] [BE] fix: add OTel cache token key fallback in SpanCostCalculator
LiteLLM via OpenTelemetry emits cache token counts as bare keys (e.g.
cache_read_input_tokens) without theoriginal_usage.prefix used by
the Python SDK. Add fallbacks to these OTel bare keys in both
textGenerationWithCacheCostOpenAIand
textGenerationWithCachedTokensNotIncludedInCost(used by Anthropic and
Bedrock) so cache-read tokens are billed at the cache-read rate rather
than the full input rate.Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
- [issue-3447] [BE] Polish SpanCostCalculatorTest per review feedback
- Merge two OpenAI cache cost @Tests into @ParameterizedTest provideOpenAICacheCostCases
- Merge Anthropic and Bedrock OTel fallback @Tests into @ParameterizedTest provideAnthropicBedrockCacheCostCases
- Replace BigDecimal arithmetic expected values with direct strings, keeping math in comments
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Co-authored-by: Douglas Blank doug@comet.com
Co-authored-by: Claude Sonnet 4.6 noreply@anthropic.com下载附件