Skip to content

fix(deepseek): forward output_config.effort and thinking as sent on /v1/messages - #52196

Merged
mateo-berri merged 7 commits into
BerriAI:lts/1.108.xfrom
paveln83:litellm_backport_51317_lts_1_108_x
Nov 24, 2026
Merged

mateo-berri merged 7 commits into
BerriAI:lts/1.108.xfrom
paveln83:litellm_backport_51317_lts_1_108_x

Conversation

@paveln83

@paveln83 paveln83 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Handwritten 1-3 sentence description

This is the lts/1.108.x copy of #51317, which merges on main first. DeepSeek V4 requests on /v1/messages now reach DeepSeek with the effort and thinking settings the caller sent, instead of a thinking budget DeepSeek ignores, so max, low and none behave like a direct DeepSeek call

Details

TLDR

Problem this solves:

  • DeepSeek V4 on /v1/messages ignores the caller's effort, so Claude Code's --effort does nothing
  • Effort none still thinks, and ultra answers 400

How it solves it:

deepseek-chat and other models the cost map lists without reasoning keep today's handling

User Flow

Before: a developer on 1.108 using DeepSeek V4 through the proxy's Anthropic-format route gets DeepSeek's default effort whatever they ask for

  1. POST https://litellm-domain/v1/messages with "model": "deepseek-v4-pro" and "output_config": {"effort": "max"} bills 1764 input tokens, the same as none and minimal
  2. "effort": "none" or "reasoning_effort": "none" still opens the reply with a thinking block
  3. "effort": "ultra", which DeepSeek accepts, gets a 400 Unmapped reasoning effort: 'ultra'
  4. With drop_params: true, "effort": "bogus" still gets a 400

After: the same requests bill and answer like a direct DeepSeek call, while a level DeepSeek rejects stops at the gateway

  1. The same POST bills 1777 input tokens for max and 1685 for none and minimal, the same as DeepSeek direct
  2. The reply opens with a text block and no thinking
  3. "effort": "ultra" gets a 200
  4. With drop_params: true, "effort": "bogus" is dropped and the call answers 200. Without it, the call gets a 400 listing DeepSeek's levels

Pre-Submission checklist

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

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<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
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

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

Both proxies ran the same config against the real DeepSeek API with 2 workers each, Before at the line's tip e1476b2 and After at this branch's tip 844919f

Case on deepseek-v4-pro Before After
effort max 1764, thinking 1777, thinking
effort none 1764, thinking 1685, text
effort minimal 1764, thinking 1685, thinking
adaptive thinking, effort max 1764, thinking 1777, thinking
effort ultra 400 1777, thinking
reasoning_effort max 1764, thinking 1777, thinking
reasoning_effort none 1764, thinking 1685, text
effort bogus 400 400 listing levels
effort bogus, drop_params 400 1764, thinking
deepseek-chat effort low 1686, text 1686, text

Each cell is the billed input tokens and the reply's first block. DeepSeek direct billed 1777 for max and 1685 for none and minimal, with the same first blocks as After

Setup, commands and raw output
model_list:
  - model_name: deepseek-v4-pro
    litellm_params:
      model: deepseek/deepseek-v4-pro
      api_key: os.environ/DEEPSEEK_API_KEY
  - model_name: deepseek-v4-flash
    litellm_params:
      model: deepseek/deepseek-v4-flash
      api_key: os.environ/DEEPSEEK_API_KEY
  - model_name: deepseek-v4-pro-drop
    litellm_params:
      model: deepseek/deepseek-v4-pro
      api_key: os.environ/DEEPSEEK_API_KEY
      drop_params: true
  - model_name: deepseek-chat
    litellm_params:
      model: deepseek/deepseek-chat
      api_key: os.environ/DEEPSEEK_API_KEY
  - model_name: deepseek-reasoner
    litellm_params:
      model: deepseek/deepseek-reasoner
      api_key: os.environ/DEEPSEEK_API_KEY
