> ## 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-Plus

> 通过 AnyFast OpenAI 兼容接口调用 Qwen3.7-Plus 支持视觉理解的多模态模型。

Qwen3.7-Plus 是阿里巴巴 Qwen3.7 系列的多模态 Plus 模型，通过 AnyFast 的 OpenAI 兼容 Chat Completions 接口 `POST /v1/chat/completions` 提供服务。使用模型 ID `qwen3.7-plus`，可进行文本生成、图片和视频理解、函数调用及结构化输出。

## 核心能力

* **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-plus",
  "messages": [
    {
      "role": "user",
      "content": "用一句话解释日食。"
    }
  ],
  "max_completion_tokens": 1024,
  "enable_thinking": false
}'
```

```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-plus",
    messages=[{"role": "user", "content": "用一句话解释日食。"}],
    max_completion_tokens=1024,
    extra_body={"enable_thinking": False},
)
print(response.choices[0].message.content)
```

## 图片和视频输入

使用 `image_url` 内容部分传入图片。图片和视频内容部分均已通过 AnyFast 对 `qwen3.7-plus` 的调用验证。请使用可公开访问的 HTTPS URL 或受支持的数据 URI；上游媒体限制见[视觉理解文档](https://help.aliyun.com/en/model-studio/vision-model/)。

```python Python theme={null}
response = client.chat.completions.create(
    model="qwen3.7-plus",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "描述这张图片。"},
            {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}},
        ],
    }],
    max_completion_tokens=300,
    extra_body={"enable_thinking": False},
)
print(response.choices[0].message.content)
```

若输入视频，将 `image_url` 内容部分替换为 `{"type": "video_url", "video_url": {"url": "https://example.com/sample.mp4"}}`。视频 URL 需要指向可访问的文件。

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

默认启用思考模式。设置 `enable_thinking: false` 可关闭思考；使用 OpenAI SDK 时，应通过 `extra_body` 传递此扩展字段。对 `qwen3.7-plus` 的非思考模式 `json_object` 请求已在 AnyFast 成功返回。

```python Python theme={null}
response = client.chat.completions.create(
    model="qwen3.7-plus",
    messages=[{"role": "user", "content": "返回包含 answer 字段的 JSON 对象。"}],
    response_format={"type": "json_object"},
    extra_body={"enable_thinking": False},
)
print(response.choices[0].message.content)
```

## 函数调用

在 `tools` 中定义函数。模型返回 `finish_reason: "tool_calls"` 和 `message.tool_calls` 后，由应用执行函数并继续对话。以下请求结构已通过 AnyFast 验证。使用 `tool_choice: "required"` 可以强制调用工具。

```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-plus",
    messages=[{"role": "user", "content": "调用 get_weather 查询新加坡的天气。"}],
    tools=tools,
    tool_choice="required",
    extra_body={"enable_thinking": False},
)
print(response.choices[0].message.tool_calls)
```

## 流式输出

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

```python Python theme={null}
stream = client.chat.completions.create(
    model="qwen3.7-plus",
    messages=[{"role": "user", "content": "简短问候。"}],
    stream=True,
    stream_options={"include_usage": True},
    extra_body={"enable_thinking": False},
)
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-plus`。 |
| `messages` | array | 是 | 对话消息；支持文本、图片或视频内容部分。 |
| `max_completion_tokens` | integer | 否 | 最大生成 Token 数；上游上限为 131,072。 |
| `enable_thinking` | boolean | 否 | 默认开启；false 可关闭思考。 |
| `stream` | boolean | 否 | 为 true 时返回 Server-Sent Events。 |
| `stream_options` | object | 否 | 设置 `include_usage: true`，在最后一个流式数据块中获取用量。 |
| `tools` | array | 否 | 可供模型调用的函数定义。 |
| `tool_choice` | string | 否 | 已验证 `required`；还可使用 `auto` 或 `none`。 |
| `response_format` | object | 否 | 在关闭思考模式时已验证 `json_object`。 |

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

## 官方参考

* [阿里云 Qwen3.7-Plus 模型说明](https://help.aliyun.com/en/model-studio/qwen3-7-plus)
* [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.