Thinking
Beta. Updated 2026-10-29.
Qwen models reason before answering. Thinking is on by default.
| Property | Thinking on | Thinking off |
|---|---|---|
chat_template_kwargs.enable_thinking | true (default) | false |
message.reasoning | reasoning text | null |
| Streamed reasoning | delta.reasoning | none |
usage.completion_tokens | answer plus reasoning | answer |
First answer token, qwen3.8-27b | after the reasoning | about 0.3 s |
Use thinking for maths, code and multi-step questions. Turn thinking off for chat, extraction, classification, tool calls and high concurrency.
Example
curl
curl https://citadel.albastov.com/v1/chat/completions \
-H "Authorization: Bearer $CITADEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen3.8-27b", "max_tokens": 400,
"messages": [{"role": "user", "content": "Is 91 prime? Answer yes or no."}]}'Python
import os
from openai import OpenAI
client = OpenAI(base_url="https://citadel.albastov.com/v1", api_key=os.environ["CITADEL_API_KEY"])
question = [{"role": "user", "content": "Is 91 prime? Answer yes or no."}]
on = client.chat.completions.create(model="qwen3.8-27b", messages=question, max_tokens=400)
msg = on.choices[0].message
print("reasoning:", getattr(msg, "reasoning", None))
print("answer:", msg.content.strip())
print("reasoning tokens:", on.usage.completion_tokens_details.reasoning_tokens)
off = client.chat.completions.create(
model="qwen3.8-27b", messages=question, max_tokens=400,
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
)
print("answer without thinking:", off.choices[0].message.content.strip())Response, thinking on (abridged)
{
"message": {
"role": "assistant",
"content": "\n\nNo",
"reasoning": "We need answer user: \"Is 91 prime? Answer yes or no.\" Need final yes or no. 91=7*13 not prime. Answer no. Ensure only yes/no maybe \"No\".\n"
},
"usage": {"prompt_tokens": 63, "completion_tokens": 50, "total_tokens": 113,
"completion_tokens_details": {"reasoning_tokens": 46}}
}Details
- vLLM 0.31 returns
reasoninganddelta.reasoning. Older vLLM versions and some clients usereasoning_content. The OpenAI Python SDK returnsreasoningas an attribute: readmessage.reasoning. max_tokensincludes reasoning tokens. A lowmax_tokensends the response during reasoning, withfinish_reason: "length"and emptycontent. Setmax_tokensto 1,000 or more for hard questions.contentcan start with blank lines after reasoning. Trimcontent.- Send earlier assistant turns with
contentonly, withoutreasoning. qwen3.8-27b-uncensoredproduces about 58 % less reasoning (Swift fine-tune authors' figure; not measured).chat_template_kwargsis not an OpenAI parameter. Python SDK: passchat_template_kwargsinextra_body. curl andfetch: sendchat_template_kwargsas a top-level body field.