You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: add prompt cache token support to cost and token telemetry #890
The pricing registry added in #882 computes cost from prompt_tokens and completion_tokens only. Anthropic (and OpenAI) return cache token counts separately in their API responses — these are currently discarded in the backend post_processing() step.
This has two consequences:
Cost is inaccurate — cache reads are billed at 10% of base input price; cache writes at 125–200%. Neither is reflected.
Token counts undercount — on Anthropic, input_tokens excludes cached tokens; cache_read_input_tokens and cache_creation_input_tokens are separate fields. mellea.llm.tokens.input therefore undercounts total tokens processed.
Scope
File
Change
mellea/backends/openai.py
Pass cache_creation_input_tokens / cache_read_input_tokens through into mot.usage
mellea/backends/litellm.py
Same
mellea/telemetry/builtin_pricing.json
Add cache_write_per_1m / cache_read_per_1m fields for Anthropic models
Activity
feat: add prompt cache token support to cost and token telemetry (gen…
feat: add prompt cache token support to cost telemetry (generative-co…
feat: add prompt cache token support to cost telemetry (generative-co…