Qwen4-Max 是通义千问新一代旗舰多模态模型,融合文本生成、图片与视频理解及深度思考能力,适用于编程开发、办公、前端设计与复杂智能体任务。模型支持联网搜索、工具调用和结构化输出,兼容 OpenAI 与 Anthropic API,帮助开发者构建具备多模态理解与任务执行能力的智能应用,阿里云百炼提供免费100万Tokens 👉️ https://www.aliyun.com/product/bailian 如下图:

Qwen4-Max模型功能
| 前缀补全 | ✅ | 函数调用 | ✅ |
|---|---|---|---|
| 缓存 | ✅ | 结构化输出 | ✅ |
| 批量任务 | ❌ | 联网搜索 | ✅ |
| 微调 | ❌ |
模型收费价格
Qwen4-Max模型输入输出价格表:
| 输入 | ¥10 /M tokens | 输出 | ¥30 /M tokens |
|---|---|---|---|
| 输入(缓存命中) | ¥0.5 /M tokens | 输入(Batch File) | ¥5 /M tokens |
| 输出(Batch File) | ¥15 /M tokens | 5分钟显式缓存创建 | ¥12.5 /M tokens |
| 1小时显式缓存创建 | ¥20 /M tokens | 显式缓存命中 | ¥0.5 /M tokens |
| 输入(Batch Chat) | ¥10 /M tokens | 输出(Batch Chat) | ¥30 /M tokens |
内置工具收费价格表:
| 内置工具 | 标识 | 价格 |
|---|---|---|
| 代码解释器 | code_interpreter | 免费 |
| 以文搜图 | t2i_search | ¥24 /K调用 |
| 联网搜索 | web_search | ¥4 /K调用 |
| 以图搜图 | i2i_search | ¥48 /K调用 |
| 网页抓取 | web_extractor | 免费 |
| web_fetch | web_fetch | 免费 |
| web_search | web_search | ¥4 /K调用 |
更多关于Qwen4-Max的精准报价,请移步到阿里云百炼AI模型平台查看 💰 https://t.aliyun.com/U/fPVHqY 有详细的精准报价,目前Qwen4-Max模型可以免费100万Tokens试用,如下图:

速率限制与上下文

API 参考
OpenAI
Python:
from openai import OpenAI
import os
client = OpenAI(
# 如果没有配置环境变量,请用阿里云百炼API Key替换:api_key="sk-xxx"
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://cn-beijing.maas.qianwenaiapi.com/compatible-mode/v1",
)
messages = [{"role": "user", "content": "你是谁"}]
completion = client.chat.completions.create(
model="qwen4-max", # 您可以按需更换为其它深度思考模型
messages=messages,
extra_body={"enable_thinking": True},
stream=True
)
is_answering = False # 是否进入回复阶段
print("\n" + "=" * 20 + "思考过程" + "=" * 20)
for chunk in completion:
if not chunk.choices:
continue
delta = chunk.choices[0].delta
if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None:
if not is_answering:
print(delta.reasoning_content, end="", flush=True)
if hasattr(delta, "content") and delta.content:
if not is_answering:
print("\n" + "=" * 20 + "完整回复" + "=" * 20)
is_answering = True
print(delta.content, end="", flush=True)
Node.js:
import OpenAI from "openai";
import process from 'process';
// 初始化 openai 客户端
const openai = new OpenAI({
apiKey: process.env.DASHSCOPE_API_KEY, // 从环境变量读取
baseURL: 'https://cn-beijing.maas.qianwenaiapi.com/compatible-mode/v1'
});
let isAnswering = false;
async function main() {
try {
const messages = [{ role: 'user', content: '你是谁' }];
const stream = await openai.chat.completions.create({
model: 'qwen4-max',
messages,
stream: true,
enable_thinking: true
});
console.log('\n' + '='.repeat(20) + '思考过程' + '='.repeat(20));
for await (const chunk of stream) {
if (!chunk.choices || chunk.choices.length === 0) continue;
const delta = chunk.choices[0].delta;
if (delta.reasoning_content !== undefined && delta.reasoning_content !== null) {
if (!isAnswering) {
process.stdout.write(delta.reasoning_content);
}
}
if (delta.content !== undefined && delta.content) {
if (!isAnswering) {
console.log('\n' + '='.repeat(20) + '完整回复' + '='.repeat(20));
isAnswering = true;
}
process.stdout.write(delta.content);
}
}
} catch (error) {
console.error('Error:', error);
}
}
main();
cURL:
curl -X POST https://cn-beijing.maas.qianwenaiapi.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen4-max",
"messages": [
{
"role": "user",
"content": "你是谁"
}
],
"stream": true,
"enable_thinking": true
}'
已收费