Events
GET /v1/tasks/events
Streams Server-Sent Events for all tasks created by the current Task API key.
SSE and GET /v1/tasks/{id} polling are both supported ways to observe task state. Choose the one that fits the client's connection model. When polling, start at one second, exponentially back off to ten seconds, and add a small random jitter.
The asynchronous worker is intended to run on one backend instance. Deploying multiple backend replicas does not guarantee strict global, per-user, or per-API-key concurrency limits.
bash
curl -N https://api.llmapi.site/v1/tasks/events \
-H 'Authorization: Bearer YOUR_TASK_API_KEY' \
-H 'Accept: text/event-stream'Event Format
text
event: task.updated
data: {"id":"8b17fd33b0e947a08cb417e81e9ea9da","status":"running","modality":"image","model":"gpt-image-2"}Heartbeat
text
: heartbeatSent periodically to keep the connection alive. Discard it.
After reconnecting, call GET /v1/tasks/{id} to confirm the latest task state before resuming SSE processing.
Errors
| Status | Cause |
|---|---|
401 | Missing or invalid API key. |
403 | API key is not enabled for Task API. |
503 | Task API is disabled or temporarily unavailable. |