Qwen 3.7 API
Alibaba 提供支持的 Qwen 3.7 LLM 模型完整 API 参考。
模型变体
此 API 支持四个 Qwen 3.7 模型变体:
快速对比
Qwen 3.7 Max Text to Text
端点
POST /api/v1/chat/completions
请求参数
必填
消息支持
可选
示例请求
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'qwen-3.7-max-text-to-text',
messages: [
{
role: 'user',
content: 'Explain the concept of attention mechanisms in neural networks.'
}
],
stream: true,
max_tokens: 2048
})
});
Qwen 3.7 Plus Text to Text
端点
POST /api/v1/chat/completions
请求参数
必填
消息支持
可选
示例请求
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'qwen-3.7-plus-text-to-text',
messages: [
{
role: 'user',
content: 'Explain the concept of attention mechanisms in neural networks.'
}
],
stream: true,
max_tokens: 2048
})
});
Qwen 3.7 Max Web Search
端点
POST /api/v1/chat/completions
请求参数
必填
消息支持
可选
示例请求
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'qwen-3.7-max-web-search',
messages: [
{
role: 'user',
content: 'What are the latest developments in quantum computing this year?'
}
],
stream: true,
max_tokens: 2048
})
});
Qwen 3.7 Plus Web Search
端点
POST /api/v1/chat/completions
请求参数
必填
消息支持
可选
示例请求
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'qwen-3.7-plus-web-search',
messages: [
{
role: 'user',
content: 'What are the latest developments in quantum computing this year?'
}
],
stream: true,
max_tokens: 2048
})
});
响应格式
Qwen 3.7 LLM 模型返回 OpenAI 兼容的 completion 响应。使用 stream: true 时,响应为 Server-Sent Events;使用 stream: false 时,响应为单个 JSON 对象。
成功响应
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"qwen-3.7-max-text-to-text","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"qwen-3.7-max-text-to-text","choices":[{"index":0,"delta":{"content":"Here is a concise explanation"},"finish_reason":null}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"qwen-3.7-max-text-to-text","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"qwen-3.7-max-text-to-text","choices":[],"usage":{"prompt_tokens":12,"completion_tokens":8,"total_tokens":20}}
data: [DONE]
错误响应
event: error
data: {"error":{"message":"API requests too frequent, exceeding rate limit","type":"rate_limit_error","code":"1302","param":null}}
最佳实践
- 使用结构化消息: 通过
messages[] 发送对话历史,而不是把上下文压平成一个 prompt。
- 选择合适的变体: 复杂推理任务用 Max,快速且高性价比的响应使用 Plus。需要最新信息时使用 Web Search 变体。
- 消费 SSE 事件: 流式展示时追加
choices[0].delta.content,并将 data: [DONE] 视为成功完成。
- 仅发送支持的输入: Qwen 3.7 模型仅支持文本,不支持文件或图像附件。