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

# Qwen3.7-Max-Preview

> 通过 AnyFast OpenAI 兼容接口调用 Qwen3.7-Max-Preview 仅支持思考模式的纯文本预览模型。

Qwen3.7-Max-Preview 是阿里巴巴 Qwen3.7 Max 的纯文本预览模型，通过 AnyFast 的 OpenAI 兼容 Chat Completions 接口 `POST /v1/chat/completions` 提供服务。使用模型 ID `qwen3.7-max-preview`，可在思考模式下进行文本生成、推理和函数调用。

## 核心能力

* **100 万 Token 上下文窗口** — 上游规格为 1,000,000 Token。
* **最多 131,072 Token 输出** — 上游输出上限；实际可用长度取决于上下文。
* **纯文本输入** — 仅接受文本。
* **文本输出** — 返回文本响应。
* **思考模式** — 必须启用；此预览版没有非思考模式。

## 快速示例

```bash cURL theme={null}
curl --request POST \
  --url https://www.anyfast.ai/v1/chat/completions \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "qwen3.7-max-preview",
  "messages": [
    {
      "role": "user",
      "content": "用一句话解释日食。"
    }
  ],
  "max_completion_tokens": 1024,
  "enable_thinking": true
}'
```

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

client = OpenAI(api_key="YOUR_API_KEY", base_url="https://www.anyfast.ai/v1")
response = client.chat.completions.create(
    model="qwen3.7-max-preview",
    messages=[{"role": "user", "content": "用一句话解释日食。"}],
    max_completion_tokens=1024,
    extra_body={"enable_thinking": True},
)
print(response.choices[0].message.content)
```

## 输入模态

该模型仅接受文本输入并输出文本。不要向该模型发送 `image_url` 或 `video_url` 内容部分。

## 思考模式和结构化输出

该预览版仅支持思考模式。保持 `enable_thinking` 为 `true`，或省略该字段。AnyFast 对 `enable_thinking: false` 返回 HTTP 400，错误码为 `invalid_parameter_error`。

## 函数调用

在 `tools` 中定义函数。模型返回 `finish_reason: "tool_calls"` 和 `message.tool_calls` 后，由应用执行函数并继续对话。以下请求结构已通过 AnyFast 验证。此预览版在思考模式下使用 `tool_choice: "auto"` 或 `none`；`required` 会返回 HTTP 400。

```python Python theme={null}
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "查询城市天气",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]
response = client.chat.completions.create(
    model="qwen3.7-max-preview",
    messages=[{"role": "user", "content": "调用 get_weather 查询新加坡的天气。"}],
    tools=tools,
    tool_choice="auto",
    extra_body={"enable_thinking": True},
)
print(response.choices[0].message.tool_calls)
```

## 流式输出

设置 `stream=True` 以接收 SSE 数据块。已验证最后的仅用量数据块会包含 `usage`，且 `choices` 为空数组。

```python Python theme={null}
stream = client.chat.completions.create(
    model="qwen3.7-max-preview",
    messages=[{"role": "user", "content": "简短问候。"}],
    stream=True,
    stream_options={"include_usage": True},
    extra_body={"enable_thinking": True},
)
for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="")
    if chunk.usage:
        print("\nToken 用量：", chunk.usage.total_tokens)
```

## 参数说明

| 参数 | 类型 | 必填 | 说明 |
| - | - | -: | - |
| `model` | string | 是 | 精确模型 ID：`qwen3.7-max-preview`。 |
| `messages` | array | 是 | 对话消息；仅支持文本内容。 |
| `max_completion_tokens` | integer | 否 | 最大生成 Token 数；上游上限为 131,072。 |
| `enable_thinking` | boolean | 否 | 此预览版只能为 true。 |
| `stream` | boolean | 否 | 为 true 时返回 Server-Sent Events。 |
| `stream_options` | object | 否 | 设置 `include_usage: true`，在最后一个流式数据块中获取用量。 |
| `tools` | array | 否 | 可供模型调用的函数定义。 |
| `tool_choice` | string | 否 | 思考模式使用 `auto` 或 `none`。 |

> **[API 参考](https://docs.anyfast.ai/zh/api-reference/model-api/alibaba/qwen3.7-max-preview.md)**
>
> 查看 Qwen3.7-Max-Preview 的请求与响应字段。

## 官方参考

* [阿里云 Qwen3.7-Max-Preview 模型说明](https://help.aliyun.com/en/model-studio/qwen3-7-max)
* [OpenAI 兼容 Chat Completions 接口](https://help.aliyun.com/en/model-studio/qwen-api-via-openai-chat-completions)


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