Deep thinking models reason before responding, improving accuracy on complex tasks like logical reasoning and math.
This article describes how to call the Deep Think model via the OpenAI-compatible Chat Completion interface or the DashScope interface. For Responses API usage, see: Deep Think.
Demo
The following is a conversation example of the Deep Think model, showing how the model first performs reasoning and then gives an answer.
User Question 9.9 and 9.11, which is larger? Thinking Process (reasoning_content field) First, the user's question is: "9.9 and 9.11, which is larger", which appears to be comparing two numbers: 9.9 and 9.11. I need to understand the meaning of these numbers. In mathematics, 9.9 is equivalent to 9.90, and 9.11 is 9.11. To compare them, I should treat them as decimals. 9.9 is 9 + 9/10 = 9.9, while 9.11 is 9 + 11/100 = 9.11. Now, compare 9.9 and 9.11: 9.9 is equal to 9.90 (because 9.9 = 9.90), and 9.11 is 9.11. Now, compare 9.90 with 9.11: 9.90 is greater than 9.11, because 90/100 > 11/100. More precisely: 9.9 = 99/10 = 990/100, 9.11 = 911/100, compare 990/100 with 911/100, obviously 990 > 911, so 990/100 > 911/100, therefore 9.9 > 9.11. I can also look directly at the decimal part: the decimal part of 9.9 is 0.9, and the decimal part of 9.11 is 0.11. 0.9 is greater than 0.11, because 0.9 = 0.90 > 0.11. So, 9.9 is greater than 9.11. Model response(content field) Conclusion: 9.9 is greater than 9.11. |
Usage
The Bailian Deep Think Model is divided into two modes:
-
Mixed Thinking Mode: Thinking can be enabled or disabled per request, and the control parameters vary by model. The following example uses
enable_thinking, the values are as follows:- Set to
true: the model thinks before responding; - Set to
false: the model responds directly;
- OpenAI Compatible
- DashScope
- Set to
-
Thinking-only mode: The model always thinks before replying and cannot be disabled. Except that you do not need to set the
enable_thinkingparameter, the request format is consistent with the hybrid thinking mode.
reasoning_contentfield, and the reply content is returned through thecontentfield. Deep Think requires additional reasoning time. The examples in this article use streaming calling by default (recommended, you can view the Thinking Process in real time and avoid long waits). The commercial Deep Think model also supports non-streaming (synchronous) Output. For usage and precautions, see theFAQbelow; some models (such as qwen3.5-122b-a10b, qwen3.5-27b and other open-source versions) only support Stream Output, and non-streaming calling will report an error.
Supported Models
- Qwen3.8
- Qwen3.7
- Qwen3.6
- Qwen3.5
- Qwen3
- DeepSeek
- GLM
- Kimi
- MiniMax
reasoning_effort. For more information, see Thinking mode configuration.Quick Start
API usage prerequisite: AlreadyObtain and Configure API Keyand completeConfigure API Key to environment variables. If Pass SDK Calling, needInstall OpenAI Or DashScope SDK(DashScope Java SDK requires at least 2.19.4 Version).
The following code uses stream Calling qwen3.8-max Enable thinking mode as an example.
- OpenAI Compatible
- DashScope
- Python
- Node.js
- HTTP
Sample Code
Response
Core Capabilities
Switch Thinking/Non-Thinking Mode
Enabling thinking mode can improve response quality, but will increase response latency and Token consumption. When using models with hybrid thinking mode, you can dynamically switch based on problem complexity without changing the model:
- Simple tasks (daily chat, simple Q&A): Set
enable_thinkingtofalseto disable thinking; - Complex tasks (logical reasoning, Code generation, mathematical solutions): Set
enable_thinkingtotrueEnable thinking.
- OpenAI Compatible
- DashScope
- Python
- Node.js
- HTTP
Sample Code
Response
enable_thinkingWhentrue, add it to the prompt/no_thinkto disable thinking; in Multi-turn, to re-enable, add it to the latest prompt/think. The Model always follows the latest/think or /no_think instruction.
Limit Thinking Length
Deep Think Model sometimes generates verbose Thinking Process, increasing waiting time and consuming more Token. Throughthinking_budget Parameter sets the maximum Token number of Thinking Process, and after exceeding the limit, the Model immediately Output Response.
thinking_budget The Default Value is the maximum thought chain length of the Model, please see the Model card of Bailian console.
Experience Deep Think in the console
- Log in to the Bailian console of the large model service platform.
- In the left navigation pane, selectExperience Center > Text.
- The page displays the Qwen3.7-Max model by default. You can also click the model name and select other Qwen3 series models from the drop-down list.
- Click at the bottom of the input boxDeep Think, enable the reasoning mode, and view the model's Thinking Process.
- Click the upper-right Debugging, and in the opened configuration panel, set the
thinking_budgetParameter, which controls the maximum number of tokens output by the thought chain. Value range 1~32768, default value 4000. To experience more models, you can go to Bailian Model Plaza.
- OpenAI Compatible
- DashScope
- Python
- Node.js
- HTTP
Sample Code
Response
Pass Thinking Process
In Multi-turn, preserve_thinking controls whether the Model reads historical assistant message reasoning_content. When set to true, these thinking contents will be appended to the next-round input. The client needs to provide historical assistant messages and their messages in the request's reasoning_content. The Default Value of each model is based on Chat Completions Parameter Description.
For the above Qwen3.8 Max, Qwen3.7, Qwen3.6 and Kimi models that support this Parameter, if the historical messages do not contain reasoning_content, enabling this Parameter will not cause an error.
After Enable, in the historical conversation reasoning_content will be counted toward input Token count and billing.
- OpenAI Compatible
- DashScope
preserve_thinkingNon OpenAI standard Parameter, Use Python SDK needs to Pass extra_bodyin.- Python
- Node.js
- HTTP
Sample Code
Response
Other Features
Billing Details
- Thinking content is billed by Output Token.
-
Some hybrid thinking models have different prices in thinking and non-thinking modes.
If the model does not Output Thinking Process in thinking mode, it is billed at the non-thinking mode price.
FAQ
Q: How to disable thinking mode?
Q: How to disable thinking mode?
- Hybrid thinking mode models (such as qwen3.6-plus, deepseek-v4-pro):
enable_thinkingset tofalseto disable; - Thinking-only mode models (such as glm-5.3, kimi-k3): cannot be disabled.
Q: How to troubleshoot slow qwen3.7-plus responses?
Q: How to troubleshoot slow qwen3.7-plus responses?
- Confirm whether thinking mode is Enable. qwen3.7-plus is Enable by default, which can be determined by whether the
reasoning_contentField is returned in the response. - Check the
completion_tokensandreasoning_tokensin the response usage. Ifreasoning_tokensis relatively high, the total time consumption is an expected behavior of the Thinking mode. - If no Thinking Process is needed, set
enable_thinkingtofalseto disable the Thinking mode. Once disabled, the Output Token is significantly reduced, and the actual total time can be reduced by 60%-75%. - If you need to retain the Thinking capability, you can switch toStream to obtain the first Token more quickly and view the Thinking Process in real time, avoiding long waits for the complete response.
The usage statistics display the overall time consumption of a single Calling (including the generation time of the Thinking Token), rather than the generation latency of a single Token.
Q: How to call deep thinking models in non-streaming (synchronous) mode?
Q: How to call deep thinking models in non-streaming (synchronous) mode?
When changing the streaming example to non-streaming, please modifyResult parsing code: non-streaming Calling returns a complete Response object (The following uses the OpenAI-compatible interface with non-streaming Calling of qwen3.8-max with thinking mode enabled as an example:completion), cannot iterate throughfor chunk in completionas in the streaming Sample Code (otherwise an error'tuple' object has no attribute 'choices'will be raised), and should directly readcompletion.choices[0].message.reasoning_content(Thinking Process) andcompletion.choices[0].message.content(reply content). In addition,stream=Falsecannot set thestream_optionsParameter.
Some models (such as qwen3.5-122b-a10b, qwen3.5-27b and other open-source versions) only support Stream output, and non-streaming Calling will result in an error parameter.enable_thinking only support stream call. For such models, please Use streaming Calling.
Q: How to purchase Tokens after the free quota is exhausted?
Q: How to purchase Tokens after the free quota is exhausted?
After exceeding the Free Quota, billing is automatic at minute-level intervals. For consumption details, please go to ;Bill Details to view.
Q: Can I upload images or documents for questioning?
Q: Can I upload images or documents for questioning?
Q: How to view Token consumption and call count?
Q: How to view Token consumption and call count?
Monitoring data is updated at minute level and is for reference only; it is not used as a billing basis.
Q: What to do if a long prompt fails to generate or times out?
Q: What to do if a long prompt fails to generate or times out?
enable_thinking is true). The thinking mode will increase processing time, and in long prompt scenarios may cause response truncation or request timeout.Solution:- Disable thinking mode: Set
enable_thinkingtofalse, reducing processing time from about 50 s to about 30 s. - Enable Stream: Set
streamset totrueto avoid the timeout limit of non-streaming calls. - Increase the timeout: If you need to keep thinking mode, set the client timeout to 180 seconds or above.
Q: What to do if a third-party client disconnects after outputting a thinking tag when calling a deep thinking model?
Q: What to do if a third-party client disconnects after outputting a thinking tag when calling a deep thinking model?
enable_thinking parameter to control the thinking mode toggle, and the model returns reasoning_content Field contains the complete Thinking Process content, and the model will normally return the thinking content. Disconnections are usually caused by client network fluctuations or client version compatibility issues.Troubleshooting steps:- Check the stability of the client network connection.
- Upgrade the client to the latest version.
- View the client logs to confirm the association between the disconnection time point and the thinking tag Output.