PicassoIA API
Predictions
A prediction is one run of a model: you create it, poll it and read its output.
Creating a prediction
POST /v1/models/{owner}/{name}/predictions with the body { "input": { … } }.
- The API answers once the model has accepted the job, usually within seconds, with the prediction in the
startingstate. It never waits for the result. - If the prediction fails right away, the answer is still
201, with the prediction in thefailedstate and itserror. This happens, for example, when the input is refused by the safety filter. - If no prediction was created, the answer is an error: invalid input, plan, too many predictions in progress, service unavailable.
Listing predictions
GET /v1/predictions returns your API predictions, 50 per page, newest first, across all your keys.
nextis the URL of the next page (…/v1/predictions?cursor=…), ornullon the last page.previousis alwaysnull.- Predictions you deleted on picassoia.com are left out.
A prediction is visible through any of your keys, and never to anyone else.
The prediction object
Statuses.
starting versus processing is an estimate, made from the queue position at creation. A new prediction is always starting. The last three statuses are final: a prediction in one of them never changes again.
Errors of a failed prediction. The error of a failed prediction is one of these messages:
- The input or the output was refused by the safety filter. The message ends in
(SAFETY_CHECKER_PICASSO_FILTER_S4). The prediction failed. You can try again.The prediction timed out. You can try again.Nothing finished it within 3 hours.
Outputs. Output URLs are hosted by PicassoIA. Download the files you want to keep.
Polling and ETA
eta.next_poll_in_seconds tells you when the next poll is worth making:
- At half the estimated time.
- When the estimate is reached.
- Then every 2 seconds.
Example with an estimate of 10 s: poll after 5 s, then after 10 s, then every 2 s. Polling faster gets you nothing sooner.
Canceling
POST /v1/predictions/{id}/cancel:
A canceled prediction frees its place in your 5 predictions in progress at once.