general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
# Before
LITELLM_LOCAL_MODEL_COST_MAP=True python -m litellm.proxy.proxy_cli --config config.yaml --port <port> --num_workers 2 --timeout_worker_healthcheck 60
# After, one proxy for this leg and the unlisted leg, with the deepseek-unlisted entry below added to this config
LITELLM_LOCAL_MODEL_COST_MAP=True LITELLM_LOG=DEBUG DATABASE_URL=<postgres url> python litellm/proxy/proxy_cli.py --config config.yaml --host 127.0.0.1 --port <port> --num_workers 2 --timeout_worker_healthcheck 60 --telemetry False --use_prisma_db_push
#!/bin/zsh
P=$1; LABEL=$2
MK=$LITELLM_MASTER_KEY
SYS=$(cat system.txt)
summ() { local b; b=$(cat); print -r -- "$b" | jq -ce 'if .usage then {billed_input:(.usage.input_tokens + (.usage.cache_read_input_tokens//0) + (.usage.cache_creation_input_tokens//0)), first_block:(.content[0].type)} else {type:.error.type, message:((.error.message // .) | tostring | .[0:150])} end' 2>/dev/null || print -r -- "${b[1,150]}" | tr '\n' ' '; }
proxy() { R=$(curl -s -w '\n%{http_code}' localhost:$P/v1/messages -H "Authorization: Bearer $MK" -H 'content-type: application/json' -d "$1"); print -r -- "$(print -r -- "$R" | tail -1) $(print -r -- "$R" | sed '$d' | summ)"; }
body() { jq -cn --arg sys "$SYS" --arg m "$1" --argjson extra "$2" '{model:$m,max_tokens:16,system:$sys,messages:[{role:"user",content:"hi"}]} + $extra'; }
run() { print -r -- "$LABEL case=$1 $(proxy "$(body $2 "$3")")"; }
run "effort max" deepseek-v4-pro '{"output_config":{"effort":"max"}}'
run "effort none" deepseek-v4-pro '{"output_config":{"effort":"none"}}'
run "effort minimal" deepseek-v4-pro '{"output_config":{"effort":"minimal"}}'
run "thinking adaptive, effort max" deepseek-v4-pro '{"thinking":{"type":"adaptive"},"output_config":{"effort":"max"}}'
run "effort ultra" deepseek-v4-pro '{"output_config":{"effort":"ultra"}}'
run "reasoning_effort max" deepseek-v4-pro '{"reasoning_effort":"max"}'
run "reasoning_effort none" deepseek-v4-pro '{"reasoning_effort":"none"}'
run "effort bogus" deepseek-v4-pro '{"output_config":{"effort":"bogus"}}'
run "effort bogus, drop_params" deepseek-v4-pro-drop '{"output_config":{"effort":"bogus"}}'
run "deepseek-chat effort low" deepseek-chat '{"output_config":{"effort":"low"}}'
before case=effort max 200 {"billed_input":1764,"first_block":"thinking"}
before case=effort none 200 {"billed_input":1764,"first_block":"thinking"}
before case=effort minimal 200 {"billed_input":1764,"first_block":"thinking"}
before case=thinking adaptive, effort max 200 {"billed_input":1764,"first_block":"thinking"}
before case=effort ultra 400 {"type":"invalid_request_error","message":"litellm.BadRequestError: DeepseekException - litellm.BadRequestError: Unmapped reasoning effort: 'ultra'. Must be one of: 'minimal', 'low', 'medium', "}
before case=reasoning_effort max 200 {"billed_input":1764,"first_block":"thinking"}
before case=reasoning_effort none 200 {"billed_input":1764,"first_block":"thinking"}
before case=effort bogus 400 {"type":"invalid_request_error","message":"litellm.BadRequestError: DeepseekException - litellm.BadRequestError: Unmapped reasoning effort: 'bogus'. Must be one of: 'minimal', 'low', 'medium', "}
before case=effort bogus, drop_params 400 {"type":"invalid_request_error","message":"litellm.BadRequestError: DeepseekException - litellm.BadRequestError: Unmapped reasoning effort: 'bogus'. Must be one of: 'minimal', 'low', 'medium', "}
before case=deepseek-chat effort low 200 {"billed_input":1686,"first_block":"text"}
after case=effort max 200 {"billed_input":1777,"first_block":"thinking"}
after case=effort none 200 {"billed_input":1685,"first_block":"text"}
after case=effort minimal 200 {"billed_input":1685,"first_block":"thinking"}
after case=thinking adaptive, effort max 200 {"billed_input":1777,"first_block":"thinking"}
after case=effort ultra 200 {"billed_input":1777,"first_block":"thinking"}
after case=reasoning_effort max 200 {"billed_input":1777,"first_block":"thinking"}
after case=reasoning_effort none 200 {"billed_input":1685,"first_block":"text"}
after case=effort bogus 400 {"type":"invalid_request_error","message":"litellm.BadRequestError: DeepseekException - Invalid output_config.effort: 'bogus'. DeepSeek accepts one of: 'none', 'minimal', 'low', 'medium', 'high"}
after case=effort bogus, drop_params 200 {"billed_input":1764,"first_block":"thinking"}
after case=deepseek-chat effort low 200 {"billed_input":1686,"first_block":"text"}
direct effort minimal {"billed_input":1685,"first_block":"thinking"}
direct effort none {"billed_input":1685,"first_block":"text"}
direct effort max {"billed_input":1777,"first_block":"thinking"}

