Skip to content

fix(models): key Azure DeepSeek V4 Flash 0731 by its Foundry catalog id - #39341

Merged
mateo-berri merged 3 commits into
litellm_internal_stagingfrom
litellm_azure_deepseek_v4_flash_0731
Sep 2, 2026
Merged

fix(models): key Azure DeepSeek V4 Flash 0731 by its Foundry catalog id#39341
mateo-berri merged 3 commits into
litellm_internal_stagingfrom
litellm_azure_deepseek_v4_flash_0731

Conversation

@yujonglee-berri

@yujonglee-berri yujonglee-berri commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

How it solves it:

  • Renames the entry to azure_ai/DeepSeek-V4-Flash-0731, the casing the rest of the azure_ai catalog uses (Phi, Llama, MAI, Cohere, FW-*)
  • Keeps every value from the base: Azure's "V4 Flash 0731 glbl" meters, the 1M/128K limits, the retirement date, and the capability flags

User Flow

Before: a developer routing azure_ai/DeepSeek-V4-Flash-0731 through the proxy is billed correctly but never sees the model's retirement date

  1. The proxy admin adds a deployment with model: azure_ai/DeepSeek-V4-Flash-0731, their Azure AI Foundry endpoint and key, and restarts the proxy
  2. The developer sends POST https://litellm-domain/v1/chat/completions with "model": "DeepSeek-V4-Flash-0731" and a one-line prompt, and gets 200 OK with 10 prompt tokens and 2 completion tokens
  3. The response carries x-litellm-response-cost: 7.04e-06, Azure's 0731 rate, found through the case-insensitive registry lookup
  4. GET https://litellm-domain/model/info reports the entry under key: azure_ai/deepseek-v4-flash-0731, an id that appears nowhere in the admin's config
  5. GET https://litellm-domain/model/deprecations lists nothing, although Azure retires the model on 2026-12-03

After: the same requests cost the same and the retirement date shows up

  1. The proxy admin adds a deployment with model: azure_ai/DeepSeek-V4-Flash-0731, their Azure AI Foundry endpoint and key, and restarts the proxy
  2. The developer sends POST https://litellm-domain/v1/chat/completions with "model": "DeepSeek-V4-Flash-0731" and a one-line prompt, and gets 200 OK with 10 prompt tokens and 2 completion tokens
  3. The response carries x-litellm-response-cost: 7.04e-06, unchanged
  4. GET https://litellm-domain/model/info reports the entry under key: azure_ai/DeepSeek-V4-Flash-0731, the id in the admin's config
  5. GET https://litellm-domain/model/deprecations lists the deployment under upcoming with deprecation_date: 2026-12-03

Relevant issues

Extracted from #38976 (closed). Follows #39023, which added the lowercase entry, and #39170, which priced it from Azure's 0731 meters; this PR only moves the entry to the catalog id

Linear ticket

Part of LIT-6555 (its Kimi-K3 half still needs its own PR)

