Predictions API
Theclient.predictions component provides methods to retrieve, list, and manage predictions across all content types. This is the central hub for tracking the status of all processing jobs in the platform.
Quick Examples
Get a Prediction
List Predictions
Wait for Completion
Core Operations
Retrieving Predictions
Get details about a specific prediction:Listing Predictions
List predictions you’ve created (with pagination):Waiting for Completion
Wait for long-running predictions to complete:wait() method will throw a TimeoutError if the prediction doesn’t complete within the specified timeout.
Prediction Statuses
Predictions can have the following statuses:| Status | Description |
|---|---|
enqueued | The prediction is waiting to be processed |
pending | The prediction is preparing to start |
running | The prediction is actively being processed |
completed | The prediction has completed successfully |
failed | The prediction encountered an error |
paused | The prediction has been paused |
Feedback Operations
Get Feedbacks for a Prediction
Create Feedback
Media-Specific APIs
The basePredictions class is extended by specialized prediction classes for different media types:
Image Predictions
Document, Audio, and Video Predictions
These specialized APIs follow a consistent pattern:Response Structure
ThePredictionResponse object includes these key fields:
usage field contains a CreditUsage object: