Skip to content

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

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

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

Conversation

@MattFisher

Copy link
Copy Markdown
Owner

Relevant issues

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 (BerriAI#23517 and BerriAI#23521, both referencing BerriAI#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

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.
@MattFisher
MattFisher force-pushed the claude/litellm-pricing-anomalies-woum6c branch from 079e479 to 34965c9 Compare July 20, 2026 02:40
@MattFisher
MattFisher changed the base branch from litellm_internal_staging to litellm_oss_daily_2026_07_17 July 20, 2026 02:41
@MattFisher

Copy link
Copy Markdown
Owner Author

This was just a draft for BerriAI#33947

@MattFisher MattFisher closed this Jul 20, 2026
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.

2 participants