Pre-Submission checklist

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

  • I have added meaningful tests (registry-only change; CI's model map schema check validates it, and the proof below is the live check)
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • 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 (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

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 for both legs: a DeepSeek-V4-Flash-0731 deployment (GlobalStandard, version 2026-07-31) on an Azure AI Foundry resource in eastus, real Azure calls. Each leg is its own worktree and venv, booted with LITELLM_LOCAL_MODEL_COST_MAP=True python litellm/proxy/proxy_cli.py --config config.yaml --port <port> --num_workers 2, two uvicorn workers, no database, same config:

model_list:
  - model_name: DeepSeek-V4-Flash-0731
    litellm_params:
      model: azure_ai/DeepSeek-V4-Flash-0731
      api_base: https://<resource>.services.ai.azure.com
      api_key: os.environ/AZURE_AI_API_KEY
general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY

Cost arithmetic on both legs: 10 prompt tokens x 4.4e-07 + 2 completion tokens x 1.32e-06 = 7.04e-06. The base already carries the 0731 meters through #39170, so this PR changes the key the values live under, not the values

Before (4049a07)

model info

  1. Run (proxy on port 24024):
    curl -s http://127.0.0.1:24024/model/info -H "Authorization: Bearer $LITELLM_MASTER_KEY" | jq '.data[0].model_info | {key, input_cost_per_token, output_cost_per_token, cache_read_input_token_cost, max_input_tokens, max_output_tokens, supports_function_calling, supports_tool_choice, supports_reasoning, supports_prompt_caching, deprecation_date}'
  2. Observed:
    {
      "key": "azure_ai/deepseek-v4-flash-0731",
      "input_cost_per_token": 4.4E-7,
      "output_cost_per_token": 0.00000132,
      "cache_read_input_token_cost": 1.4E-8,
      "max_input_tokens": 1000000,
      "max_output_tokens": 128000,
      "supports_function_calling": true,
      "supports_tool_choice": true,
      "supports_reasoning": true,
      "supports_prompt_caching": true,
      "deprecation_date": null
    }
    

model deprecations

  1. Run (proxy on port 24024):
    curl -s http://127.0.0.1:24024/model/deprecations -H "Authorization: Bearer $LITELLM_MASTER_KEY" | jq -c '{deprecated, imminent, upcoming}'
  2. Observed:
    {"deprecated":[],"imminent":[],"upcoming":[]}
    

chat completions cost

  1. Run (proxy on port 24024):
    curl -s -D /dev/stderr http://127.0.0.1:24024/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"DeepSeek-V4-Flash-0731","messages":[{"role":"user","content":"Reply with exactly the word OK"}],"max_tokens":20}' 2> >(grep -i x-litellm-response-cost) | jq '{content: .choices[0].message.content, usage}'
  2. Observed:
    {
      "content": "OK",
      "usage": {
        "completion_tokens": 2,
        "prompt_tokens": 10,
        "total_tokens": 12,
        "audio_prompt_tokens": 0
      }
    }
    x-litellm-response-cost: 7.04e-06
    x-litellm-response-cost-original: 7.04e-06
    x-litellm-response-cost-discount-amount: 0.0
    x-litellm-response-cost-margin-amount: 0.0
    x-litellm-response-cost-margin-percent: 0.0
    x-litellm-response-cost-input: 4.4e-06
    x-litellm-response-cost-output: 2.64e-06
    x-litellm-response-cost-tool-usage: 0.0
    

responses API cost

  1. Run (proxy on port 24024):
    curl -s -D /dev/stderr http://127.0.0.1:24024/v1/responses -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"DeepSeek-V4-Flash-0731","input":"Reply with exactly the word OK","max_output_tokens":20}' 2> >(grep -i x-litellm-response-cost) | jq '{text: .output[-1].content[0].text, usage}'
  2. Observed:
    {
      "text": "OK",
      "usage": {
        "input_tokens": 10,
        "input_tokens_details": null,
        "output_tokens": 2,
        "output_tokens_details": null,
        "total_tokens": 12,
        "cost": null
      }
    }
    x-litellm-response-cost: 7.04e-06
    x-litellm-response-cost-original: 7.04e-06
    x-litellm-response-cost-discount-amount: 0.0
    x-litellm-response-cost-margin-amount: 0.0
    x-litellm-response-cost-margin-percent: 0.0
    x-litellm-response-cost-input: 4.4e-06
    x-litellm-response-cost-output: 2.64e-06
    x-litellm-response-cost-tool-usage: 0.0
    

messages API cost

  1. Run (proxy on port 24024):
    curl -s -D /dev/stderr http://127.0.0.1:24024/v1/messages -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"DeepSeek-V4-Flash-0731","max_tokens":20,"messages":[{"role":"user","content":"Reply with exactly the word OK"}]}' 2> >(grep -i x-litellm-response-cost) | jq '{text: .content[0].text, usage}'
  2. Observed:
    {
      "text": "OK",
      "usage": {
        "input_tokens": 10,
        "output_tokens": 2
      }
    }
    x-litellm-response-cost-original: 7.04e-06
    x-litellm-response-cost-discount-amount: 0.0
    x-litellm-response-cost-margin-amount: 0.0
    x-litellm-response-cost-margin-percent: 0.0
    x-litellm-response-cost-input: 4.4e-06
    x-litellm-response-cost-output: 2.64e-06
    x-litellm-response-cost-tool-usage: 0.0
    

tool calling

  1. Run (proxy on port 24024):
    curl -s http://127.0.0.1:24024/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"DeepSeek-V4-Flash-0731","messages":[{"role":"user","content":"What is the weather in Paris right now?"}],"tools":[{"type":"function","function":{"name":"get_weather","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"tool_choice":"required"}' | jq '.choices[0].message.tool_calls'
  2. Observed:
    [
      {
        "index": 0,
        "function": {
          "arguments": "{\"city\": \"Paris\"}",
          "name": "get_weather"
        },
        "id": "call_8dcd8c56c6944c499c0a5992",
        "type": "function"
      }
    ]
    

After (f38a1ec)

model info

  1. Run (proxy on port 32332):
    curl -s http://127.0.0.1:32332/model/info -H "Authorization: Bearer $LITELLM_MASTER_KEY" | jq '.data[0].model_info | {key, input_cost_per_token, output_cost_per_token, cache_read_input_token_cost, max_input_tokens, max_output_tokens, supports_function_calling, supports_tool_choice, supports_reasoning, supports_prompt_caching, deprecation_date}'
  2. Observed:
    {
      "key": "azure_ai/DeepSeek-V4-Flash-0731",
      "input_cost_per_token": 4.4E-7,
      "output_cost_per_token": 0.00000132,
      "cache_read_input_token_cost": 1.4E-8,
      "max_input_tokens": 1000000,
      "max_output_tokens": 128000,
      "supports_function_calling": true,
      "supports_tool_choice": true,
      "supports_reasoning": true,
      "supports_prompt_caching": true,
      "deprecation_date": null
    }
    

model deprecations

  1. Run (proxy on port 32332):
    curl -s http://127.0.0.1:32332/model/deprecations -H "Authorization: Bearer $LITELLM_MASTER_KEY" | jq -c '{deprecated, imminent, upcoming}'
  2. Observed:
    {"deprecated":[],"imminent":[],"upcoming":[{"model_name":"DeepSeek-V4-Flash-0731","litellm_model":"azure_ai/DeepSeek-V4-Flash-0731","deprecation_date":"2026-12-03","days_until_deprecation":92,"status":"upcoming","litellm_provider":"azure_ai"}]}
    

chat completions cost

  1. Run (proxy on port 32332):
    curl -s -D /dev/stderr http://127.0.0.1:32332/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"DeepSeek-V4-Flash-0731","messages":[{"role":"user","content":"Reply with exactly the word OK"}],"max_tokens":20}' 2> >(grep -i x-litellm-response-cost) | jq '{content: .choices[0].message.content, usage}'
  2. Observed:
    {
      "content": "OK",
      "usage": {
        "completion_tokens": 2,
        "prompt_tokens": 10,
        "total_tokens": 12,
        "audio_prompt_tokens": 0
      }
    }
    x-litellm-response-cost: 7.04e-06
    x-litellm-response-cost-original: 7.04e-06
    x-litellm-response-cost-discount-amount: 0.0
    x-litellm-response-cost-margin-amount: 0.0
    x-litellm-response-cost-margin-percent: 0.0
    x-litellm-response-cost-input: 4.4e-06
    x-litellm-response-cost-output: 2.64e-06
    x-litellm-response-cost-tool-usage: 0.0
    

responses API cost

  1. Run (proxy on port 32332):
    curl -s -D /dev/stderr http://127.0.0.1:32332/v1/responses -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"DeepSeek-V4-Flash-0731","input":"Reply with exactly the word OK","max_output_tokens":20}' 2> >(grep -i x-litellm-response-cost) | jq '{text: .output[-1].content[0].text, usage}'
  2. Observed:
    {
      "text": "OK",
      "usage": {
        "input_tokens": 10,
        "input_tokens_details": null,
        "output_tokens": 2,
        "output_tokens_details": null,
        "total_tokens": 12,
        "cost": null
      }
    }
    x-litellm-response-cost: 7.04e-06
    x-litellm-response-cost-original: 7.04e-06
    x-litellm-response-cost-discount-amount: 0.0
    x-litellm-response-cost-margin-amount: 0.0
    x-litellm-response-cost-margin-percent: 0.0
    x-litellm-response-cost-input: 4.4e-06
    x-litellm-response-cost-output: 2.64e-06
    x-litellm-response-cost-tool-usage: 0.0
    

messages API cost

  1. Run (proxy on port 32332):
    curl -s -D /dev/stderr http://127.0.0.1:32332/v1/messages -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"DeepSeek-V4-Flash-0731","max_tokens":20,"messages":[{"role":"user","content":"Reply with exactly the word OK"}]}' 2> >(grep -i x-litellm-response-cost) | jq '{text: .content[0].text, usage}'
  2. Observed:
    {
      "text": "OK",
      "usage": {
        "input_tokens": 10,
        "output_tokens": 2
      }
    }
    x-litellm-response-cost-original: 7.04e-06
    x-litellm-response-cost-discount-amount: 0.0
    x-litellm-response-cost-margin-amount: 0.0
    x-litellm-response-cost-margin-percent: 0.0
    x-litellm-response-cost-input: 4.4e-06
    x-litellm-response-cost-output: 2.64e-06
    x-litellm-response-cost-tool-usage: 0.0
    

tool calling

  1. Run (proxy on port 32332):
    curl -s http://127.0.0.1:32332/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"DeepSeek-V4-Flash-0731","messages":[{"role":"user","content":"What is the weather in Paris right now?"}],"tools":[{"type":"function","function":{"name":"get_weather","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"tool_choice":"required"}' | jq '.choices[0].message.tool_calls'
  2. Observed:
    [
      {
        "index": 0,
        "function": {
          "arguments": "{\"city\": \"Paris\"}",
          "name": "get_weather"
        },
        "id": "call_6f61e3cc2db348de9f5d3c8f",
        "type": "function"
      }
    ]
    

Observed on both legs, not caused by this PR: /v1/messages omits the bare x-litellm-response-cost header and only sends the -original, -input, and -output variants

Type

🐛 Bug Fix

Caveats (if any)

Low

  • The lowercase key (shipped only in v1.101.0-dev.1) goes away
    • get_model_info and cost tracking resolve either casing, so nothing billed changes for those callers
    • litellm.get_max_tokens("azure_ai/deepseek-v4-flash-0731") is an exact-key lookup and now raises; the catalog id resolves instead
  • The other azure_ai DeepSeek keys (deepseek-r1, deepseek-v3-0324, deepseek-v3.1, deepseek-v4-flash) stay lowercase; moving them to catalog ids is out of scope here

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

  • f38a1ec passes /live-pr-risk

@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR aligns the Azure DeepSeek V4 Flash 0731 registry key with its exact Foundry catalog identifier in both model-price registries.

  • Renames the primary registry key to azure_ai/DeepSeek-V4-Flash-0731.
  • Applies the identical key update to the packaged backup registry.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Renames the Azure DeepSeek V4 Flash 0731 entry to the case-sensitive Foundry catalog identifier while retaining its pricing, limits, capabilities, and retirement metadata.
litellm/model_prices_and_context_window_backup.json Mirrors the primary registry key change in the packaged backup model map.

Reviews (3): Last reviewed commit: "Merge branch 'litellm_internal_staging' ..." | Re-trigger Greptile

@codspeed-hq

codspeed-hq Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_azure_deepseek_v4_flash_0731 (f38a1ec) with litellm_internal_staging (b600f02)

Open in CodSpeed

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri mateo-berri changed the title feat(models): add Azure DeepSeek V4 Flash 0731 fix(models): price Azure DeepSeek V4 Flash 0731 from its own meters under the catalog id Sep 2, 2026
@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 a9d3a07. Configure here.

@mateo-berri mateo-berri changed the title fix(models): price Azure DeepSeek V4 Flash 0731 from its own meters under the catalog id fix(models): key Azure DeepSeek V4 Flash 0731 by its Foundry catalog id Sep 2, 2026
…/litellm into litellm_azure_deepseek_v4_flash_0731

# Conflicts:
#	litellm/model_prices_and_context_window_backup.json
#	model_prices_and_context_window.json
@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 f38a1ec. 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. Thanks!

@mateo-berri
mateo-berri merged commit ba2e5d2 into litellm_internal_staging Sep 2, 2026
80 of 81 checks passed
@mateo-berri
mateo-berri deleted the litellm_azure_deepseek_v4_flash_0731 branch September 2, 2026 18:52
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