Skip to content

fix(sdk): preserve DeepSeek V4 reasoning controls - #5194

Draft
XIAX66 wants to merge 1 commit into
OpenHands:mainfrom
XIAX66:fix/deepseek-v4-capabilities-5181
Draft

XIAX66 wants to merge 1 commit into
OpenHands:mainfrom
XIAX66:fix/deepseek-v4-capabilities-5181

Conversation

@XIAX66

@XIAX66 XIAX66 commented Sep 20, 2026

Copy link
Copy Markdown

HUMAN:


AGENT:

Why

DeepSeek V4 aliases routed through openhands/ or litellm_proxy/ lose reasoning_effort when proxy metadata is unavailable. Proxy metadata can also advertise a 384K maximum that the SDK then sends as the default output cap, excluding lower-limit providers. Explicit capability overrides on openai/... routes are also filtered by LiteLLM before reaching the wire.

Summary

  • Resolve the three known bare DeepSeek V4 aliases through LiteLLM's native deepseek/ capability metadata.
  • Default proxied DeepSeek V4 output limits to 16,384 unless the user explicitly configures a value.
  • Preserve explicit OpenAI-compatible reasoning overrides with allowed_openai_params, and log explicit reasoning settings that cannot be forwarded.

Issue Number

Fixes #5181

How to Test

Setup and static checks:

make build
uv run pre-commit run --files   openhands-sdk/openhands/sdk/llm/llm.py   openhands-sdk/openhands/sdk/llm/options/chat_options.py   openhands-sdk/openhands/sdk/llm/utils/model_features.py   tests/sdk/llm/test_model_features.py   tests/sdk/llm/test_chat_options.py   tests/sdk/llm/test_llm.py

All hooks passed, including Ruff, pycodestyle, Pyright, import boundaries, and tool registration.

Focused tests:

uv run pytest tests/sdk/llm/test_model_features.py   tests/sdk/llm/test_chat_options.py   tests/sdk/llm/test_llm.py -q

Result: 317 passed, 1 warning.

I also ran the issue's fake OpenAI-compatible HTTP server repro with reasoning_effort=low. The captured request bodies were:

openhands/deepseek-v4-flash                    effort=low  cap=16384
openhands/deepseek-v4.1-flash                  effort=low  cap=16384
litellm_proxy/deepseek-v4.1-flash              effort=low  cap=16384
openai/.../deepseek-v4.1-flash, no override    effort=None cap=None
openai/.../deepseek-v4.1-flash, override=true  effort=low  cap=None

A full uv run pytest was also attempted. It reached the Agent Server suite, where ten unchanged WebSocket tests failed because this macOS environment routes localhost WebSockets through a SOCKS proxy without the optional python-socks package. The focused LLM suite and all pre-commit checks pass.

Video/Screenshots

Not applicable; this is SDK request-routing behavior validated by captured HTTP request bodies.

Design Doc

Not applicable; the change extends the existing model-feature and output-cap paths.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

LiteLLM currently collapses native DeepSeek low/max reasoning levels to a boolean thinking switch. Upstream fixes are open in BerriAI/litellm#40717 and BerriAI/litellm#38736. This PR keeps that provider translation in LiteLLM, as scoped by #5181.

Resolve bare OpenHands and LiteLLM proxy aliases through DeepSeek capability metadata, use a safe default output cap, and allow explicit reasoning overrides through OpenAI-compatible routes.

Co-authored-by: openhands <openhands@all-hands.dev>
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.

[Bug]: DeepSeek V4.x reasoning_effort and output cap depend on proxy metadata (dropped without it, 384K default cap with it; openai/ ignores overrides)

1 participant