Skip to content

feat(weave): extract cache token pricing from LiteLLM#6485

Draft
andrewtruong wants to merge 1 commit intoandrew/l3-cache-price-columnsfrom
andrew/l4-cost-data-fetching
Draft

feat(weave): extract cache token pricing from LiteLLM#6485
andrewtruong wants to merge 1 commit intoandrew/l3-cache-price-columnsfrom
andrew/l4-cost-data-fetching

Conversation

@andrewtruong
Copy link
Copy Markdown
Collaborator

Summary

  • Extracts cache_read_input_token_cost and cache_creation_input_token_cost from LiteLLM's model_prices_and_context_window.json
  • Maps cache_creation_input_token_costcache_write_input_token_cost (our column name)
  • Updates both update_costs.py (fetching) and insert_costs.py (DB insertion) to handle the new fields
  • Change detection now also compares cache costs so price updates are captured

Depends on

Test plan

  • Run python update_costs.py and verify cost_checkpoint.json contains cache_read_input and cache_write_input fields
  • Verify cache costs for known models (e.g., Claude 3.5 Sonnet should have cache_read_input_token_cost: 3e-07)
  • Run cost insertion migration and verify cache columns are populated in ClickHouse

🤖 Generated with Claude Code

Extract cache_read_input_token_cost and cache_creation_input_token_cost
from LiteLLM's model_prices JSON and populate them into the
llm_token_prices table. This fills the new columns added in the L3
pricing migration with actual data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant