Qwen 3.8 Max API
由阿里巴巴提供支援的 Qwen 3.8 Max 大型語言模型完整 API 參考。
模型變體
此 API 支援兩種 Qwen 3.8 Max 模型變體:
快速比較
Qwen 3.8 Max 文字轉文字
端點
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.8-max-text-to-text',
messages: [
{
role: 'user',
content: 'Explain the concept of attention mechanisms in neural networks.'
}
],
stream: true,
max_tokens: 2048
})
});
Qwen 3.8 Max 網路搜尋
端點
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.8-max-web-search',
messages: [
{
role: 'user',
content: 'What are the latest developments in quantum computing this year?'
}
],
stream: true,
max_tokens: 2048
})
});
回應格式
Qwen 3.8 Max 大型語言模型會傳回與 OpenAI 相容的補全回應。當 stream: true 時,回應採用 Server-Sent Events;當 stream: false 時,回應為單一 JSON 物件。
成功回應
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"qwen-3.8-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.8-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.8-max-text-to-text","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"qwen-3.8-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[] 傳送對話記錄,而不是將上下文合併為單一提示詞。
- 選擇合適的變體: 推理與生成任務使用文字轉文字;需要最新資訊時使用網路搜尋。
- 處理 SSE 事件: 附加
choices[0].delta.content 以串流顯示內容,並將 data: [DONE] 視為成功完成。
- 僅傳送支援的輸入: Qwen 3.8 Max 模型僅支援文字,不支援檔案或圖片附件。