Skip to content

fix(model_prices): correct gemini 3.1 flash image and deepseek v4 pricing, add openai deprecation dates - #37473

Merged
mateo-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_model_registry_audit_20260819
Aug 19, 2026
Merged

fix(model_prices): correct gemini 3.1 flash image and deepseek v4 pricing, add openai deprecation dates#37473
mateo-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_model_registry_audit_20260819

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Gemini 3.1 Flash Image billed at batch price, not standard
  • DeepSeek V4 prices match no published DeepSeek tier
  • Six retired OpenAI models carry no deprecation date

How it solves it:

  • Standard and batch fields set from Google's pricing table
  • DeepSeek V4 set to the official peak rates
  • Announced shutdown dates added to the six entries

User Flow

Before: a developer calling gemini/gemini-3.1-flash-image and deepseek/deepseek-v4-pro through the gateway is billed roughly half of what the provider actually charges, and sees nothing telling them the OpenAI moderation and instruct models are already shut down

  1. They send POST https://litellm-domain/v1/chat/completions with "model": "gemini/gemini-3.1-flash-image"
  2. The response header x-litellm-response-cost and https://litellm-domain/ui/?page=logs report input billed at $0.25 per 1M tokens, while Google charges $0.50 for the same standard-tier call
  3. They repeat with "model": "deepseek/deepseek-v4-pro" and get $0.435 per 1M input tokens logged against DeepSeek's actual $1.32
  4. They GET https://litellm-domain/model/info and the entries for text-moderation-latest, babbage-002, davinci-002 and gpt-3.5-turbo-instruct come back with no shutdown date, so nothing warns them these models are retired

After: the same calls are billed at the provider's published rate, and the retired models report their shutdown dates

  1. They send the same POST https://litellm-domain/v1/chat/completions with "model": "gemini/gemini-3.1-flash-image"
  2. x-litellm-response-cost and https://litellm-domain/ui/?page=logs now report input at $0.50 per 1M tokens, matching Google's standard tier, and batch requests stay at $0.25
  3. The same deepseek/deepseek-v4-pro call is logged at $1.32 per 1M input tokens and $3.96 per 1M output tokens
  4. GET https://litellm-domain/model/info returns "deprecation_date": "2025-10-27" for the three text-moderation-* models and "deprecation_date": "2026-09-28" for gpt-3.5-turbo-instruct, babbage-002 and davinci-002

Relevant issues

Supports #26900

Linear ticket

Resolves LIT-5849

Pre-Submission checklist

  • 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

Sources for every changed value

Gemini 3.1 Flash Image

Source: https://ai.google.dev/gemini-api/docs/pricing#gemini-3.1-flash-image

That table gives, for the Standard tier, input $0.50 per 1M tokens (text/image) and output $3 per 1M (text and thinking), with the Batch tier at $0.25 and $1.50. Both gemini/gemini-3.1-flash-image and gemini/gemini-3.1-flash-image-preview had the batch numbers sitting in the standard fields and half-batch in the _batches fields, so every tier was understated by 2x

field before after
input_cost_per_token 2.5e-07 5e-07
output_cost_per_token 1.5e-06 3e-06
input_cost_per_token_batches 1.25e-07 2.5e-07
output_cost_per_token_batches 7.5e-07 1.5e-06

Cross-check inside this same file: the vertex_ai/gemini-3.1-flash-image entries already use 5e-07 and 3e-06. The image-token and per-image fields (6e-05, and 0.045 for a 0.5K image) already match the page, so they are untouched

DeepSeek V4

Source: https://api-docs.deepseek.com/quick_start/pricing

Peak rates from that table: deepseek-v4-flash is $0.014 cache-hit input, $0.44 cache-miss input, $1.32 output per 1M tokens, and deepseek-v4-pro is $0.044, $1.32 and $3.96. Off-peak is exactly half of peak, which this file cannot express, so the peak (list) rate is used, matching how the existing deepseek-chat entry carries DeepSeek's list price. The values in the registry ($0.14 / $0.28 for flash, $0.435 / $0.87 for pro) match neither the peak nor the off-peak column

