openai_api_compatible: reasoning_effort is silently dropped unless thinking mode is toggled on

Open Beginner friendly
#3,827 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
api

Research direction

Start in models/openai_api_compatible/models/llm/llm.py around line 605, then compare the Responses API handling around line 1132. Reproduce the OpenAI-compatible request with reasoning_effort set to high and thinking mode off. Done means the outgoing request retains reasoning_effort in this configuration without changing the separate thinking-mode behavior.

Written by the indexing model from the issue text.

Description

Self Checks
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues Dify issues & Dify Official Plugins, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.
Dify version

1.10.1

Plugin version

0.0.59. Also reproducible on 0.0.64 (current main) — the code path is unchanged.

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

reasoning_effort is a standard OpenAI Chat Completions parameter, but the
OpenAI-API-compatible provider silently discards it unless the non-standard thinking-mode
toggle happens to be on.

1. Add a model under OpenAI-API-compatible pointing at any OpenAI reasoning model
   (e.g. gpt-5.6-luna, directly or through a gateway such as LiteLLM).
2. Set "Thinking Mode Support" to "Both Modes" (agent_thought_support: supported).
3. Set "Compatibility mode" to "OpenAI compatible" (strict).
4. In an app, open the model parameter panel and set "Reasoning effort" to `high`.
5. Leave the "Thinking mode" toggle off — its default state.
6. Send a message and inspect the outgoing request body.

Expected: the request carries reasoning_effort: "high".

Actual: reasoning_effort is absent. The value is discarded with no warning.

Cause

models/openai_api_compatible/models/llm/llm.py (0.0.64, line 605):

reasoning_effort_value = model_parameters.pop("reasoning_effort", None)
if enable_thinking_value is True and reasoning_effort_value is not None:
    model_parameters["reasoning_effort"] = reasoning_effort_value

reasoning_effort is popped unconditionally but only re-added when enable_thinking_value is True. With agent_thought_support: supported and the toggle untouched, enable_thinking_value
stays None, so the parameter never makes it into the request.

Gating it behind enable_thinking couples two unrelated concerns. That toggle's other effects
(chat_template_kwargs, thinking, enable_thinking) exist for vLLM/SGLang/Qwen3-style runtimes
and are themselves suppressed in strict compatibility mode, whereas reasoning_effort is part of
the OpenAI API proper.

The implementation is already inconsistent with itself

The Responses API path added in 0.0.64 forwards the parameter with no such gate (line 1132):

reasoning_effort = model_parameters.get("reasoning_effort")
if reasoning_effort:
    responses_params["reasoning"] = {"effort": reasoning_effort}

So the same credentials and the same parameter behave differently depending only on api_type.

Suggested fix

Send the top-level reasoning_effort whenever enable_thinking_value is not False, keeping the
chat_template_kwargs mirror gated on extended compatibility mode as it is today.

This changes behaviour for existing configurations, which is why I am opening an issue rather than
a PR. Happy to submit one if maintainers agree with the direction.

Related

Adjacent fixes to the same area are in #3826. This issue is kept separate because it changes
existing behaviour rather than correcting an internal inconsistency.

✔️ Error log

Not applicable — the parameter is dropped silently, with no error raised on either side.

Dominant language
Python
Stars
635
Forks
919
Avg merge
2d 1h
Merged PRs (30d)
89

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from langgenius/dify-official-plugins

All issues in langgenius/dify-official-plugins

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.