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

# Grok 4.20 0309 Reasoning

> Grok 4.20 0309 Reasoning：面向複雜問題求解的推理模型。包含 MixRoute 呼叫範例與參數。

Grok 4.20 0309 Reasoning 是 xAI 推出的面向複雜問題求解的推理模型。

可使用下方端點透過 MixRoute 呼叫 `grok-4.20-0309-reasoning`。

## 核心能力

* OpenAI 相容 - 修改 base\_url 即可使用 OpenAI SDK
* 串流輸出 - 透過 SSE 即時返回 token
* 多輪對話 - 使用帶 role 的 messages

## 快速範例

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/chat/completions" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "grok-4.20-0309-reasoning",
      "messages": [
        {
          "role": "user",
          "content": "Explain quantum entanglement in simple terms."
        }
      ],
      "max_tokens": 256
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    response = client.chat.completions.create(
        model="grok-4.20-0309-reasoning",
        messages=[{"role": "user", "content": "Explain quantum entanglement in simple terms."}],
        max_tokens=256,
    )

    print(response.choices[0].message.content)
    ```
  </Tab>

  <Tab title="Streaming">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    stream = client.chat.completions.create(
        model="grok-4.20-0309-reasoning",
        messages=[{"role": "user", "content": "Write a short poem about the sea."}],
        max_tokens=256,
        stream=True,
    )

    for chunk in stream:
        print(chunk.choices[0].delta.content or "", end="")
    ```
  </Tab>
</Tabs>

## 參數

| 參數            | 類型              | 必填 | 說明                              |
| ------------- | --------------- | -- | ------------------------------- |
| `model`       | string          | 是  | 固定為 `grok-4.20-0309-reasoning`。 |
| `messages`    | array           | 是  | 包含 role 與 content 的對話訊息。        |
| `max_tokens`  | integer         | 否  | 最大生成 token 數。                   |
| `stream`      | boolean         | 否  | 啟用 SSE 串流輸出，預設 false。           |
| `temperature` | number          | 否  | 模型支援時用於控制取樣隨機性。                 |
| `top_p`       | number          | 否  | 模型支援時使用的核取樣閾值。                  |
| `stop`        | string \| array | 否  | 觸發停止生成的序列。                      |
| `tools`       | array           | 否  | OpenAI 相容工具定義。                  |
