litellm/tests/unit/llms/deepseek/messages
norkelbyte 5fd9cc8949
fix(deepseek): forward output_config.effort and thinking as sent on /v1/messages (#51317)
* fix(deepseek): forward output_config.effort and thinking as sent on /v1/messages

* fix(deepseek): validate effort and map reasoning_effort on /v1/messages

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

* fix(deepseek): keep the effort drop for non-reasoning models and reject 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

* fix(deepseek): keep base effort handling for models listed without reasoning 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.

* test(deepseek): cover reasoning_effort added beside other output_config fields

* fix(deepseek): fall back to reasoning_effort when dropping a bad effort and let reasoning_effort none clear thinking

* fix(deepseek): count only catalog-listed models as listed without reasoning

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

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-24 01:36:57 +00:00
..
__init__.py
test_deepseek_anthropic_messages_transformation.py fix(deepseek): forward output_config.effort and thinking as sent on /v1/messages (#51317) 2026-11-24 01:36:57 +00:00