Documentation Index
Fetch the complete documentation index at: https://docs.modelrunner.ai/llms.txt
Use this file to discover all available pages before exploring further.
States
Every request progresses through one of these statuses:| Status | Meaning |
|---|---|
IN_QUEUE | The request is accepted and waiting for the provider to start processing. |
IN_PROGRESS | The provider is actively generating output. |
COMPLETED | Output is available at response_url. Billing has been settled. |
FAILED | The provider returned an error or the request was force-failed. Not billed. |
CANCELLED | You called cancel_url (or the platform cancelled before any work was done). Not billed. |
COMPLETED, FAILED, and CANCELLED are terminal — the request will never transition away from them.
Submitting a request
request_id, status: "IN_QUEUE", and three URLs:
| URL | Use |
|---|---|
status_url | Poll for status transitions (or skip polling — see below). |
response_url | GET once status is COMPLETED to retrieve the validated output. |
cancel_url | GET (yes, GET) to attempt cancellation. Returns the current status. |
Three ways to watch a request
1. Server-Sent Events (recommended)
1. Server-Sent Events (recommended)
Open one connection to
GET /requests/stream and receive push updates for every in-flight request the user owns. On connect, the server emits a snapshot event with current state; thereafter each status transition emits an update event. A : hb SSE comment is sent every 25 seconds to keep the connection alive — your client can ignore it.This eliminates the polling loop entirely. Best for dashboards, multi-request UIs, and any client that opens multiple requests in parallel.2. Webhooks
2. Webhooks
Not currently supported. If your use case requires server-to-server delivery without a long-lived connection, use the SSE stream (above) or polling (below) — webhook delivery is on the roadmap.
3. Polling
3. Polling
GET /{ownerName}/{modelName}/requests/{requestId}/status returns the same response shape as the create call. Poll at 1–2 second intervals. The SDK helpers (subscribe in JS, submit_async + iter_events in Python) wrap this loop for you.Cancellation
GET /{ownerName}/{modelName}/requests/{requestId}/cancel attempts to cancel an in-queue or in-progress request and returns the current status payload.
- If the provider hasn’t started yet, the request transitions directly to
CANCELLED. You are not billed. - If the provider is already running, cancellation is best-effort — the request may still reach
COMPLETED. Always check the returned status before assuming the work stopped.
Platform safety net: automatic finalization
You do not need to implement retry logic for requests you’ve abandoned. A background sweep runs every 60 seconds and re-checks every request that is:- Still
IN_PROGRESSpast the provider’s expected duration, or - Marked
COMPLETEDby the provider but missing output media (media upload still in flight).
FAILED and any associated billing is reverted.
Billing tie-in
Billing settles on the same lifecycle:- A request transitioning to
COMPLETEDcharges the user’s balance. - A request transitioning to
FAILEDorCANCELLEDis not charged. - A request that completed at the provider but failed schema validation is recorded with
billingStatus: "failed"— you are not billed, but the call returns422so you can surface the upstream error.
422 payload shape.
