enable_thinking of llm of openai_api_compatible is not work for some model #945

Closed
opened 2026-02-16 10:21:04 -05:00 by yindo · 2 comments
Owner

Originally created by @yimlin on GitHub (Jan 22, 2026).

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.8.1

Plugin version

0.0.28

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

enable_thinking for llm is not work for some model.

if enable_thinking_value is not None:
            model_parameters.setdefault("chat_template_kwargs", {})["enable_thinking"] = enable_thinking_value
            # Add From: https://github.com/langgenius/dify-official-plugins/pull/2151
            model_parameters.setdefault("chat_template_kwargs", {})["thinking"] = enable_thinking_value

we add the cdoe as below

if enable_thinking_value is not None:
            model_parameters.setdefault("chat_template_kwargs", {})["enable_thinking"] = enable_thinking_value
            # Add From: https://github.com/langgenius/dify-official-plugins/pull/2151
            model_parameters.setdefault("chat_template_kwargs", {})["thinking"] = enable_thinking_value
            if enable_thinking_value:
                model_parameters.setdefault("chat_template_kwargs", {})["thinking_mode"] = "on" 
            if not enable_thinking_value:
                model_parameters.setdefault("chat_template_kwargs", {})["thinking_mode"] = "off" 

now, it works

✔️ Error log

No response

Originally created by @yimlin on GitHub (Jan 22, 2026). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.8.1 ### Plugin version 0.0.28 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce enable_thinking for llm is not work for some model. ``` if enable_thinking_value is not None: model_parameters.setdefault("chat_template_kwargs", {})["enable_thinking"] = enable_thinking_value # Add From: https://github.com/langgenius/dify-official-plugins/pull/2151 model_parameters.setdefault("chat_template_kwargs", {})["thinking"] = enable_thinking_value ``` we add the cdoe as below ``` if enable_thinking_value is not None: model_parameters.setdefault("chat_template_kwargs", {})["enable_thinking"] = enable_thinking_value # Add From: https://github.com/langgenius/dify-official-plugins/pull/2151 model_parameters.setdefault("chat_template_kwargs", {})["thinking"] = enable_thinking_value if enable_thinking_value: model_parameters.setdefault("chat_template_kwargs", {})["thinking_mode"] = "on" if not enable_thinking_value: model_parameters.setdefault("chat_template_kwargs", {})["thinking_mode"] = "off" ``` now, it works ### ✔️ Error log _No response_
yindo added the bug label 2026-02-16 10:21:04 -05:00
yindo closed this issue 2026-02-16 10:21:04 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 22, 2026):

Hi @yimlin! I'm Dosu and I’m helping the dify-official-plugins team.

Your findings are correct: the enable_thinking parameter in the OpenAI API compatible plugin doesn't work for all models because different providers and models expect different parameter names or formats for "thinking mode". For example, some models (like DeepSeek v3.1 on Volcengine) only recognize a thinking parameter, not enable_thinking ref. Others (like Qwen3 on vLLM) may require thinking_mode or have strict requirements for when enable_thinking can be set ref.

The official plugin code tries to handle this by checking the model's agent_thought_support capability and, if supported, sets both enable_thinking and thinking in chat_template_kwargs, and sometimes a top-level thinking parameter for Zhipu-style APIs ref. However, not all models or providers support all of these parameters, and sending unsupported ones can cause errors (e.g., vLLM via LiteLLM will reject unknown parameters) ref.

Your workaround—adding thinking and thinking_mode in addition to enable_thinking—works for some models because it covers more of the possible parameter names that different backends might expect. There is no universal standard, so the best practice is to check the documentation or YAML config for your specific model/provider to see which parameter(s) it expects for thinking mode. Avoid sending parameters that the backend doesn't support.

