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

# 千问

> 阿里通义千问 Qwen 系列：可用型号、调用示例与计费方式。

阿里通义千问 Qwen 系列，支持深度思考、图片理解，上下文最长 100 万 token。

* 接口：`POST https://token.poryf.com/v1/chat/completions`（OpenAI 格式），字段说明见 [创建对话](https://docs.token.poryf.com/api/chat.md)
* 在线试用需要登录，按自己的余额扣费

## 可用型号

| 模型 ID | 说明 | 链接 |
| - | - | - |
| `qwen3.8-max` | 最新旗舰，编程、Agent 与复杂推理 | [价格](https://token.poryf.com/pricing/qwen3.8-max) · [试用](https://token.poryf.com/model-guide/qwen3.8-max) |
| `qwen3.7-plus` | 均衡款，按输入长度分档 | [价格](https://token.poryf.com/pricing/qwen3.7-plus) · [试用](https://token.poryf.com/model-guide/qwen3.7-plus) |
| `qwen3.8-flash` | 轻量版，速度快、价格低 | [价格](https://token.poryf.com/pricing/qwen3.8-flash) · [试用](https://token.poryf.com/model-guide/qwen3.8-flash) |

型号会随渠道调整增减，以 [模型广场](https://token.poryf.com/pricing) 和 [GET /v1/models](https://docs.token.poryf.com/api/list-models.md) 为准。

## 调用示例

```bash curl theme={null}
curl https://token.poryf.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.8-flash",
    "messages": [
      { "role": "user", "content": "用三句话介绍一下你自己" }
    ],
    "max_tokens": 2048
  }'
```

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

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://token.poryf.com/v1",
)

response = client.chat.completions.create(
    model="qwen3.8-flash",
    messages=[{"role": "user", "content": "用三句话介绍一下你自己"}],
    max_tokens=2048,
)
print(response.choices[0].message.content)
```

换成其他型号，只需替换 `model`。需要逐字输出时加 `"stream": true`，见 [流式输出](https://docs.token.poryf.com/streaming.md)。

## 思考模式

三个型号默认开启思考，思考过程在 `reasoning_content` 字段返回，思考 token 按输出计费。

* 关闭思考：传 `enable_thinking: false`、`reasoning_effort: "none"` 或 `thinking: {"type": "disabled"}` 任一即可，简单任务关闭后更快、更省。
* 调节思考强度：`reasoning_effort` 取 `minimal`、`low`、`medium`、`high`。

## 长输出请用流式

开启思考后，长文、长代码等请求可能要生成好几分钟。非流式请求（`stream: false`）生成超过 5 分钟会返回 504，这次请求不扣费。预计输出较长时请传 `stream: true`；也可以关闭思考或降低 `reasoning_effort` 来缩短耗时。

## 计费

* 按输入、输出、缓存命中 token 分别计价。重复的长前缀会自动命中缓存，按缓存命中价计费。
* `qwen3.8-max`、`qwen3.8-flash` 只有一档单价。
* `qwen3.7-plus` 按输入长度分档：输入不超过 256K token 一档，超过 256K 一档。

实时单价见 [模型广场](https://token.poryf.com/pricing)，每次调用的实际用量与扣费见 [使用日志](https://token.poryf.com/usage-logs/common)。

> [!NOTE]
>
> * `max_tokens` 包含思考过程。推理型号设得太小时，额度可能全部用于思考，`content` 为空。
> * 本站文本模型目前不支持在对话中识别图片。


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