fix(model_prices): correct gemini 3.1 flash image and deepseek v4 pricing, add openai deprecation dates - #37473
Conversation
…ation dates Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Greptile SummaryThe PR corrects Gemini 3.1 Flash Image and DeepSeek V4 pricing metadata and adds OpenAI model deprecation dates.
Confidence Score: 5/5The 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.
|
| 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
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>
|
bugbot run |
There was a problem hiding this comment.
✅ 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.
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a developer calling
gemini/gemini-3.1-flash-imageanddeepseek/deepseek-v4-prothrough 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"model": "gemini/gemini-3.1-flash-image"x-litellm-response-costand 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"model": "deepseek/deepseek-v4-pro"and get $0.435 per 1M input tokens logged against DeepSeek's actual $1.32text-moderation-latest,babbage-002,davinci-002andgpt-3.5-turbo-instructcome back with no shutdown date, so nothing warns them these models are retiredAfter: the same calls are billed at the provider's published rate, and the retired models report their shutdown dates
"model": "gemini/gemini-3.1-flash-image"x-litellm-response-costand 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.25deepseek/deepseek-v4-procall is logged at $1.32 per 1M input tokens and $3.96 per 1M output tokens"deprecation_date": "2025-10-27"for the threetext-moderation-*models and"deprecation_date": "2026-09-28"forgpt-3.5-turbo-instruct,babbage-002anddavinci-002Relevant issues
Supports #26900
Linear ticket
Resolves LIT-5849
Pre-Submission checklist
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-imageandgemini/gemini-3.1-flash-image-previewhad the batch numbers sitting in the standard fields and half-batch in the_batchesfields, so every tier was understated by 2xinput_cost_per_tokenoutput_cost_per_tokeninput_cost_per_token_batchesoutput_cost_per_token_batchesCross-check inside this same file: the
vertex_ai/gemini-3.1-flash-imageentries 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 untouchedDeepSeek V4
Source: https://api-docs.deepseek.com/quick_start/pricing
Peak rates from that table:
deepseek-v4-flashis $0.014 cache-hit input, $0.44 cache-miss input, $1.32 output per 1M tokens, anddeepseek-v4-prois $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 existingdeepseek-chatentry 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 columnUpdated
input_cost_per_token,output_cost_per_token,cache_read_input_token_costandinput_cost_per_token_cache_hitondeepseek-v4-flash,deepseek-v4-proand theirdeepseek/prefixed twins. Context length (1M) and max output (384K, stored as 393216) already matched the pageOpenAI deprecations
Source: https://developers.openai.com/api/docs/deprecations
text-moderation-007,text-moderation-latest,text-moderation-stable"deprecation_date": "2025-10-27"gpt-3.5-turbo-instruct,babbage-002,davinci-002"deprecation_date": "2026-09-28"The key name and ISO format match the 335 entries that already carry
deprecation_date, which is whatlitellm/proxy/common_utils/model_deprecation.pyparses. Azure,vercel_ai_gateway/*andgithub_copilot/*copies of these models are left alone because those platforms publish their own lifecycle dates, and thegpt-3.5-turbo-instruct-0914snapshot is not on OpenAI's tableAlso 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=Trueandmaster_key: sk-1234, servinggemini/gemini-3.1-flash-image,deepseek/deepseek-v4-pro,text-moderation-latest,babbage-002,davinci-002andgpt-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/logswas unavailable on this box (the configured database has noLiteLLM_SpendLogstable), so the spend evidence is thex-litellm-response-costheader 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
{ "deprecated": [], "imminent": [], "upcoming": [] }Billed cost of a real Gemini 3.1 Flash Image generation
{"usage":{"total_tokens":1260,"input_tokens":8,"output_tokens":1252, "output_tokens_details":{"image_tokens":1120,"text_tokens":132}}}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 tierBilled cost of a real DeepSeek V4 Pro chat completion
{"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}}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 ratesAfter (dcd8bb3)
Deprecation metadata for the six OpenAI models
text-moderation-latestalready 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
{"usage":{"total_tokens":1481,"input_tokens":8,"output_tokens":1473, "output_tokens_details":{"image_tokens":1120,"text_tokens":353}}}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 totalsBilled cost of a real DeepSeek V4 Pro chat completion
{"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}}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 totalsQA observations from the DeepSeek legs:
Type
🐛 Bug Fix
Caveats (if any)
output_cost_per_image_tokenexists in the schema, so Gemini batch image pricing stays inexpressible (pre-existing gap)tests/test_litellm/test_utils.pygemini-3.1-flash-lite-image,gemini-3.5-live-translate-preview,gemini-omni-flashstill missingamazon.nova-reel-v1:0/v1:1andamazon.nova-sonic-v1:0Final Attestation
Link to Devin session: https://app.devin.ai/sessions/9d0d242e58ed4a5b8fc2f892bf2713e9