qwen4-max 是 Qwen4 旗舰,默认开启深度思考(low、high、xhigh),上下文 1M token,最多输出 256K token。可读文本、16MP 以内图像和 2 小时以内视频,适合多文件重构、缺陷定位、全栈交付和长时智能体任务。
鉴权
- Base URL
https://api.dreamto.ai- Authorization
Authorization: Bearer YOUR_API_KEY- Content-Type
application/json- 模型名 (model)
qwen4-max
接入协议
为什么选这个协议
适合已有 OpenAI SDK、Chat Completions 代码或统一网关接入的用户。
接口地址
POST/v1/chat/completions
Authorization: Bearer YOUR_API_KEYContent-Type: application/json请求 / 响应 JSON
请求
{
"n": 1,
"model": "qwen4-max",
"top_p": 0.95,
"stream": false,
"messages": [
{
"role": "user",
"content": "你好,世界"
}
],
"thinking": {
"type": "enabled"
},
"max_tokens": 4096,
"temperature": 1,
"presence_penalty": 0,
"frequency_penalty": 0
}响应
{
"id": "chatcmpl_example",
"model": "qwen4-max",
"usage": {
"total_tokens": 24,
"prompt_tokens": 8,
"completion_tokens": 16
},
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "你好,世界"
},
"finish_reason": "stop"
}
],
"created": 1710000000
}请求字段 / 响应字段
请求字段
| 字段 | 类型 | 必填 | 默认 | 可选值 / 范围 | 说明 | 示例 |
|---|---|---|---|---|---|---|
| messages | array | Y | - | - | OpenAI 兼容聊天消息数组。 | [{"role":"user","content":"你好,世界"}] |
| temperature | number | N | 1 | - | 控制随机性;越低越稳定。 | 1 |
| top_p | number | N | 0.95 | - | 核采样概率阈值。 | 0.95 |
| max_tokens | integer | N | - | - | 限制本次响应的最大输出长度。 | 4096 |
| stream | boolean | N | false | - | 是否使用流式响应。 | false |
| presence_penalty | number | N | 0 | - | 惩罚重复的主题 | 0 |
| frequency_penalty | number | N | 0 | - | 惩罚重复的词句 | 0 |
| n | number | N | 1 | - | 每次回复1 | 1 |
| thinking | object | N | {"type":"enabled"} | - | 思考模式 | {"type":"enabled"} |
响应字段
| 字段 | 类型 | 必填 | 默认 | 可选值 / 范围 | 说明 | 示例 |
|---|---|---|---|---|---|---|
| id | string | N | - | - | 本次请求的响应标识。 | chatcmpl_example |
| model | string | N | - | - | 实际响应的模型名称。 | qwen4-max |
| choices[].message.content | string | N | - | - | 模型生成的主要文本内容。 | 你好,世界 |
| usage.prompt_tokens | integer | N | - | - | 请求输入消耗的 token 数。 | 8 |
| usage.completion_tokens | integer | N | - | - | 模型输出消耗的 token 数。 | 16 |
| usage.total_tokens | integer | N | - | - | 输入和输出合计 token 数。 | 24 |
| object | string | N | - | - | - | chat.completion |
| created | integer | N | - | - | - | 1710000000 |
| choices | array | N | - | - | - | [{"index":0,"message":{"role":"assistant","content":"你好,世界"},"finish_reason":"stop"}] |
| choices[] | object | N | - | - | - | {"index":0,"message":{"role":"assistant","content":"你好,世界"},"finish_reason":"stop"} |
| choices[].index | integer | N | - | - | - | 0 |
| choices[].message | object | N | - | - | - | {"role":"assistant","content":"你好,世界"} |
| choices[].message.role | string | N | - | - | - | assistant |
| choices[].finish_reason | string | N | - | - | - | stop |
| usage | object | N | - | - | - | {"total_tokens":24,"prompt_tokens":8,"completion_tokens":16} |
代码示例
cURLrequest.sh
curl -X POST "https://api.dreamto.ai/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen4-max",
"messages": [
{
"content": "你好,世界",
"role": "user"
}
],
"temperature": 1,
"top_p": 0.95,
"max_tokens": 4096,
"stream": false,
"presence_penalty": 0,
"frequency_penalty": 0,
"n": 1,
"thinking": {
"type": "enabled"
}
}'