Docs: DashScope thinking mode requires thinking_budget, docs only mention enable_thinking
Problem
When enabling thinking mode on DashScope for qwen3.5-27b, Qwen-Agent fails with a 400 error unless thinking_budget is also passed, but the official docs only mention enable_thinking.
Reproduction
from qwen_agent.agents import Assistant
llm_cfg = {
"model": "qwen3.5-27b",
"model_type": "qwenvl_dashscope",
"api_key": "your-dashscope-api-key",
"generate_cfg": {
"enable_thinking": True,
},
}
agent = Assistant(llm=llm_cfg, function_list=[], system_message="")Error:
qwen_agent.llm.base.ModelServiceError:
Error code: InvalidParameter. Error message: <400> InternalError.Algo.InvalidParameter:
The thinking_budget parameter must be a positive integer and not greater than 0The same 400 occurs via the DashScope OpenAI-compatible endpoint:
llm_cfg = {
"model": "qwen3.5-27b",
"model_type": "qwenvl_oai",
"model_server": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"api_key": "your-dashscope-api-key",
"generate_cfg": {
"extra_body": {
"enable_thinking": True,
},
},
}Root cause
DashScope requires thinking_budget (a positive integer no larger than the model's max thinking length) whenever enable_thinking is true. When it is omitted, the gateway treats it as 0 and rejects the request.
Workaround
Pass thinking_budget explicitly. Verified working for qwen3.5-27b:
"generate_cfg": {
"enable_thinking": True,
"thinking_budget": 12000,
}and for the OpenAI-compatible endpoint:
"generate_cfg": {
"extra_body": {
"enable_thinking": True,
"thinking_budget": 12000,
},
}With the workaround, reasoning_content is returned correctly and tool calling still works.
Docs gap
qwen-agent-docs/website/content/en/guide/get_started/configuration.mdonly documentsenable_thinkingfor DashScope, DashScope OAI, and vLLM.- The Chinese readthedocs page (
QwenLM/Qwen3/docs/source/framework/qwen_agent.rst) has the same gap.
It would be helpful to add thinking_budget to the DashScope examples, and mention that it must be a positive integer not exceeding the model's max thinking length, so users do not hit this cryptic 400.
Environment
- qwen-agent: 0.0.34 (also checked
main) - DashScope model:
qwen3.5-27b(hybrid thinking)
Source: QwenLM/Qwen-Agent