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), 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 directly look at the decimal part: the decimal part of 9.9 is 0.9, 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 answer(content field) Conclusion: 9.9 is greater than 9.11. |
Usage
Bailian Deep Think Model is divided into two modes:
-
Hybrid thinking mode: You can Enable or Disable thinking per request; the control Parameter varies by Model. The following example uses
enable_thinking, with the following values:- set to
true: the Model thinks first and then replies; - set to
false: the Model replies directly;
- OpenAI Compatible
- DashScope
- set to
-
Only Think Mode: The Model always thinks before replying and cannot be disabled. Except that no need to set the
enable_thinkingParameter, the request format is consistent with the Hybrid Think Mode.
reasoning_content Field, and the reply content is returned through thecontent Field. Deep Think requires additional reasoning time. The examples in this article use stream calling by default (Recommend, you can view the Thinking Process in real time and avoid long waits). The commercial version Deep Think Model also supports non-stream (synchronous) Output. For the usage and precautions, see the FAQ below; some Models (such as qwen3.5-122b-a10b, qwen3.5-27b and other open-source versions) only support Stream, and non-stream calling will report an Error.
Supported Models
- Qwen3.8
- Qwen3.7
- Qwen3.6
- Qwen3.5
- Kimi
- Qwen3
- DeepSeek
- GLM
- MiniMax
- Stepfun
reasoning_effort to adjust thinking intensity. For more information, see thinking mode configuration.Quick Start
API Use 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 no lower than 2.19.4 Version).
The following code takes 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 improves response quality, but increases response latency and Token consumption. When using a model with hybrid thinking mode, you can dynamically switch based on question complexity without changing the model:
- Simple tasks (daily chat, simple Q&A): Set
enable_thinkingtofalseDisable thinking; - Complex tasks (logical reasoning, code generation, math problem solving): Set
enable_thinkingSet totrueEnable thinking.
- OpenAI Compatible
- DashScope
- Python
- Node.js
- HTTP
Sample Code
Response
enable_thinkingWhen true, add the following to the prompt: /no_think to disable thinking; to re-enable it in multi-turn conversations, add to the latest prompt: /think . The Model always follows the latest /think or /no_think instruction.
Limit Thinking Length
Deep Think Model s may sometimes generate lengthy reasoning processes, increasing wait time and consuming more Token s. Through the thinking_budget Parameter , you can set the maximum Token count for the reasoning process; once the limit is exceeded, the Model immediately outputs the Response.
thinking_budget The default value is the maximum chain-of-thought length of the model. Please see the model card in the Bailian console.
Experience Deep Think in the console
- Log in to the Bailian console on 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 reasoning mode to view the Thinking Process of the Model.
- Click the top-right Debugging, in the opened Settings panel configure the
thinking_budgetParameter, control the maximum number of Tokens in the Chain of Thought Output, value range 1-32768, Default Value 4000. For more information, see Bailian Models.
- OpenAI Compatible
- DashScope
- Python
- Node.js
- HTTP
Sample Code
Response
Pass Thinking Process
In multi-turn conversations, preserve_thinking controls whether the model reads from historical assistant messages reasoning_content. When set to true, these thinking contents will be appended to the next round's input. The client needs to, in the request's messages, provide historical assistant messages and their reasoning_content. The default value of each model is subject to Chat Completions Parameter Description.
For the above models that support this parameter—Qwen3.8 Max, Qwen3.7, Qwen3.6 and Kimi—if the history messages do not contain reasoning_content, enabling this parameter will not cause an error.
After enabling it, the reasoning_content in the history messages will be counted toward the input Token quantity and billing.
- OpenAI Compatible
- DashScope
preserve_thinkingNon-OpenAI standard parameter. When using the Python SDK, you must pass it in viaextra_body.- 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. When the model outputs Thinking Process, all Output Tokens (including thinking Tokens and reply Tokens) are billed at the Output price of thinking mode.
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): Set
enable_thinkingtofalseto Disable; - Thinking-only mode models (such as glm-5.3, kimi-k3): cannot be disabled.
enable_thinking is an extended Parameter of Bailian and does not belong to the OpenAI standard Field. When Using the OpenAI Java SDK, ChatCompletionCreateParams does not natively support this Field, and it needs to be passed through extraBody method:Q: How to confirm whether thinking mode is enabled?
Q: How to confirm whether thinking mode is enabled?
- Check whether the
enable_thinking=trueParameter is correctly passed in the API request. When Using the OpenAI Java SDK, this Parameter needs to be passed throughextraBodyPass in (see the previous example). - Check whether the response contains
reasoning_contentField, and confirm that in usagereasoning_tokensis Greater than 0. If it does not contain this Field Orreasoning_tokens=0indicates that thinking mode is not enabled. - Compare the response time and
completion_tokens. After enabling thinking mode, the response will containreasoning_contentField, and the total time increases significantly (measured about 3 Times of non-thinking mode); if the time difference between the two is minimal, it indicates that thinking mode is not actually effective, please check whether the Parameter is passed in correctly and retry.
Q: How to troubleshoot slow qwen3.7-plus responses?
Q: How to troubleshoot slow qwen3.7-plus responses?
- Confirm whether thinking mode is enabled. qwen3.7-plus is enabled by default, and you can determine this based on whether the response returns
reasoning_contentfield. - View the response usage for
completion_tokensandreasoning_tokens. Ifreasoning_tokensis high, then the long total time is an expected performance of the thinking mode. - If the Thinking Process is not needed, set
enable_thinkingtofalseto Disable the thinking mode. After disabling, Output Token is significantly reduced, and measured 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 faster and view the Thinking Process in real time, avoiding long waits for the complete response.
The usage statistics display the overall time of a single Calling (including the generation time of Thinking Tokens), not 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 stream example to non-stream, please synchronously modify the response parsing code: the non-stream Calling returns the complete Response object (The following uses the OpenAI-compatible interface, non-stream Calling of qwen3.8-max with Enable thinking mode as an example:completion), cannot iterate like the stream example viafor chunk in completioniterate (otherwise it will report Error'tuple' object has no attribute 'choices'), but 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 open-source versions) only support Stream, non-stream Calling will report an error parameter.enable_thinking only support stream call, for such models please Use stream 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 occurs automatically at minute-level intervals. For consumption details, go to ;Bill Details to view.
Q: How to connect Chatbox, Cherry Studio, Cline, or Dify?
Q: How to connect Chatbox, Cherry Studio, Cline, or Dify?
The following uses common tools as examples; other large model tools follow a similar integration approach.
- Chatbox
- Cherry Studio
- Cline
- Dify
Q: Can I upload images or documents for questioning?
Q: Can I upload images or documents for questioning?
Q: How to output the thinking process when using LangChain?
Q: How to output the thinking process when using LangChain?
-
Update dependency libraries
Update
langchain_communityanddashscopeto the latest version:
- Calling Deep Think Model Pass the following code to print the Thinking Process and reply content respectively:
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 set to true). Thinking mode increases processing time, and in long-prompt scenarios this may cause the response to be truncated or the request to time out.Solution:- Disable thinking mode: Set
enable_thinkingtofalse, processing time can be reduced from about 50 s to about 30 s. - Enable Stream: Set
streamtotrueto avoid the timeout limit of non-streaming calls. - Increase the timeout: If you need to keep thinking mode, set the client timeout to 180 s or more.
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, and the reasoning_content Field contains the complete Thinking Process content, and the Model will normally return the thinking content. Disconnections are typically 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.
- Check the client logs to confirm the correlation between the disconnection time and the Output of thinking tags.
Q: What to do if the model conclusion contradicts the content description when using a visual model (e.g. qwen3-vl-plus) for image safety judgment?
Q: What to do if the model conclusion contradicts the content description when using a visual model (e.g. qwen3-vl-plus) for image safety judgment?