Inference Logoinference.sh

Streaming

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

StatusMeaning
QUEUEDWaiting for worker
SCHEDULEDAssigned to worker
PREPARINGSetting up
RUNNINGExecuting
UPLOADINGSaving results
COMPLETEDDone
FAILEDError

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

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.