If you want robust compatibility, consider adding logic to only include the parameters required by the target model/provider, and use the latest plugin/model YAMLs, as recent updates have improved support for these options ref.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 22, 2026): <!-- Greeting --> Hi @yimlin! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify-official-plugins team. <!-- Answer --> Your findings are correct: the `enable_thinking` parameter in the OpenAI API compatible plugin doesn't work for all models because different providers and models expect different parameter names or formats for "thinking mode". For example, some models (like DeepSeek v3.1 on Volcengine) only recognize a `thinking` parameter, not `enable_thinking` [ref](https://github.com/langgenius/dify-official-plugins/issues/2185). Others (like Qwen3 on vLLM) may require `thinking_mode` or have strict requirements for when `enable_thinking` can be set [ref](https://github.com/langgenius/dify-official-plugins/issues/1330). The official plugin code tries to handle this by checking the model's `agent_thought_support` capability and, if supported, sets both `enable_thinking` and `thinking` in `chat_template_kwargs`, and sometimes a top-level `thinking` parameter for Zhipu-style APIs [ref](https://github.com/langgenius/dify-official-plugins/blob/e722dcde41eb158954ff0408e9e9abd09de8a85a/models/openai_api_compatible/models/llm/llm.py#L107-L245). However, not all models or providers support all of these parameters, and sending unsupported ones can cause errors (e.g., vLLM via LiteLLM will reject unknown parameters) [ref](https://github.com/langgenius/dify-official-plugins/issues/2366). Your workaround—adding `thinking` and `thinking_mode` in addition to `enable_thinking`—works for some models because it covers more of the possible parameter names that different backends might expect. There is no universal standard, so the best practice is to check the documentation or YAML config for your specific model/provider to see which parameter(s) it expects for thinking mode. Avoid sending parameters that the backend doesn't support. If you want robust compatibility, consider adding logic to only include the parameters required by the target model/provider, and use the latest plugin/model YAMLs, as recent updates have improved support for these options [ref](https://github.com/langgenius/dify-official-plugins/pull/2151). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/271f6a24-23bd-47ae-8557-7c4c0a4af9dc?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/271f6a24-23bd-47ae-8557-7c4c0a4af9dc?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/271f6a24-23bd-47ae-8557-7c4c0a4af9dc?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/271f6a24-23bd-47ae-8557-7c4c0a4af9dc?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/271f6a24-23bd-47ae-8557-7c4c0a4af9dc?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/271f6a24-23bd-47ae-8557-7c4c0a4af9dc?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/271f6a24-23bd-47ae-8557-7c4c0a4af9dc?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Your%20findings%20are%20correct%3A%20the%20%60enable_thinking%60%20parameter%20in%20the%20OpenAI%20API%20compatible%20plugin%20doesn%27t%20work%20for%20all%20models%20because%20different%20providers%20and%20models%20expect%20different%20parameter%20names%20or%20formats%20for%20%22thinking%20mode%22.%20For%20example%2C%20some%20models%20%28like%20DeepSeek%20v3.1%20on%20Volcengine%29%20only%20recognize%20a%20%60thinking%60%20parameter%2C%20not%20%60enable_thinking%60%C2%A0%5Bref%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2185%29.%20Others%20%28like%20Qwen3%20on%20vLLM%29%20may%20require%20%60thinking_mode%60%20or%20have%20strict%20requirements%20for%20when%20%60enable_thinking%60%20can%20be%20set%C2%A0%5Bref%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/1330%29.%0A%0AThe%20official%20plugin%20code%20tries%20to%20handle%20this%20by%20checking%20the%20model%27s%20%60agent_thought_support%60%20capability%20and%2C%20if%20supported%2C%20sets%20both%20%60enable_thinking%60%20and%20%60thinking%60%20in%20%60chat_template_kwargs%60%2C%20and%20sometimes%20a%20top-level%20%60thinking%60%20parameter%20for%20Zhipu-style%20APIs%C2%A0%5Bref%5D%28https%3A//github.com/langgenius/dify-official-plugins/blob/e722dcde41eb158954ff0408e9e9abd09de8a85a/models/openai_api_compatible/models/llm/llm.py%23L107-L245%29.%20However%2C%20not%20all%20models%20or%20providers%20support%20all%20of%20these%20parameters%2C%20and%20sending%20unsupported%20ones%20can%20cause%20errors%20%28e.g.%2C%20vLLM%20via%20LiteLLM%20will%20reject%20unknown%20parameters%29%C2%A0%5Bref%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2366%29.%0A%0AYour%20workaround%E2%80%94adding%20%60thinking%60%20and%20%60thinking_mode%60%20in%20addition%20to%20%60enable_thinking%60%E2%80%94works%20for%20some%20models%20because%20it%20covers%20more%20of%20the%20possible%20parameter%20names%20that%20different%20backends%20might%20expect.%20There%20is%20no%20universal%20standard%2C%20so%20the%20best%20practice%20is%20to%20check%20the%20documentation%20or%20YAML%20config%20for%20your%20specific%20model/provider%20to%20see%20which%20parameter%28s%29%20it%20expects%20for%20thinking%20mode.%20Avoid%20sending%20parameters%20that%20the%20backend%20doesn%27t%20support.%0A%0AIf%20you%20want%20robust%20compatibility%2C%20consider%20adding%20logic%20to%20only%20include%20the%20parameters%20required%20by%20the%20target%20model/provider%2C%20and%20use%20the%20latest%20plugin/model%20YAMLs%2C%20as%20recent%20updates%20have%20improved%20support%20for%20these%20options%C2%A0%5Bref%5D%28https%3A//github.com/langgenius/dify-official-plugins/pull/2151%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/2468)
Author
Owner

@yimlin commented on GitHub (Jan 22, 2026):

I totally agree.

and i pull a new feature.

https://github.com/langgenius/dify-official-plugins/issues/2472

@yimlin commented on GitHub (Jan 22, 2026): I totally agree. and i pull a new feature. https://github.com/langgenius/dify-official-plugins/issues/2472
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#945