Async
Send a chat completion now. Get the result within 4 hours.
1. Send the request
Set service_tier to "async". The OpenAI SDKs accept only "flex", which has the same effect.
curl https://api.qloud.sh/v1/chat/completions \
-H "Authorization: Bearer $QLOUD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "DeepSeek-V4-Flash-0731",
"service_tier": "async",
"messages": [{"role": "user", "content": "Summarise Hamlet in three sentences."}],
"max_tokens": 512
}'The API returns 202 with an id, "status": "queued" and no choices.
2. Get the result
Poll GET /v1/chat/completions/{id} until status is completed, failed or cancelled.
curl https://api.qloud.sh/v1/chat/completions/$ID \
-H "Authorization: Bearer $QLOUD_API_KEY"status | Meaning |
|---|---|
queued | Not started |
in_progress | Running |
completed | choices and usage are set |
failed | error gives the cause. Not billed. |
cancelled | Cancelled before it started |
To get a call instead of polling, use a webhook.
Cancel
curl -X DELETE https://api.qloud.sh/v1/chat/completions/$ID \
-H "Authorization: Bearer $QLOUD_API_KEY"A queued request is cancelled at no cost. A running request continues and is billed.
Retries
Send an Idempotency-Key header (max 255 characters). If you send the same key again, the API returns the first request. It does not create a second one.
Notes
- Async works on
/v1/chat/completionsand on/v1/responseswith"background": true. - Async does not support
"stream": true.