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 models return OpenAI-compatible completion responses. With stream: true, the response is Server-Sent Events; with stream: false, the response is a single JSON object.
成功回應
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 模型僅支援文字,不支援檔案或圖片附件。