fix(pricing): store per-token costs per token, not per 1k or per 1M - #38167
Conversation
model_prices_and_context_window.json documents input_cost_per_token as "USD per prompt token", but 16 entries hold the vendor's quoted figure at its published unit instead. Thirteen wandb/* entries carry W&B's per-1M-token price scaled by 1e5 too little, so wandb/openai/gpt-oss-120b billed $15,000 per 1M input tokens rather than $0.15. Every other provider's gpt-oss-120b sits at 1.5e-07, and the two wandb entries added later (Kimi-K2.5, MiniMax-M2.5) already use the per-token unit, so the ratio is a straight unit mistake rather than W&B being expensive. azure_ai/jais-30b-chat holds Azure's per-1,000-token price ($0.0032 in, $0.00971 out), 1000x high. watsonx/bigscience/mt0-xxl-13b and watsonx/core42/jais-13b-chat both sat at 0.0005/0.002 while every other watsonx model is 1e-07 to 3e-06; IBM prices both at $1.80 per 1M tokens, matching watsonx/sdaia/allam-1-13b-instruct's existing 1.8e-06. Cost tracking, budgets and the x-litellm-response-cost header all read these fields, so a session budget on any of these models tripped on the first request instead of the ten-thousandth. The magnitude guard in test_model_prices_schema.py fails on all 30 of the bad values before this change, and covers every USD-per-token field in both the main map and the backup copy the SDK falls back to.
|
|
Greptile SummaryCorrects mis-scaled per-token pricing metadata and adds regression coverage for pricing units.
Confidence Score: 5/5The PR appears safe to merge, with synchronized pricing corrections and focused regression coverage. The changed price maps remain synchronized, the W&B expectations directly cover the corrected entries, and the schema guard checks both runtime pricing sources without introducing network dependencies.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Corrects per-token prices for affected Azure AI, W&B, and watsonx models without changing their metadata contracts. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the primary pricing-map corrections so fallback pricing remains synchronized. |
| tests/test_litellm/test_cost_calculator.py | Adds exact expected prices for thirteen corrected W&B model entries without weakening existing assertions. |
| tests/test_litellm/test_model_prices_schema.py | Adds a local-file regression test that rejects implausibly large numeric USD-per-token values in both pricing maps. |
Reviews (1): Last reviewed commit: "fix(pricing): store per-token costs per ..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Superseded by the rolling registry PR #39388, which re-verified these rows against the official pricing pages and absorbed the confirmed ones. |
model_prices_and_context_window.json documents input_cost_per_token as "USD per prompt token", but 16 entries hold the vendor's quoted figure at its published unit instead.
Thirteen wandb/* entries carry W&B's per-1M-token price scaled by 1e5 too little, so wandb/openai/gpt-oss-120b billed $15,000 per 1M input tokens rather than $0.15. Every other provider's gpt-oss-120b sits at 1.5e-07, and the two wandb entries added later (Kimi-K2.5, MiniMax-M2.5) already use the per-token unit, so the ratio is a straight unit mistake rather than W&B being expensive.
azure_ai/jais-30b-chat holds Azure's per-1,000-token price ($0.0032 in, $0.00971 out), 1000x high. watsonx/bigscience/mt0-xxl-13b and watsonx/core42/jais-13b-chat both sat at 0.0005/0.002 while every other watsonx model is 1e-07 to 3e-06; IBM prices both at $1.80 per 1M tokens, matching watsonx/sdaia/allam-1-13b-instruct's existing 1.8e-06.
Cost tracking, budgets and the x-litellm-response-cost header all read these fields, so a session budget on any of these models tripped on the first request instead of the ten-thousandth.
The magnitude guard in test_model_prices_schema.py fails on all 30 of the bad values before this change, and covers every USD-per-token field in both the main map and the backup copy the SDK falls back to.
User Flow
Relevant issues
Linear ticket