Unlisted model on a proxy deployment (before e1476b2, after 844919f)

A deployment of a model the cost map does not list now sends the caller's thinking, effort and temperature to DeepSeek. DeepSeek answers 400 for the made-up name on both sides, so the leg reads the request body from the proxy's debug log

Deployment Before sent After sent
deepseek-unlisted temperature only thinking, effort max, temperature
deepseek-v4-pro thinking budget 4095 effort max
deepseek-chat no effort no effort
Unlisted model leg
# Before
LITELLM_LOCAL_MODEL_COST_MAP=True python -m litellm.proxy.proxy_cli --config config.yaml --port <port> --detailed_debug
# After, the same proxy as the table above
LITELLM_LOCAL_MODEL_COST_MAP=True LITELLM_LOG=DEBUG DATABASE_URL=<postgres url> python litellm/proxy/proxy_cli.py --config config.yaml --host 127.0.0.1 --port <port> --num_workers 2 --timeout_worker_healthcheck 60 --telemetry False --use_prisma_db_push
model_list:
  - model_name: deepseek-v4-pro
    litellm_params:
      model: deepseek/deepseek-v4-pro
      api_key: os.environ/DEEPSEEK_API_KEY
  - model_name: deepseek-chat
    litellm_params:
      model: deepseek/deepseek-chat
      api_key: os.environ/DEEPSEEK_API_KEY
  - model_name: deepseek-unlisted
    litellm_params:
      model: deepseek/deepseek-v99-unlisted
      api_key: os.environ/DEEPSEEK_API_KEY
general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
#!/bin/zsh
port=$1 label=$2
U=http://localhost:$port/v1/messages
H=(-H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'content-type: application/json')
for c in \
  "deepseek-unlisted|{\"model\":\"deepseek-unlisted\",\"max_tokens\":4096,\"thinking\":{\"type\":\"adaptive\"},\"output_config\":{\"effort\":\"max\"},\"temperature\":0,\"messages\":[{\"role\":\"user\",\"content\":\"What is 12*12+4?\"}]}" \
  "deepseek-v4-pro|{\"model\":\"deepseek-v4-pro\",\"max_tokens\":4096,\"output_config\":{\"effort\":\"max\"},\"messages\":[{\"role\":\"user\",\"content\":\"What is 12*12+4?\"}]}" \
  "deepseek-chat|{\"model\":\"deepseek-chat\",\"max_tokens\":4096,\"output_config\":{\"effort\":\"low\"},\"messages\":[{\"role\":\"user\",\"content\":\"What is 12*12+4?\"}]}"
