Skip to content

[Bug]: output-cap defaults and explicit reasoning overrides are mishandled #5181

Open

Description

@simonrosenberg

Maintainer correction and scope clarification

The original report combines three behaviors, but its metadata diagnosis is not established for the normal authenticated managed-proxy path.

The synthetic reproduction intentionally returns an empty list from /v1/model/info. That proves fallback behavior when proxy metadata is unavailable; it does not prove that metadata is unavailable in production. An authenticated query to the managed proxy returns the deepseek-v4.1-flash alias, token limits, supports_reasoning: true, and litellm_params.allowed_openai_params: ["reasoning_effort"].

There is nevertheless a real metadata-contract gap: the SDK extracts only current["model_info"] from a /v1/model/info entry and discards litellm_params.allowed_openai_params. That general problem is tracked in #5499 and should be addressed before adding model-name-specific fallbacks.

This issue is therefore narrowed to two independently demonstrated SDK behaviors:

  1. The SDK must not convert an advertised maximum output size into the default max_completion_tokens sent on every request. Doing so can make lower-limit OpenRouter providers ineligible.
  2. When an explicit OpenHands capability override enables reasoning_effort, the SDK must translate that contract into the corresponding LiteLLM allowance so drop_params=True does not silently remove it.

A DeepSeek-specific hardcoded alias fallback is not an acceptance criterion here unless an authenticated production-like reproduction demonstrates that the general proxy metadata contract cannot represent or deliver the capability.

Revised acceptance criteria

  • An advertised max_output_tokens is treated as a limit, not automatically sent as the default requested completion size.
  • Explicit user configuration of max_output_tokens remains authoritative.
  • capability_overrides={"supports_reasoning_effort": True} causes reasoning_effort to reach a generic OpenAI-compatible request through the appropriate LiteLLM allowance.
  • Without the explicit override or authoritative capability metadata, unsupported or unknown routes do not receive reasoning_effort.
  • Tests cover both behaviors without depending on hardcoded DeepSeek alias names where a general mechanism is sufficient.
  • Any proposed alias-specific fallback includes an authenticated production-like reproduction and explains why consuming proxy-advertised parameter capabilities is insufficient.

Original report

Is there an existing issue for the same bug?

  • I have searched existing issues and this is not a duplicate.

Related:

Bug Description

