Watch task progress in real-time.
Why stream?
Long tasks can take minutes. Streaming shows:
- Status changes
- Log messages
- Progress updates
Python
python
1for update in client.run(params, stream=True):2 print(f"Status: {update['status']}")3 4 if update.get('logs'):5 print(update['logs'])JavaScript
javascript
1const result = await client.run({2 app: 'slow-app',3 input: {...}4}, {5 onUpdate: (task) => {6 console.log(`Status: ${task.status}`);7 }8});Task statuses
| Status | Meaning |
|---|---|
QUEUED | Waiting for worker |
SCHEDULED | Assigned to worker |
PREPARING | Setting up |
RUNNING | Executing |
UPLOADING | Saving results |
COMPLETED | Done |
FAILED | Error |
REST API streaming
bash
1curl -N https://api.inference.sh/tasks/{id}/stream \2 -H "Authorization: Bearer inf_your_key" \3 -H "Accept: text/event-stream"Returns server-sent events.
Next
→ Files