do
  name=${c%%|*} body=${c#*|}
  out=$(curl -sS -w '\n%{http_code}' $U $H -d $body)
  code=${out##*$'\n'} json=${out%$'\n'*}
  print -r -- "$label $name status=$code $(print -r -- $json | python3 -c 'import json,sys
d=json.load(sys.stdin)
e=d.get("error")
if e: print("error:", str(e.get("message"))[:110])
else: print("blocks=" + ",".join(b.get("type") for b in d.get("content",[])), "output_tokens=%s" % d.get("usage",{}).get("output_tokens"))')"
done
before deepseek-unlisted status=400 error: litellm.BadRequestError: DeepseekException - {"type":"error","error":{"type":"invalid_request_error","message"
before deepseek-v4-pro status=200 blocks=thinking,text output_tokens=34
before deepseek-chat status=200 blocks=text output_tokens=22
after deepseek-unlisted status=400 error: litellm.BadRequestError: DeepseekException - {"type":"error","error":{"type":"invalid_request_error","message"
after deepseek-v4-pro status=200 blocks=thinking,text output_tokens=27
after deepseek-chat status=200 blocks=text output_tokens=53
before sent {'model': 'deepseek-v99-unlisted', 'temperature': 0}
before sent {'model': 'deepseek-v4-pro', 'thinking': {'type': 'enabled', 'budget_tokens': 4095}}
before sent {'model': 'deepseek-chat'}
after sent {'model': 'deepseek-v99-unlisted', 'thinking': {'type': 'adaptive'}, 'output_config': {'effort': 'max'}, 'temperature': 0}
after sent {'model': 'deepseek-v4-pro', 'output_config': {'effort': 'max'}}
after sent {'model': 'deepseek-chat'}
Claude Code on this line

claude --model deepseek-v4-pro --effort low asked the same math question through each proxy, Before at e1476b2 and After at 844919f. Both answered, Before thinking for 8s with 648 output tokens and After for 13s with 769. DeepSeek's thinking length varies run to run, so the billed-input rows above are the steadier signal, and #51317 has the longer Claude Code comparison

Before

pr51317-58d88dc8a7-cc_lts_before_cost.png

After

pr52196-844919ff6e-cc_lts_after_cost.png

Picks

Main commit LTS commit Notes
df53f7a 938a161 import block adapted
72101af 9945c25 import block adapted
c19bc4a 9dca950 import block adapted
b290be0 aaea680 catalog lookup adapted
53f8382 a62d824 clean
e7260d5 d4b82c3 clean
b9101fa 844919f helper and tests adapted

The line imports the Anthropic messages base config from its pass-through path and keeps its own URL building and tool cleanup, so picks 1 to 3 keep those. The line has no lookup_catalog_model_info, so pick 4 uses lookup_model_info_for_registration. The line also has no shared is_known_non_reasoning_model, so pick 7 defines it in the DeepSeek module on the same lookup and the cost map as loaded. Its two new tests use local_model_cost_map, since a Router registration would otherwise leak into later tests on this line

tests/unit/llms/deepseek passes with 80 tests at the line's tip and 110 at this branch's tip. The DeepSeek and Anthropic messages tests (546) and the utils tests for DeepSeek, reasoning and messages (30) pass too. The new Router test fails on the pick before the fix

/gauntlet-mini's first run found that a proxy deployment of an unlisted model counted as listed without reasoning. Main had the same bug, so b9101fa fixed it there and it is picked here. A scoped second run held after one test-isolation fix

No dependency bumps

Type

🐛 Bug Fix

Caveats (if any)

Low

  • DeepSeek's effort levels are a fixed list in the config
    • A level DeepSeek adds later gets a 400 until a release adds it (decision 1)
    • The chat completions config keeps its own list, since it handles none separately
  • On this line LITELLM_RUST=1 sends DeepSeek messages through the Rust config, which still reshapes effort (decision 8)
  • deepseek-chat still ignores effort and adaptive thinking, on purpose (decision 9)
  • Two deployments of one unlisted model share its cost-map entry
    • supports_reasoning: false on one applies to both
  • make check fails on the line's own ruff import-order error in litellm/main.py, the same at the line's tip
  • osv-scan (not required) flags the line's lockfiles, like fix(openai): forward Responses background_options (lts/1.108.x) #53993's run, and this PR changes none
Decisions
  1. Forward a valid effort as sent instead of mapping it to a budget, since DeepSeek reads the level itself and its docs say budget_tokens is ignored. LiteLLM still checks the level against DeepSeek's list (none, minimal, low, medium, high, xhigh, ultra, max, from DeepSeek's own 422 text). An unknown level gets a 400 naming that list, or is dropped under drop_params, which is the convention for a malformed param. The other option was letting DeepSeek answer, but the gateway relays that as a 422 labeled api_error and drop_params could not drop it. The cost is a level list to update when DeepSeek adds one. The check runs only for the models in 9 that get effort as sent
  2. Override on the DeepSeek config instead of cost-map flags. Setting supports_output_config on each DeepSeek entry would keep effort-only requests, but it would still strip thinking: adaptive (which DeepSeek accepts) and send adaptive requests at a level like ultra back through the budget mapping. The override instead keys off the supports_reasoning flag that every DeepSeek reasoning entry already carries (see 9)
  3. thinking passes through unchanged, adaptive included, because a direct call showed DeepSeek accepts {"type": "adaptive"} with or without effort
  4. temperature is kept for the models in 9 that get effort as sent. Anthropic rejects it under thinking, while DeepSeek accepts any value and ignores it only while thinking. Without this, none plus a temperature would lose the temperature DeepSeek honors once thinking is off
  5. The reasoning_effort alias on /v1/messages becomes output_config.effort, so it reaches DeepSeek like the native field. When both are sent the caller's output_config.effort wins, the same order the Anthropic config uses. The alias adds no thinking block, since DeepSeek turns thinking on or off from the level, and an alias of none removes a thinking block the caller sent, since the Anthropic config's rule is that none clears both. A native output_config.effort of none sent beside a thinking block goes as sent, since the caller set both. The other option was keeping the old budget mapping, which DeepSeek ignores. Models that keep the base handling in 9 still get the alias mapped to a thinking budget, as before
  6. When drop_params drops an unknown output_config.effort, a valid reasoning_effort takes its place. With none, only effort leaves output_config. Other keys stay, and an output_config left empty is removed
  7. No existing PR was built on, since the earlier DeepSeek effort PRs (fix(deepseek): preserve native reasoning effort for V4 models #42257, fix(deepseek): forward graded reasoning_effort instead of discarding it #40717, fix(deepseek): pass reasoning_effort value through to DeepSeek V4 #27445, all closed now) only changed the chat completions path
  8. The Rust copy of the DeepSeek messages config still reshapes effort the Claude way. On this line the proxy serves DeepSeek /v1/messages on Python unless an operator sets LITELLM_RUST=1, which opts it into the Rust copy. Changing the Rust copy is its own change, made on main first
  9. Only DeepSeek models the cost map marks supports_reasoning (V4 Pro and Flash, deepseek-reasoner, R1, V3.2) and models it does not list yet get thinking, effort and temperature as sent. deepseek-chat, deepseek-coder and deepseek-v3 keep the base handling unchanged, so a client like Claude Code that sends thinking: adaptive on every request does not start paying for thinking tokens on those models after an upgrade, and reasoning_effort still turns thinking on there. A model the cost map does not list yet gets the reasoning handling, since every DeepSeek model released since V3.2 reasons and the repo's rule is that an unlisted model gets the provider's current behavior. The check reads the cost map as loaded, so a proxy deployment of an unlisted model still counts as unlisted, and an operator keeps the base handling with model_info.supports_reasoning: false. The other options, forwarding for every model or marking deepseek-chat as reasoning, change billing or the chat completions path, so either can follow in its own PR
  10. A string reasoning_effort is checked against DeepSeek's levels even when output_config.effort is also set, so a bad alias still gets the 400 it got before this PR, or is dropped under drop_params. An output_config that is not an object goes to DeepSeek unchanged, which rejects it with a 422 as before, instead of being replaced by the alias. The 400 names the field that held the bad level, output_config.effort or reasoning_effort

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
Bugbot summary

[!NOTE]
Medium Risk
Changes outbound request shape for DeepSeek messages routing, which directly affects reasoning effort, thinking blocks, and billing; behavior is gated by model metadata but is on a hot API path.

Overview
DeepSeek’s Anthropic-compatible /v1/messages path no longer rewrites effort into Claude-style thinking budgets for reasoning models (and models not in the cost map). Those requests now pass thinking, output_config.effort, and temperature through largely as the client sent them, including levels like ultra and max.

reasoning_effort is normalized into output_config.effort (with precedence rules, none clearing thinking when the alias drives effort). Invalid effort values return 400 with DeepSeek’s allowed levels, or are stripped when drop_params is on.

deepseek-chat and other cost-map models marked non-reasoning still use the base Anthropic reshaping (adaptive thinking / temperature drops). Unit tests cover forwarding, aliases, drop-params, and per-model branches.

Reviewed by Cursor Bugbot for commit 844919f. Bugbot is set up for automated code reviews on this repo. Configure here.

An effort level DeepSeek does not accept now gets a 400 that lists the accepted levels, or is dropped under drop_params, instead of reaching DeepSeek and coming back as a 422 labeled api_error. The reasoning_effort alias is sent as output_config.effort, and the caller's output_config.effort wins when both are set. The tests carry their types and Final annotations

(cherry picked from commit 72101af)
…ct bad aliases on /v1/messages

Only DeepSeek models the cost map marks supports_reasoning get thinking and output_config.effort as sent. deepseek-chat, coder and v3 keep the base drop, so clients that send adaptive thinking on every request do not start billing thinking tokens there. A string reasoning_effort is checked against DeepSeek's levels even next to output_config.effort, and a non-object output_config is forwarded unchanged instead of being replaced

(cherry picked from commit c19bc4a)
…asoning on /v1/messages

Models the cost map lists without reasoning, such as deepseek-chat, keep the
base reasoning_effort budget mapping, effort drop, and temperature drop.
Models the cost map does not list yet get the forwarding path, like the
current DeepSeek reasoning models.

(cherry picked from commit b290be0)
…rt and let reasoning_effort none clear thinking

(cherry picked from commit e7260d5)
…soning

A proxy deployment registers an unlisted model into the cost map, so the old check stripped thinking, effort and temperature from it. Check the cost map as loaded instead

Adapted for lts/1.108.x: the line has no shared is_known_non_reasoning_model, so this module defines it on lookup_model_info_for_registration and the loaded catalog, and the new tests use local_model_cost_map since the line's conftest restores model_cost by reference

(cherry picked from commit b9101fa)
@paveln83
paveln83 requested a review from a team November 17, 2026 02:53
@veria-ai

veria-ai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

@codecov

codecov Bot commented Nov 17, 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

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with no new actionable findings

Summary

DeepSeek reasoning models and unlisted models now keep the caller’s effort, thinking, and temperature on /v1/messages

  • DeepSeek messages now keep the caller’s reasoning settings.

The latest live proof addresses the previous finding. The description supplied by paveln83 identifies the fixed effort list, unchanged opt-in Rust path, unchanged non-reasoning behavior, and shared capability flags for same-model deployments as known limits

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["DeepSeek Messages request"] --> B{"Known non-reasoning model?"}
  B -->|Yes| C["Keep existing Anthropic handling"]
  B -->|No| D["Check effort and resolve alias"]
  D --> E{"Invalid effort?"}
  E -->|No| F["Forward effort, thinking, and temperature"]
  E -->|Yes| G{"drop_params enabled?"}
  G -->|Yes| H["Remove invalid effort"]
  H --> F
  G -->|No| I["Return 400"]
Loading

Reviews (5) · Last reviewed commit: "fix(deepseek): count only catalog-listed..." · Reviewed by Greptile

Comment on lines +67 to +71
def is_known_non_reasoning_model(model: str, custom_llm_provider: str) -> bool:
info: Final = lookup_model_info_for_registration(model, custom_llm_provider)
if isinstance(info, ModelInfoLookupMiss) or info.get("supports_reasoning") is True:
return False
return info.get("supports_reasoning") is False or info["key"] in GetModelCostMap.loaded_model_cost_map()

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.

P2 Live proof misses final changes

844919ff6e78a784990802531184601dcaaf1ce1 changes model selection, not just tests. The repository requires live proxy proof at the latest product commit. Rerun and record the checks there before merging

Rule Used: Apply this rule only to PRs that fix LLM translation bugs or add LLM translation features. LLM translation means converting requests, responses, streaming events, tool calls, and errors between the API a caller uses on LiteLLM (any endpoint or SDK fu... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

58d88dc8a7, where the live proof ran, already has this model selection change. 844919f only adds two test lines, so the product code matches

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.

Thanks—the live evidence does cover the unlisted-model behavior, so I overstated that part of my comment. However, 844919f is not test-only in this PR: it changes litellm/llms/deepseek/messages/transformation.py, including the model-selection helper, and is the latest product commit. The reported run at 58d88dc8a7 is from the source PR; under the required QA bar, proof from another PR does not satisfy proof at this PR’s latest product commit. I’m therefore keeping the request, narrowed to a live run on 844919f or a later commit.

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.

Reran every After leg live at 844919f on 2 workers. All ten cases and the unlisted leg match the earlier results, proof updated

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.

The body's After legs, unlisted-model leg included, now ran live at 844919f, this PR's latest product commit, so the narrowed request is met

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

1 similar comment
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@surlymochan surlymochan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I reviewed this as a non-maintainer (verification only, no approval). I read the full diff and the new tests against the current HEAD.

Verified:

  • The effort-forwarding matrix matches the tests: output_config.effort is forwarded as sent and wins over reasoning_effort; an unknown effort raises a 400 AnthropicError naming the field and the accepted levels, unless drop_params is set, in which case the unknown effort is dropped while other output_config fields (e.g. format) are kept.
  • For models without reasoning, the base-class adaptive-effort/temperature handling still applies, and a model missing from the cost map is treated as a reasoning model (effort forwarded as sent), both covered by tests.
  • reasoning_effort: none clears thinking, while output_config.effort: none keeps an explicit thinking block — the distinction is tested.

One question:

  • DEEPSEEK_EFFORT_LEVELS includes "ultra" and "max" alongside the familiar none/minimal/low/medium/high/xhigh. Are ultra/max levels DeepSeek actually accepts on /v1/messages? If they are not, forwarding them just passes the API rejection through to the caller, so it would be good to confirm the level set against the DeepSeek docs (or note the source in a comment).

@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 844919f. Configure here.

@mateo-berri

Copy link
Copy Markdown
Contributor

@surlymochan Yes. DeepSeek's own 422 for an unknown effort lists exactly these eight levels, and the live runs show ultra and max answering 200

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

1 similar comment
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@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

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.

3 participants