Skip to content

fix(pricing): correct wandb model prices off by 100,000x - #33947

Closed
MattFisher wants to merge 1 commit into
BerriAI:litellm_oss_daily_2026_07_17from
MattFisher:claude/litellm-pricing-anomalies-woum6c
Closed

fix(pricing): correct wandb model prices off by 100,000x#33947
MattFisher wants to merge 1 commit into
BerriAI:litellm_oss_daily_2026_07_17from
MattFisher:claude/litellm-pricing-anomalies-woum6c

Conversation

@MattFisher

Copy link
Copy Markdown

Relevant issues

Fixes #23503

This corrects a longstanding unit error in the wandb pricing entries. The same "off by 100,000x" problem was reported upstream before and two fix attempts (#23517 and #23521, both referencing #23503) were closed without merging, so the wrong values are still live on the served cost map

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

The end-user-visible symptom is the per-request cost. Run a real wandb completion through a live proxy and read the cost header at the parent commit versus this commit

  1. Put your key in .env as WANDB_API_KEY, then write a minimal config wandb_proof.yaml:
model_list:
  - model_name: wandb-r1
    litellm_params:
      model: wandb/deepseek-ai/DeepSeek-R1-0528
      api_key: os.environ/WANDB_API_KEY
  1. Start the proxy: python litellm/proxy/proxy_cli.py --config wandb_proof.yaml --detailed_debug 2>&1 | tee litellm.log

  2. Make a real call and read the cost header:

curl -s -i http://localhost:4000/v1/chat/completions \
  -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
  -d '{"model":"wandb-r1","messages":[{"role":"user","content":"Reply with exactly: hi"}]}' \
  | grep -i x-litellm-response-cost
  1. After this fix the header reports a fraction of a cent for a few tokens; at the parent commit (git stash or check out HEAD~1 and repeat) the same call reports a cost in the hundreds of dollars, because output was billed at $0.54 per token instead of $0.54 per 1M tokens

Type

🐛 Bug Fix

Changes

Thirteen wandb/* entries had input_cost_per_token and output_cost_per_token set to the dollars-per-1M-tokens figure from the W&B Inference pricing page, stored directly in the per-token field. That inflates every price by 100,000x. Sorting the cost map by output_cost_per_token descending puts these entries at the very top of the entire catalog; the worst, wandb/deepseek-ai/DeepSeek-R1-0528, reads as $540,000 per 1M output tokens

The tell is internal to the file: three sibling wandb entries (Kimi-K2-Instruct, Kimi-K2.5, MiniMax-M2.5) are already stored correctly at roughly 1e-06 per token, which is the scale the rest should be on. Each corrected value below is the stored figure divided by 100,000, and matches the W&B Inference pricing page

Model input (before -> after) output (before -> after) W&B $/1M in/out
openai/gpt-oss-120b 0.015 -> 1.5e-07 0.06 -> 6e-07 0.15 / 0.60
openai/gpt-oss-20b 0.005 -> 5e-08 0.02 -> 2e-07 0.05 / 0.20
zai-org/GLM-4.5 0.055 -> 5.5e-07 0.2 -> 2e-06 0.55 / 2.00
Qwen/Qwen3-235B-A22B-Instruct-2507 0.01 -> 1e-07 0.01 -> 1e-07 0.10 / 0.10
Qwen/Qwen3-Coder-480B-A35B-Instruct 0.1 -> 1e-06 0.15 -> 1.5e-06 1.00 / 1.50
Qwen/Qwen3-235B-A22B-Thinking-2507 0.01 -> 1e-07 0.01 -> 1e-07 0.10 / 0.10
meta-llama/Llama-3.1-8B-Instruct 0.022 -> 2.2e-07 0.022 -> 2.2e-07 0.22 / 0.22
deepseek-ai/DeepSeek-V3.1 0.055 -> 5.5e-07 0.165 -> 1.65e-06 0.55 / 1.65
deepseek-ai/DeepSeek-R1-0528 0.135 -> 1.35e-06 0.54 -> 5.4e-06 1.35 / 5.40
deepseek-ai/DeepSeek-V3-0324 0.114 -> 1.14e-06 0.275 -> 2.75e-06 1.14 / 2.75
meta-llama/Llama-3.3-70B-Instruct 0.071 -> 7.1e-07 0.071 -> 7.1e-07 0.71 / 0.71
meta-llama/Llama-4-Scout-17B-16E-Instruct 0.017 -> 1.7e-07 0.066 -> 6.6e-07 0.17 / 0.66
microsoft/Phi-4-mini-instruct 0.008 -> 8e-08 0.035 -> 3.5e-07 0.08 / 0.35

The wandb block is not maintained by .github/workflows/auto_update_price_and_context_window_file.py; that job only syncs openrouter/* and vercel_ai_gateway/*, and only into the served map. So the same fix is applied to both hand-maintained files, the served map model_prices_and_context_window.json and the bundled fallback litellm/model_prices_and_context_window_backup.json, and their wandb blocks are verified identical after the change

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Generated by Claude Code

@CLAassistant

CLAassistant commented Jul 20, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@MattFisher
MattFisher changed the base branch from main to litellm_internal_staging July 20, 2026 02:33
@MattFisher
MattFisher changed the base branch from litellm_internal_staging to litellm_oss_daily_2026_07_17 July 20, 2026 02:33
@MattFisher
MattFisher requested a review from a team July 20, 2026 02:33
@MattFisher
MattFisher changed the base branch from litellm_oss_daily_2026_07_17 to litellm_internal_staging July 20, 2026 02:34
@MattFisher
MattFisher changed the base branch from litellm_internal_staging to litellm_oss_daily_2026_07_17 July 20, 2026 02:37
Thirteen wandb/* entries stored input_cost_per_token and
output_cost_per_token as dollars-per-1M-tokens instead of per-token,
inflating every price by 100,000x. Sorting the cost map by
output_cost_per_token put these at the very top, e.g.
wandb/deepseek-ai/DeepSeek-R1-0528 reading $540,000 per 1M output
tokens. Each is corrected to the per-token value published on the W&B
Inference pricing page; the three already-correct wandb entries
(Kimi-K2-Instruct, Kimi-K2.5, MiniMax-M2.5) are left untouched.

The fix is applied to both the served map
(model_prices_and_context_window.json) and the bundled fallback
(litellm/model_prices_and_context_window_backup.json), which are
hand-maintained for wandb and were drifting from reality together.
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@MattFisher
MattFisher force-pushed the claude/litellm-pricing-anomalies-woum6c branch from 079e479 to 34965c9 Compare July 20, 2026 02:40
@codspeed-hq

codspeed-hq Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing MattFisher:claude/litellm-pricing-anomalies-woum6c (079e479) with litellm_oss_daily_2026_07_17 (1ebf2a7)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_oss_daily_2026_07_17 (dc9297d) during the generation of this report, so 73a2a19 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@MattFisher

Copy link
Copy Markdown
Author

@greptile-apps

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR corrects a unit error in 13 wandb/* model pricing entries where input_cost_per_token and output_cost_per_token held the raw $/1M-tokens figure instead of the per-token value (i.e., divided by 1,000,000), inflating every affected wandb cost calculation by 100,000×.

  • Both model_prices_and_context_window.json (served map) and litellm/model_prices_and_context_window_backup.json (bundled fallback) receive identical corrections, keeping the two files in sync.
  • The three wandb entries already stored at the correct per-token scale (Kimi-K2-Instruct, Kimi-K2.5, MiniMax-M2.5) are untouched.

Confidence Score: 5/5

Safe to merge — the change is a targeted numerical correction to pricing data with no logic modifications.

All 13 corrected per-token values divide the W&B $/1M figure by 1,000,000 and match the published pricing page; the ratio between old and new values is uniformly 100,000 across every entry. The three wandb models already stored at the correct scale are untouched. Both files are updated identically, keeping the served map and bundled fallback in sync.

No files require special attention.

Important Files Changed

Filename Overview
model_prices_and_context_window.json 13 wandb model entries corrected from $/1M-tokens values to proper per-token values (÷1,000,000); math verified correct for all entries; 3 already-correct entries left unchanged.
litellm/model_prices_and_context_window_backup.json Identical set of 13 wandb pricing corrections applied; backup file kept in sync with the served map.

Reviews (1): Last reviewed commit: "fix(pricing): correct wandb model prices..." | Re-trigger Greptile

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Superseded by the rolling registry PR #38207, which carries these values re-verified against the provider's own pricing page/API (DeepInfra publishes $/token and 262144 context for the Kimi K2.5 and K2.7 Code entries). Maintainers asked for a single open model-pricing PR at a time.

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.

[Bug]: wandb cost data is incorrect

3 participants