> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sglang.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Qwen3.6

## 1. Model Introduction

The Qwen3.6 series is developed by Alibaba. Built on direct feedback from the community, Qwen3.6 prioritizes stability and real-world utility, delivering substantial upgrades in agentic coding and thinking preservation. Two size/sparsity variants are released:

* [Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B) — **Sparse MoE** (35B total, 3B active) on a Gated Delta Networks backbone.
* [Qwen3.6-27B](https://huggingface.co/Qwen/Qwen3.6-27B) — **Dense** hybrid GDN; smaller weights footprint, single-GPU friendly.

Both variants share the same hybrid reasoning, tool-calling, and multimodal interface and natively handle context lengths of up to 262,144 tokens, extensible to over 1M tokens.

**Key Features:**

* **Agentic Coding**: Handles frontend workflows and repository-level reasoning with greater fluency and precision
* **Thinking Preservation**: New option to retain reasoning context from historical messages, streamlining iterative development
* **Efficient Hybrid Architecture**: Gated Delta Networks backbone; sparse MoE (35B / 3B active) or dense 27B variant
* **Hybrid Reasoning**: Thinking mode enabled by default with step-by-step reasoning, can be disabled for direct responses
* **Tool Calling**: Built-in tool calling support with `qwen3_coder` parser
* **Multi-Token Prediction (MTP)**: Speculative decoding support for lower latency; both MoE and Dense variants ship `mtp.safetensors`
* **Multimodal**: Unified vision-language model supporting text, image, and video inputs

**Available Models:**

<table>
  <thead>
    <tr>
      <th>Model</th>
      <th>Architecture</th>
      <th>Weights</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>Qwen3.6-35B-A3B (BF16)</td>
      <td>MoE 35B / 3B active</td>
      <td>[Qwen/Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B)</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B (FP8)</td>
      <td>MoE 35B / 3B active</td>
      <td>[Qwen/Qwen3.6-35B-A3B-FP8](https://huggingface.co/Qwen/Qwen3.6-35B-A3B-FP8)</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B (NVFP4)</td>
      <td>MoE 35B / 3B active (Blackwell)</td>
      <td>[nvidia/Qwen3.6-35B-A3B-NVFP4](https://huggingface.co/nvidia/Qwen3.6-35B-A3B-NVFP4)</td>
    </tr>

    <tr>
      <td>Qwen3.6-27B (BF16)</td>
      <td>Dense 27B</td>
      <td>[Qwen/Qwen3.6-27B](https://huggingface.co/Qwen/Qwen3.6-27B)</td>
    </tr>

    <tr>
      <td>Qwen3.6-27B (FP8)</td>
      <td>Dense 27B</td>
      <td>[Qwen/Qwen3.6-27B-FP8](https://huggingface.co/Qwen/Qwen3.6-27B-FP8)</td>
    </tr>

    <tr>
      <td>Qwen3.6-27B (NVFP4)</td>
      <td>Dense 27B (Blackwell)</td>
      <td>[nvidia/Qwen3.6-27B-NVFP4](https://huggingface.co/nvidia/Qwen3.6-27B-NVFP4)</td>
    </tr>
  </tbody>
</table>

**License:** Apache 2.0

## 2. SGLang Installation

SGLang `>=0.5.10` is required for Qwen3.6. You can install from PyPI, from source, or use a Docker image:

```bash Command theme={null}
# Install from PyPI
uv pip install --prerelease=allow sglang

# Or install from source
uv pip install --prerelease=allow 'git+https://github.com/sgl-project/sglang.git#subdirectory=python'

# Or use Docker (NVIDIA GPUs; also serves the NVFP4 variants)
docker pull lmsysorg/sglang:latest
```

For the full Docker setup and other installation methods, please refer to the [official SGLang installation guide](https://docs.sglang.io/docs/get-started/install.md).

For SGLang CPU installation, please refer to the [CPU version installation guide](https://docs.sglang.io/docs/hardware-platforms/cpu_server.md#installation).

On Ascend NPUs (Atlas 800I A3), follow [SGLang installation with NPU support](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/getting-started/installation.md) and the [Ascend NPU quickstart](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/getting-started/quick_start.md) to select a compatible container image and host driver. The A3 recipes below require the Ascend software stack; the CUDA image above does not provide it.

## 3. Model Deployment

This section provides deployment configurations optimized for different hardware platforms and use cases.

### 3.1 Basic Configuration

**Interactive Command Generator**: Use the configuration selector below to automatically generate the appropriate deployment command for your hardware platform and capabilities, including Ascend NPU (Atlas 800I A3) scenarios.

Run this Command:

<pre />

### RTX Spark: 35B-A3B NVFP4

Select **RTX Spark** in the generator above to use the single-node, single-GPU recipe for
[nvidia/Qwen3.6-35B-A3B-NVFP4](https://huggingface.co/nvidia/Qwen3.6-35B-A3B-NVFP4)
on [NVIDIA RTX Spark](https://www.nvidia.com/en-us/products/rtx-spark/), which
pairs a Blackwell RTX GPU with a Grace CPU and offers up to 128GB of unified
memory. The contributor tested this command on SGLang `main`. The recipe uses
the FlashInfer CUTLASS MoE runner,
`extra_buffer` Mamba radix caching, and a static memory fraction of `0.8`.
Speculative decoding is not enabled.

The contributor reported **75 output tokens/s for a single request** on SGLang
`main`. The exact commit, OS/runtime, memory configuration, input/output lengths,
and timing method were not provided. This is a reported generation speed, not
an input-plus-output throughput measurement or a measured P50 TPOT. The Docker
selector uses the nightly `dev` fallback; that image was not the reported test
environment.

### 3.2 Configuration Tips

* Speculative decoding (MTP) can significantly reduce latency for interactive use cases.
* **Mamba Radix Cache**: Qwen3.6's hybrid Gated Delta Networks architecture supports two mamba scheduling strategies via `--mamba-radix-cache-strategy`:
  * **V1 (`no_buffer`)**: Default. No overlap scheduler, lower memory usage.
  * **V2 (`extra_buffer`)**: Enables overlap scheduling and branching point caching with `--mamba-radix-cache-strategy extra_buffer --page-size 64`. Requires FLA kernel backend (NVIDIA GPUs only). Trades higher mamba state memory for better throughput.
* The `--mem-fraction-static` flag is recommended for optimal memory utilization, adjust it based on your hardware and workload.
* Context length defaults to 262,144 tokens. If you encounter OOM errors, consider reducing it, but maintain at least 128K to preserve thinking capabilities.
* **CUDA IPC Transport**: Pass `--mm-feature-transport cuda_ipc` to use CUDA IPC for transferring multimodal features, significantly improving TTFT (Time To First Token). Note: this consumes additional memory proportional to image size, so you may need to lower `--mem-fraction-static` or `--max-running-requests`.
* **Multimodal Attention Backend**: Use `--mm-attention-backend fa3` on H100/H200 for better vision performance, or `--mm-attention-backend fa4` on B200/B300.
* For processing large images or videos, you may need to lower `--mem-fraction-static` to leave room for image feature tensors.
* **Ascend NPU (Atlas 800I A3):** Each card has 2 dies, so `--tp-size` is twice the card count (1 card → `--tp-size 2`). Add `--attention-backend ascend --device npu` and `--mamba-ssm-dtype bfloat16`, run speculative decoding with the built-in MTP weights via `--speculative-algorithm NEXTN`. See [Deploying on Ascend NPUs](#ascend-npu-deployment) below.
* Hardware requirements for the GPU recipes:
  * **35B-A3B BF16**: \~70GB for weights. TP=1 fits on all supported hardware.
  * **35B-A3B FP8**: \~35GB for weights. TP=1 fits on all supported hardware.
  * **35B-A3B NVFP4**: \~23GB for weights. TP=1 fits on B200/B300 and RTX Spark.
  * **27B BF16**: \~54GB for weights. TP=1 fits on all supported hardware.
  * **27B FP8**: \~27GB for weights. TP=1 fits on all supported hardware.
  * **27B NVFP4**: \~22GB for weights. TP=1 fits on B200/B300.

All Qwen3.6 variants (MoE 35B-A3B and Dense 27B) fit on a single supported GPU. The table below covers B200/B300 NVFP4; the 35B-A3B RTX Spark recipe is provided above:

<table>
  <thead>
    <tr>
      <th>Hardware</th>
      <th>Memory</th>
      <th>BF16 TP</th>
      <th>FP8 TP</th>
      <th>NVFP4 TP</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>H100</td>
      <td>80GB</td>
      <td>1</td>
      <td>1</td>
      <td>—</td>
    </tr>

    <tr>
      <td>H200</td>
      <td>141GB</td>
      <td>1</td>
      <td>1</td>
      <td>—</td>
    </tr>

    <tr>
      <td>B200</td>
      <td>183GB</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
    </tr>

    <tr>
      <td>B300</td>
      <td>275GB</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
    </tr>
  </tbody>
</table>

* **Xeon CPU service configuration:** Please refer to the `Notes` part in the serving engine launching section in [the SGLang CPU server document](https://docs.sglang.io/docs/hardware-platforms/cpu_server.md#launch-of-the-serving-engine) to better understand how to configure the arguments, especially for TP (tensor parallel) and NUMA binding settings.

Referenced by the configuration tips above. Verify before removing.

### 3.3 Deploying on Ascend NPUs (Atlas 800I A3)

The Ascend model tutorials document support for [Qwen3.6-27B](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/tutorials/qwen3_6_27b.md) and [Qwen3.6-35B-A3B](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/tutorials/qwen3_6_35b_a3b.md) starting with SGLang v0.5.16. The generator provides a baseline for single-node deployment with prefill and decode on the same node (PD mixed mode). Use the complete scenario recipes below for workload-specific tuning.

Launch a compatible container using the [Ascend NPU quickstart](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/getting-started/quick_start.md), including its driver, firmware, and runtime mounts, then run the generated `sglang serve` command inside it. Select the device IDs for your cards: one A3 card exposes two dies. For example, a 1-card deployment using dies 0 and 1 needs `--device /dev/davinci0 --device /dev/davinci1`, together with the management devices and mounts in the quickstart.

**Weights:** BF16 checkpoints are available from [Qwen](https://huggingface.co/Qwen) and mirrored on ModelScope. To download from ModelScope, install the `modelscope` Python package and set `SGLANG_USE_MODELSCOPE=1`. Alternatively, pre-download the weights and set `--model-path` to their local directory.

The generator offers the following card counts. Weight sizes exclude KV cache, Mamba state, and runtime buffers; choose capacity and concurrency for your workload.

<table>
  <thead>
    <tr>
      <th>Model</th>
      <th>Checkpoint</th>
      <th>Weights</th>
      <th>1 card (TP 2)</th>
      <th>2 cards (TP 4)</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>Qwen3.6-27B</td>
      <td>[Qwen/Qwen3.6-27B](https://huggingface.co/Qwen/Qwen3.6-27B)</td>
      <td>\~54 GB (BF16)</td>
      <td>Available</td>
      <td>Available</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B</td>
      <td>[Qwen/Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B)</td>
      <td>\~70 GB (BF16)</td>
      <td>Available</td>
      <td>Available</td>
    </tr>
  </tbody>
</table>

**Published scenario references (PD mixed, single node):**

The TPOT values below are reproduced from the linked Ascend best-practice pages. They describe those pages' full configurations and workloads, not measurements of the generator's baseline command. Follow each scenario's host tuning, environment variables, launch flags, and benchmark command when reproducing it.

<table>
  <thead>
    <tr>
      <th>Model</th>
      <th>Cards</th>
      <th>Quantization</th>
      <th>Dataset</th>
      <th>Source TPOT</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>Qwen3.6-27B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[1024x1024 (30)+1024](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_27b.md#qwen3-6-27b-1p-in1024x1024-30-out1024-50ms)</td>
      <td>50ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-27B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[1080p\_30+256](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_27b.md#qwen3-6-27b-1p-in1080p-30-out256-50ms)</td>
      <td>50ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-27B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[64k+1k (90% prefix cache hit rate)](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_27b.md#qwen3-6-27b-1p-in64k-out1k-prefix90-50ms)</td>
      <td>50ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[254k+1k](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_35b_a3b.md#qwen3-6-35b-a3b-1p-in254k-out1k-16-1ms)</td>
      <td>16.1ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[3.5k+1.5k](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_35b_a3b.md#qwen3-6-35b-a3b-1p-in3k5-out1k5-50ms)</td>
      <td>50ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[64k+1k](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_35b_a3b.md#qwen3-6-35b-a3b-1p-in64k-out1k-50ms)</td>
      <td>50ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[64k+1k (90% prefix cache hit rate)](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_35b_a3b.md#qwen3-6-35b-a3b-1p-in64k-out1k-prefix90-50ms)</td>
      <td>50ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[128k+1k](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_35b_a3b.md#qwen3-6-35b-a3b-1p-in128k-out1k-50ms)</td>
      <td>50ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[128k+1k (90% prefix cache hit rate)](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_35b_a3b.md#qwen3-6-35b-a3b-1p-in128k-out1k-prefix90-50ms)</td>
      <td>50ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[1024x1024 (30)+1024](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_35b_a3b.md#qwen3-6-35b-a3b-1p-in1024x1024-30-out1024-50ms)</td>
      <td>50ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B</td>
      <td>1</td>
      <td>BF16</td>
      <td>[1080p\_30+256](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_35b_a3b.md#qwen3-6-35b-a3b-1p-in1080p-30-out256-50ms)</td>
      <td>50ms</td>
    </tr>

    <tr>
      <td>Qwen3.6-35B-A3B</td>
      <td>2</td>
      <td>BF16</td>
      <td>[984k+1k](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_35b_a3b.md#qwen3-6-35b-a3b-2p-in984k-out1k-40-91ms)</td>
      <td>40.91ms</td>
    </tr>
  </tbody>
</table>

See the [27B best practices](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_27b.md) and [35B-A3B best practices](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/model-deployment/best-practices/qwen3_6_35b_a3b.md) for the full scenario lists.

> [!NOTE]
>
> * Multimodal serving on A3 additionally enables `--enable-multimodal --mm-attention-backend ascend_attn`; see the image-input best-practice scenarios for the full flag set.
> * The generator leaves the NPU Mamba cache strategy to the installed SGLang version. Ascend prefix-cache recipes use `--mamba-radix-cache-strategy extra_buffer`; copy the complete matching recipe when enabling prefix caching.
> * Use a version-matched Ascend stack and check output quality with the [accuracy evaluation guide](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/evaluation/accuracy_evaluation.md) before [performance testing](https://docs.sglang.io/docs/hardware-platforms/ascend-npus/evaluation/performance_testing.md). Successful checkpoint loading alone does not establish generation accuracy.

## 4. Model Invocation

Deploy Qwen3.6 with the following command (H200, all features enabled). Swap `--model-path` to `Qwen/Qwen3.6-27B-FP8` for the dense 27B variant — all other flags carry over:

```shell Command theme={null}
sglang serve \
  --model-path Qwen/Qwen3.6-35B-A3B-FP8 \
  --reasoning-parser qwen3 \
  --tool-call-parser qwen3_coder \
  --speculative-algorithm EAGLE \
  --speculative-num-steps 3 \
  --speculative-eagle-topk 1 \
  --speculative-num-draft-tokens 4 \
  --mem-fraction-static 0.8 \
  --host 0.0.0.0 \
  --port 30000
```

### 4.1 Basic Usage

For basic API usage and request examples, please refer to:

* [SGLang Basic Usage Guide](https://docs.sglang.io/docs/basic_usage/send_request.md)

### 4.2 Vision Input

Qwen3.6 supports image and video inputs as a unified vision-language model.

**Image Input Example:**

```python Example theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:30000/v1",
    api_key="EMPTY"
)

response = client.chat.completions.create(
    model="Qwen/Qwen3.6-35B-A3B-FP8",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/CI_Demo/mathv-1327.jpg"
                    }
                },
                {
                    "type": "text",
                    "text": "Describe this image in detail."
                }
            ]
        }
    ],
    max_tokens=2048,
    stream=True
)

thinking_started = False
has_thinking = False
has_answer = False

for chunk in response:
    if chunk.choices and len(chunk.choices) > 0:
        delta = chunk.choices[0].delta

        if hasattr(delta, 'reasoning_content') and delta.reasoning_content:
            if not thinking_started:
                print("=============== Thinking =================", flush=True)
                thinking_started = True
            has_thinking = True
            print(delta.reasoning_content, end="", flush=True)

        if delta.content:
            if has_thinking and not has_answer:
                print("\n=============== Content =================", flush=True)
                has_answer = True
            print(delta.content, end="", flush=True)

print()
```

**Video Input Example:**

```python Example theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:30000/v1",
    api_key="EMPTY"
)

response = client.chat.completions.create(
    model="Qwen/Qwen3.6-35B-A3B-FP8",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/video/N1cdUjctpG8.mp4"
                    }
                },
                {
                    "type": "text",
                    "text": "Describe what happens in this video."
                }
            ]
        }
    ],
    max_tokens=2048,
    stream=True
)

thinking_started = False
has_thinking = False
has_answer = False

for chunk in response:
    if chunk.choices and len(chunk.choices) > 0:
        delta = chunk.choices[0].delta

        if hasattr(delta, 'reasoning_content') and delta.reasoning_content:
            if not thinking_started:
                print("=============== Thinking =================", flush=True)
                thinking_started = True
            has_thinking = True
            print(delta.reasoning_content, end="", flush=True)

        if delta.content:
            if has_thinking and not has_answer:
                print("\n=============== Content =================", flush=True)
                has_answer = True
            print(delta.content, end="", flush=True)

print()
```

### 4.3 Advanced Usage

#### 4.3.1 Reasoning Parser

Qwen3.6 supports Thinking mode **by default**. Enable the reasoning parser during deployment to separate the thinking and content sections. The thinking process is returned via `reasoning_content` in the streaming response.

To disable thinking and use Instruct mode, pass `chat_template_kwargs` at request time:

* **Thinking mode** (default): The model performs step-by-step reasoning before answering. No extra parameters needed.
* **Instruct mode** (`{"enable_thinking": false}`): The model responds directly without a thinking process.

**Example 1: Thinking Mode (Default)**

```python Example theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:30000/v1",
    api_key="EMPTY"
)

response = client.chat.completions.create(
    model="Qwen/Qwen3.6-35B-A3B-FP8",
    messages=[
        {"role": "user", "content": "Solve this problem step by step: What is 15% of 240?"}
    ],
    max_tokens=2048,
    stream=True
)

has_thinking = False
has_answer = False
thinking_started = False

for chunk in response:
    if chunk.choices and len(chunk.choices) > 0:
        delta = chunk.choices[0].delta

        if hasattr(delta, 'reasoning_content') and delta.reasoning_content:
            if not thinking_started:
                print("=============== Thinking =================", flush=True)
                thinking_started = True
            has_thinking = True
            print(delta.reasoning_content, end="", flush=True)

        if delta.content:
            if has_thinking and not has_answer:
                print("\n=============== Content =================", flush=True)
                has_answer = True
            print(delta.content, end="", flush=True)

print()
```

**Example 2: Instruct Mode (Thinking Off)**

To disable thinking and get a direct response, pass `{"enable_thinking": false}` via `chat_template_kwargs`:

```python Example theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:30000/v1",
    api_key="EMPTY"
)

response = client.chat.completions.create(
    model="Qwen/Qwen3.6-35B-A3B-FP8",
    messages=[
        {"role": "user", "content": "What is 15% of 240?"}
    ],
    extra_body={"chat_template_kwargs": {"enable_thinking": False}},
    max_tokens=2048,
    stream=True
)

for chunk in response:
    if chunk.choices and len(chunk.choices) > 0:
        delta = chunk.choices[0].delta
        if delta.content:
            print(delta.content, end="", flush=True)

print()
```

#### 4.3.2 Thinking Preservation

Qwen3.6 has been trained to preserve and leverage thinking traces from historical messages. Enable this for agent scenarios where maintaining full reasoning context improves decision consistency:

```python Example theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:30000/v1",
    api_key="EMPTY"
)

response = client.chat.completions.create(
    model="Qwen/Qwen3.6-35B-A3B-FP8",
    messages=[
        {"role": "user", "content": "Help me plan a web app architecture."}
    ],
    extra_body={"chat_template_kwargs": {"preserve_thinking": True}},
    max_tokens=2048,
    stream=True
)

thinking_started = False
has_thinking = False
has_answer = False

for chunk in response:
    if chunk.choices and len(chunk.choices) > 0:
        delta = chunk.choices[0].delta

        if hasattr(delta, 'reasoning_content') and delta.reasoning_content:
            if not thinking_started:
                print("=============== Thinking =================", flush=True)
                thinking_started = True
            has_thinking = True
            print(delta.reasoning_content, end="", flush=True)

        if delta.content:
            if has_thinking and not has_answer:
                print("\n=============== Content =================", flush=True)
                has_answer = True
            print(delta.content, end="", flush=True)

print()
```

#### 4.3.3 Tool Calling

Qwen3.6 supports tool calling capabilities. Enable the tool call parser during deployment.

```python Example theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:30000/v1",
    api_key="EMPTY"
)

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get the current weather for a location",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {
                        "type": "string",
                        "description": "The city name"
                    },
                    "unit": {
                        "type": "string",
                        "enum": ["celsius", "fahrenheit"],
                        "description": "Temperature unit"
                    }
                },
                "required": ["location"]
            }
        }
    }
]

response = client.chat.completions.create(
    model="Qwen/Qwen3.6-35B-A3B-FP8",
    messages=[
        {"role": "user", "content": "What's the weather in Beijing?"}
    ],
    tools=tools,
    stream=True
)

thinking_started = False
has_thinking = False

for chunk in response:
    if chunk.choices and len(chunk.choices) > 0:
        delta = chunk.choices[0].delta

        if hasattr(delta, 'reasoning_content') and delta.reasoning_content:
            if not thinking_started:
                print("=============== Thinking =================", flush=True)
                thinking_started = True
            has_thinking = True
            print(delta.reasoning_content, end="", flush=True)

        if hasattr(delta, 'tool_calls') and delta.tool_calls:
            if has_thinking and thinking_started:
                print("\n=============== Content =================", flush=True)
                thinking_started = False

            for tool_call in delta.tool_calls:
                if tool_call.function:
                    print(f"Tool Call: {tool_call.function.name}")
                    print(f"   Arguments: {tool_call.function.arguments}")

        if delta.content:
            print(delta.content, end="", flush=True)

print()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.