The SDK derives reasoning_effort support and the default output cap for DeepSeek V4.x from proxy or LiteLLM metadata. The result depends on whether that metadata exists, and it is wrong either way:

  1. Without proxy metadata, reasoning_effort is dropped for openhands/deepseek-v4.1-flash and litellm_proxy/deepseek-v4.1-flash.
    • get_supported_openai_params returns nothing for bare DeepSeek ids, and LiteLLM 1.93 has no registry entry for deepseek-v4.1-flash, so support falls back to False.
    • deepseek-v4-flash and -v4-pro only work because LiteLLM's registry marks them supports_reasoning: true.
    • A proxy alias with model_info (like OpenHands' hosted proxy) masks the problem. It shows up on proxies without the alias, or when /v1/model/info fails. The fix proposed in SDK sends unsupported reasoning_effort to MiniMax M3 #4934 would expose it for v4-flash, v4-pro and v4.1-flash everywhere.
  2. With proxy metadata, the SDK sends max_completion_tokens equal to the model's advertised maximum (e.g. max_output_tokens: 384000) on every request.
    • On OpenRouter, that silently excludes endpoints with lower limits, so provider pins configured on the proxy stop working.
    • Example: an alias pinning provider.order: ["Baseten"] (limit 32,768) falls back to other providers.
  3. On openai/… routes, capability_overrides={"supports_reasoning_effort": True} has no effect. LiteLLM's default drop_params=True removes the parameter for OpenAI-compatible endpoints.

Expected Behavior

  • reasoning_effort is sent for DeepSeek V4.x on openhands/ and litellm_proxy/ routes without relying on proxy metadata or generic supports_reasoning.
  • The SDK does not send, by default, an output cap larger than the route can serve.
  • When capability_overrides enables reasoning_effort, the parameter reaches the request body (e.g. via allowed_openai_params).

Actual Behavior

Offline repro against a fake OpenAI-compatible server with no model metadata (script below), on main @ 28e8ed2 with LiteLLM 1.93.0:

$ uv run python repro_wire.py
openhands/deepseek-v4-flash                        overrides=None -> reasoning_effort on the wire: 'high'
openhands/deepseek-v4.1-flash                      overrides=None -> reasoning_effort on the wire: None
litellm_proxy/deepseek-v4.1-flash                  overrides=None -> reasoning_effort on the wire: None
openai/openrouter/deepseek/deepseek-v4.1-flash     overrides=None -> reasoning_effort on the wire: None
openai/openrouter/deepseek/deepseek-v4.1-flash     overrides={'supports_reasoning_effort': True} -> reasoning_effort on the wire: None

For (2), the probe went through a LiteLLM proxy to OpenRouter's deepseek/deepseek-v4.1-flash:

provider max_completion_tokens Result
order: ["Baseten"], no fallbacks not set served by Baseten
order: ["Baseten"], no fallbacks 384000 404 "No endpoints found"
order: [..., "Baseten"], with fallbacks 384000 served by another provider (Morph)

Steps to Reproduce

  1. Save the script below as repro_wire.py in a checkout of main.
  2. uv run python repro_wire.py
  3. For (2), send the requests in the table through any LiteLLM proxy that has an OpenRouter key.

Acceptance Criteria

  • openhands/deepseek-v4.1-flash and litellm_proxy/deepseek-v4.1-flash send reasoning_effort with no proxy metadata (the repro prints 'high').
  • deepseek-v4-flash and -v4-pro keep sending it without depending on generic supports_reasoning, so the fix composes with SDK sends unsupported reasoning_effort to MiniMax M3 #4934.
  • With metadata advertising max_output_tokens: 384000, the SDK does not send that value as a default cap, unless the user configured it.
  • openai/… plus capability_overrides={"supports_reasoning_effort": True} sends reasoning_effort. Behavior without the override is unchanged.
  • reasoning_effort is still not sent where support is unknown or negative (no regression of SDK sends unsupported reasoning_effort to MiniMax M3 #4934).
  • Unit tests cover the no-metadata, with-metadata and openai/-with-override cases.

Installation Method

uv (repository checkout)

SDK Version

1.49.2 (main @ 28e8ed2)

Version Confirmation

  • I have confirmed this bug exists on the LATEST version of OpenHands SDK

Python Version

3.12

Model Name (if applicable)

deepseek-v4.1-flash (openhands/, litellm_proxy/, openai/openrouter/…)

Operating System

MacOS

Logs and Error Messages

Nothing is logged; the parameter is silently absent. Calling LiteLLM directly with drop_params=False shows the drop on the openai/ route:

litellm.UnsupportedParamsError: openai does not support parameters: ['reasoning_effort'], for model=openrouter/deepseek/deepseek-v4.1-flash.
... If you want to use these params dynamically send allowed_openai_params=['reasoning_effort'] in your request.

Minimal Code Sample

import json
import threading
from http.server import BaseHTTPRequestHandler, HTTPServer

from openhands.sdk import LLM
from openhands.sdk.llm import Message, TextContent

bodies = []


class FakeOpenAICompatibleServer(BaseHTTPRequestHandler):
    def do_GET(self):  # /v1/model/info probe: no metadata
        self._send({"data": []})

    def do_POST(self):
        bodies.append(json.loads(self.rfile.read(int(self.headers["Content-Length"]))))
        self._send({"id": "x", "object": "chat.completion", "created": 1, "model": "m",
                    "choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
                    "usage": {"prompt_tokens": 1, "completion_tokens": 1, "total_tokens": 2}})

    def _send(self, payload):
        data = json.dumps(payload).encode()
        self.send_response(200)
        self.send_header("Content-Type", "application/json")
        self.send_header("Content-Length", str(len(data)))
        self.end_headers()
        self.wfile.write(data)

    def log_message(self, *args):
        pass


server = HTTPServer(("127.0.0.1", 0), FakeOpenAICompatibleServer)
threading.Thread(target=server.serve_forever, daemon=True).start()
cases = [
    ("openhands/deepseek-v4-flash", None),
    ("openhands/deepseek-v4.1-flash", None),
    ("litellm_proxy/deepseek-v4.1-flash", None),
    ("openai/openrouter/deepseek/deepseek-v4.1-flash", None),
    ("openai/openrouter/deepseek/deepseek-v4.1-flash", {"supports_reasoning_effort": True}),
]
for model, overrides in cases:
    llm = LLM(model=model, api_key="x", base_url=f"http://127.0.0.1:{server.server_port}/v1",
              reasoning_effort="high", capability_overrides=overrides or {}, usage_id=model + str(overrides))
    llm.completion([Message(role="user", content=[TextContent(text="hi")])])
    print(f"{model:50} overrides={overrides} -> reasoning_effort on the wire: {bodies[-1].get('reasoning_effort')!r}")

Screenshots and Additional Context

  • DeepSeek documents the parameter. reasoning_effort takes none/low/high/max, default high (docs). In pinned-provider probes (DeepSeek, DeepInfra), none gave 0 reasoning tokens, and leaving it unset behaved like high. So with the default high the loss is invisible, but any other level is silently ignored.
  • Workaround: litellm_proxy/openrouter/deepseek/deepseek-v4.1-flash resolves support and sends reasoning_effort. Set max_output_tokens explicitly to avoid the advertised 384,000 cap.
  • Out of scope: LiteLLM's native deepseek/ provider maps effort to thinking on/off, which is an upstream LiteLLM behavior.

Filed by an AI agent (Claude Code) on behalf of @simonrosenberg.

Activity

  1. added
    bug
    llm
    on Sep 18, 2026
  2. added
    ready-for-dev
    on Sep 18, 2026
  3. github-actions commented on Sep 18, 2026

    @github-actions
    Contributor

    ✅ ready-for-dev label applied

    This issue meets the readiness criteria and is ready for contribution.
    A contributor can now open a PR that links this issue (Fixes #<number>).

    This is an automated check — no AI was used to generate this comment.

  4. all-hands-bot commented on Sep 18, 2026

    @all-hands-bot
    Collaborator

    The following comments and acceptance criteria were added by the OpenHands AI agent.

    Triage

    Priority: high. deepseek-v4.1-flash is the managed default Cloud model (#4941), and reasoning_effort is silently dropped on the openhands/, litellm_proxy/, and openai/ routes — including the non-default levels (none, low, max) users explicitly configure. The silent drop misreports what was actually sent, and it also blocks #4934, which intends to remove the generic supports_reasoning fallback that is currently the only thing keeping deepseek-v4-flash / deepseek-v4-pro working on openhands/ routes.

    Scope: make reasoning_effort (and an output cap) reach the wire for the bare DeepSeek V4 ids (deepseek-v4-flash, deepseek-v4-pro, deepseek-v4.1-flash) on openhands/ and litellm_proxy/ routes by resolving their parameter support via the deepseek/ provider — not via generic supports_reasoning; honor capability_overrides={"supports_reasoning_effort": True} on openai/... routes that LiteLLM would otherwise drop; and log when a configured reasoning_effort cannot be sent.

    Non-goals:

    • Do not reintroduce generic supports_reasoning gating as the enabler for reasoning_effort (keeps SDK sends unsupported reasoning_effort to MiniMax M3 #4934 composable).
    • Do not build general bare-id resolution for arbitrary providers; limit it to the DeepSeek V4 ids named above.
    • Native deepseek/ provider translation of reasoning_effort into thinking is upstream LiteLLM; the SDK may either forward the level or document/link the upstream limitation, not reimplement LiteLLM's provider config.

    Acceptance criteria

    • openhands/deepseek-v4.1-flash sends reasoning_effort when configured, with no proxy /v1/model/info metadata available (the issue's repro_wire.py prints 'high' for this line).
    • litellm_proxy/deepseek-v4.1-flash sends reasoning_effort when configured, with no proxy metadata available (the repro prints 'high' for this line).
    • openhands/deepseek-v4-flash and openhands/deepseek-v4-pro continue to send reasoning_effort without depending on generic supports_reasoning metadata, so the change composes with SDK sends unsupported reasoning_effort to MiniMax M3 #4934.
    • When max_output_tokens is unset, openhands/deepseek-v4.1-flash resolves and sends a non-null output cap equal to the one openhands/deepseek-v4-flash resolves (16,384 per the issue) rather than omitting it.
    • With capability_overrides={"supports_reasoning_effort": True}, an openai/openrouter/deepseek/deepseek-v4.1-flash request sends reasoning_effort (the repro's last line prints 'high'); an openai/... model without the override still does not send it.
    • reasoning_effort is still not sent when support is unknown or negative, with no regression of SDK sends unsupported reasoning_effort to MiniMax M3 #4934 / MiniMax M3.
    • A configured reasoning_effort that cannot be sent on a given route emits a log line identifying that it was not forwarded (no silent discard).
    • The native deepseek/ provider either forwards the effort level (low / max) instead of discarding it, or an upstream LiteLLM issue documenting the limitation is linked in this issue/PR.
    • Unit tests cover all three routes (openhands/, litellm_proxy/, and openai/... with the override) plus the unknown/negative-support no-send case.
  5. added
    priority:high
    on Sep 18, 2026
  6. changed the title [-][Bug]: reasoning_effort silently not sent for deepseek-v4.1-flash (openhands/, litellm_proxy/) and dropped on openai/ routes even with capability_overrides[/-] [+][Bug]: DeepSeek V4.x reasoning_effort and output cap depend on proxy metadata (dropped without it, 384K default cap with it; openai/ ignores overrides)[/+] on Sep 19, 2026
  7. juanmichelini commented on Sep 19, 2026

    @juanmichelini
    Collaborator

    Notice that we have the opposite problem with minimal-m3 where reasoning effort is sent despite not being supported

  8. changed the title [-][Bug]: DeepSeek V4.x reasoning_effort and output cap depend on proxy metadata (dropped without it, 384K default cap with it; openai/ ignores overrides)[/-] [+][Bug]: output-cap defaults and explicit reasoning overrides are mishandled[/+] on Oct 5, 2026
  9. neubig commented on Oct 5, 2026

    @neubig
    Member

    I corrected the scope after maintainer review. The metadata-free reproducer did not establish that authenticated managed-proxy metadata is absent. The general proxy capability-contract question is now tracked in #5499; this issue is narrowed to the independently demonstrated output-cap default and explicit capability-override behaviors.

    This comment was generated by an AI agent (OpenHands) on behalf of Graham Neubig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugllmpriority:highready-for-dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions