Skip to content

Thinking

Beta. Updated 2026-10-29.

Qwen models reason before answering. Thinking is on by default.

PropertyThinking onThinking off
chat_template_kwargs.enable_thinkingtrue (default)false
message.reasoningreasoning textnull
Streamed reasoningdelta.reasoningnone
usage.completion_tokensanswer plus reasoninganswer
First answer token, qwen3.8-27bafter the reasoningabout 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 reasoning and delta.reasoning. Older vLLM versions and some clients use reasoning_content. The OpenAI Python SDK returns reasoning as an attribute: read message.reasoning.
  • max_tokens includes reasoning tokens. A low max_tokens ends the response during reasoning, with finish_reason: "length" and empty content. Set max_tokens to 1,000 or more for hard questions.
  • content can start with blank lines after reasoning. Trim content.
  • Send earlier assistant turns with content only, without reasoning.
  • qwen3.8-27b-uncensored produces about 58 % less reasoning (Swift fine-tune authors' figure; not measured).
  • chat_template_kwargs is not an OpenAI parameter. Python SDK: pass chat_template_kwargs in extra_body. curl and fetch: send chat_template_kwargs as a top-level body field.