Qwen 3.7 API
Riferimento API completo per i modelli LLM Qwen 3.7 basati su Alibaba.
Varianti del modello
Questa API supporta quattro varianti del modello Qwen 3.7:
Confronto rapido
Qwen 3.7 Max Text to Text
Punto di accesso
POST /api/v1/chat/completions
Parametri della richiesta
Obbligatorio
Supporto messaggi
Opzionale
Richiesta di esempio
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
Punto di accesso
POST /api/v1/chat/completions
Parametri della richiesta
Obbligatorio
Supporto messaggi
Opzionale
Richiesta di esempio
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
Punto di accesso
POST /api/v1/chat/completions
Parametri della richiesta
Obbligatorio
Supporto messaggi
Opzionale
Richiesta di esempio
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
Punto di accesso
POST /api/v1/chat/completions
Parametri della richiesta
Obbligatorio
Supporto messaggi
Opzionale
Richiesta di esempio
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
})
});
Formato della risposta
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.
Risposta riuscita
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]
Risposta di errore
event: error
data: {"error":{"message":"API requests too frequent, exceeding rate limit","type":"rate_limit_error","code":"1302","param":null}}
Best practice
- Usa messaggi strutturati: Invia la cronologia della conversazione tramite
messages[] invece di appiattire il contesto in un solo prompt.
- Scegli la variante corretta: Usa Max per attività di ragionamento complesse e Plus per risposte rapide e convenienti. Usa le varianti Web Search quando servono informazioni aggiornate.
- Consuma gli eventi SSE: Aggiungi
choices[0].delta.content per la visualizzazione in streaming e considera data: [DONE] come completamento riuscito.
- Invia solo input supportati: I modelli Qwen 3.7 sono solo testuali e non supportano allegati file o immagini.