Updated input_cost_per_token, output_cost_per_token, cache_read_input_token_cost and input_cost_per_token_cache_hit on deepseek-v4-flash, deepseek-v4-pro and their deepseek/ prefixed twins. Context length (1M) and max output (384K, stored as 393216) already matched the page

OpenAI deprecations

Source: https://developers.openai.com/api/docs/deprecations

model shutdown date on the page added
text-moderation-007, text-moderation-latest, text-moderation-stable 2025-10-27 "deprecation_date": "2025-10-27"
gpt-3.5-turbo-instruct, babbage-002, davinci-002 2026-09-28 "deprecation_date": "2026-09-28"

The key name and ISO format match the 335 entries that already carry deprecation_date, which is what litellm/proxy/common_utils/model_deprecation.py parses. Azure, vercel_ai_gateway/* and github_copilot/* copies of these models are left alone because those platforms publish their own lifecycle dates, and the gpt-3.5-turbo-instruct-0914 snapshot is not on OpenAI's table

Also audited, nothing verifiably wrong

Anthropic (https://platform.claude.com/docs/en/about-claude/model-deprecations), Gemini deprecations (https://ai.google.dev/gemini-api/docs/deprecations), Groq (https://console.groq.com/docs/deprecations) and Mistral (https://docs.mistral.ai/getting-started/models/models_overview/) all agree with the dates already in the registry, including the Gemini rows where a fetch-tool summary disagreed with the live page

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Shared setup: a proxy started with LITELLM_LOCAL_MODEL_COST_MAP=True and master_key: sk-1234, serving gemini/gemini-3.1-flash-image, deepseek/deepseek-v4-pro, text-moderation-latest, babbage-002, davinci-002 and gpt-3.5-turbo-instruct, run once from a worktree at the merge base and once from the branch tip so each process loads the intended registry. The Gemini and DeepSeek calls are real provider API calls that cost real money. /spend/logs was unavailable on this box (the configured database has no LiteLLM_SpendLogs table), so the spend evidence is the x-litellm-response-cost header plus the usage block from the same response. The DeepSeek runs used DB-less proxies on random free ports (41783 before, 43498 after)

Before (c696fdf)

Deprecation metadata for the six OpenAI models

  1. Query the deprecation route:
curl -sS -H 'Authorization: Bearer sk-1234' \
  'http://localhost:4000/model/deprecations?warn_within_days=90' |
jq '{deprecated: [.deprecated[] | select(.model_name == "text-moderation-latest" or .model_name == "babbage-002" or .model_name == "davinci-002" or .model_name == "gpt-3.5-turbo-instruct") | {model_name,deprecation_date,days_until_deprecation,status}], imminent: [.imminent[] | select(.model_name == "text-moderation-latest" or .model_name == "babbage-002" or .model_name == "davinci-002" or .model_name == "gpt-3.5-turbo-instruct") | {model_name,deprecation_date,days_until_deprecation,status}], upcoming: [.upcoming[] | select(.model_name == "text-moderation-latest" or .model_name == "babbage-002" or .model_name == "davinci-002" or .model_name == "gpt-3.5-turbo-instruct") | {model_name,deprecation_date,days_until_deprecation,status}]}'
  1. Nothing is reported, so an operator gets no warning that these models are retired or 40 days from shutdown:
{
  "deprecated": [],
  "imminent": [],
  "upcoming": []
}

Billed cost of a real Gemini 3.1 Flash Image generation

  1. Send the request:
curl -sS -D /tmp/before.headers -o /tmp/before.body \
  -X POST 'http://localhost:4000/v1/images/generations' \
  -H 'Authorization: Bearer sk-1234' -H 'Content-Type: application/json' \
  --data '{"model":"gemini/gemini-3.1-flash-image","prompt":"A small red circle on a white background"}'
  1. The response is billed at the batch rates that were sitting in the standard fields:
HTTP 200
x-litellm-response-cost: 0.0674
{"usage":{"total_tokens":1260,"input_tokens":8,"output_tokens":1252,
          "output_tokens_details":{"image_tokens":1120,"text_tokens":132}}}
  1. That is 8 x 2.5e-7 + 132 x 1.5e-6 + 1120 x 6e-5 = 0.067400, i.e. input charged at $0.25 per 1M and output text at $1.50 per 1M, half of Google's standard tier

Billed cost of a real DeepSeek V4 Pro chat completion

  1. Send the request:
curl -sS -D /tmp/lit5849_before.headers -o /tmp/lit5849_before.body \
  -X POST 'http://localhost:41783/v1/chat/completions' \
  -H 'Authorization: Bearer sk-1234' -H 'Content-Type: application/json' \
  --data '{"model":"deepseek/deepseek-v4-pro","messages":[{"role":"user","content":"Reply with exactly the word: pong"}]}'
  1. The response is billed at the old registry rates that match no published DeepSeek tier:
HTTP/1.1 200 OK
x-litellm-response-cost: 6.3945e-05
x-litellm-response-cost-input: 3.9585e-05
x-litellm-response-cost-output: 2.436e-05
{"usage":{"completion_tokens":28,"prompt_tokens":91,"total_tokens":119,
          "completion_tokens_details":{"reasoning_tokens":25},
          "prompt_tokens_details":{"cached_tokens":0},
          "prompt_cache_hit_tokens":0,"prompt_cache_miss_tokens":91}}
  1. That is 91 x 4.35e-7 + 28 x 8.7e-7 = 0.000063945, i.e. input at $0.435 per 1M and output at $0.87 per 1M, roughly a third of DeepSeek's published $1.32 / $3.96 peak rates

After (dcd8bb3)

Deprecation metadata for the six OpenAI models

  1. Same query as before:
curl -sS -H 'Authorization: Bearer sk-1234' \
  'http://localhost:4000/model/deprecations?warn_within_days=90' | jq '<same filter as above>'
  1. The announced dates now come back, with text-moderation-latest already past shutdown and the three instruct/completion models flagged 40 days out:
{
  "deprecated": [
    {"model_name": "text-moderation-latest", "deprecation_date": "2025-10-27",
     "days_until_deprecation": -296, "status": "deprecated"}
  ],
  "imminent": [
    {"model_name": "babbage-002", "deprecation_date": "2026-09-28",
     "days_until_deprecation": 40, "status": "imminent"},
    {"model_name": "davinci-002", "deprecation_date": "2026-09-28",
     "days_until_deprecation": 40, "status": "imminent"},
    {"model_name": "gpt-3.5-turbo-instruct", "deprecation_date": "2026-09-28",
     "days_until_deprecation": 40, "status": "imminent"}
  ],
  "upcoming": []
}

Billed cost of a real Gemini 3.1 Flash Image generation

  1. Same request:
curl -sS -D /tmp/after.headers -o /tmp/after.body \
  -X POST 'http://localhost:4000/v1/images/generations' \
  -H 'Authorization: Bearer sk-1234' -H 'Content-Type: application/json' \
  --data '{"model":"gemini/gemini-3.1-flash-image","prompt":"A small red circle on a white background"}'
  1. The response is now billed at the standard tier:
HTTP 200
x-litellm-response-cost: 0.068263
{"usage":{"total_tokens":1481,"input_tokens":8,"output_tokens":1473,
          "output_tokens_details":{"image_tokens":1120,"text_tokens":353}}}
  1. That is 8 x 5e-7 + 353 x 3e-6 + 1120 x 6e-5 = 0.068263, i.e. input at $0.50 per 1M and output text at $3.00 per 1M, matching Google's standard tier. The model returns a different number of thinking/text tokens on every call, so compare the per-token rates in the arithmetic rather than the two totals

Billed cost of a real DeepSeek V4 Pro chat completion

  1. Same request:
curl -sS -D /tmp/lit5849_after.headers -o /tmp/lit5849_after.body \
  -X POST 'http://localhost:43498/v1/chat/completions' \
  -H 'Authorization: Bearer sk-1234' -H 'Content-Type: application/json' \
  --data '{"model":"deepseek/deepseek-v4-pro","messages":[{"role":"user","content":"Reply with exactly the word: pong"}]}'
  1. The response is now billed at DeepSeek's published peak rates:
HTTP/1.1 200 OK
x-litellm-response-cost: 0.00022308
x-litellm-response-cost-input: 0.00012012000000000001
x-litellm-response-cost-output: 0.00010296
{"usage":{"completion_tokens":26,"prompt_tokens":91,"total_tokens":117,
          "completion_tokens_details":{"reasoning_tokens":23},
          "prompt_tokens_details":{"cached_tokens":0},
          "prompt_cache_hit_tokens":0,"prompt_cache_miss_tokens":91}}
  1. That is 91 x 1.32e-6 + 26 x 3.96e-6 = 0.00022308, i.e. input at $1.32 per 1M and output at $3.96 per 1M, exactly DeepSeek's peak column. The model returns a different number of reasoning tokens per call, so compare the per-token rates rather than the two totals

QA observations from the DeepSeek legs:

  • DeepSeek routes these calls to api.deepseek.com/beta; unrelated to this PR
  • Reasoning tokens bill inside output cost; this PR leaves that alone
  • Both calls had zero cached tokens, so cache-hit rates stay doc-verified only

Type

🐛 Bug Fix

Caveats (if any)

  • DeepSeek input/output rates proven live; cache-hit rate doc-verified only
  • No batch variant of output_cost_per_image_token exists in the schema, so Gemini batch image pricing stays inexpressible (pre-existing gap)
  • V4 Pro previously held a discounted price from [Feature]: Add cost mapping for Deepseek V4 Flash and Pro #26709, now list price
  • Updated the two DeepSeek V4 assertions in tests/test_litellm/test_utils.py
  • gemini-3.1-flash-lite-image, gemini-3.5-live-translate-preview, gemini-omni-flash still missing
  • Google serves no static token limits for those, so adding them means guessing
  • Same for Bedrock amazon.nova-reel-v1:0/v1:1 and amazon.nova-sonic-v1:0
  • xAI docs are unreachable from this box, so Grok entries went unaudited

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

Link to Devin session: https://app.devin.ai/sessions/9d0d242e58ed4a5b8fc2f892bf2713e9

…ation dates

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@CLAassistant

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.

@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR corrects Gemini 3.1 Flash Image and DeepSeek V4 pricing metadata and adds OpenAI model deprecation dates.

  • Updates standard, batch, output, and cache-hit pricing in both cost registries.
  • Keeps the primary and backup registries synchronized.
  • Updates DeepSeek V4 tests to assert the corrected prices for bare and provider-prefixed model names.

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported stale DeepSeek pricing assertions have been updated consistently across both cost-map tests, and no blocking failure remains.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Updates canonical Gemini and DeepSeek pricing plus OpenAI deprecation metadata consistently; no eligible follow-up issue remains.
litellm/model_prices_and_context_window_backup.json Mirrors the canonical registry changes without detected divergence.
tests/test_litellm/test_utils.py Correctly updates all relevant DeepSeek V4 assertions in both primary and backup registry tests, resolving the previous stale-test finding.

Reviews (2): Last reviewed commit: "test(model_prices): update DeepSeek V4 p..." | Re-trigger Greptile

Comment thread model_prices_and_context_window.json
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@codspeed-hq

codspeed-hq Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_model_registry_audit_20260819 (dcd8bb3) with litellm_internal_staging (559310f)1

Open in CodSpeed

Footnotes

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

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit dcd8bb3. Configure here.

@mateo-berri mateo-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mateo-berri
mateo-berri merged commit b8d5139 into litellm_internal_staging Aug 19, 2026
74 checks passed
@mateo-berri
mateo-berri deleted the litellm_model_registry_audit_20260819 branch August 19, 2026 21:50
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