Create a prediction using a deployment
Create a prediction for the deployment and inputs you provide.
Example cURL request:
curl -s -X POST -H 'Prefer: wait' \
-d '{"input": {"prompt": "A photo of a bear riding a bicycle over the moon"}}' \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions
The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a "starting" state and need to be retrieved using the predictions.get endpoint.
For a complete overview of the deployments.predictions.create API check out our documentation on creating a prediction which covers a variety of use cases.
Path parameters
The name of the user or organization that owns the deployment.
The name of the deployment.
Headers
Leave the request open and wait for the model to finish generating output. Set to wait=n where n is a number of seconds between 1 and 60.
See https://replicate.com/docs/topics/predictions/create-a-prediction#sync-mode for more information.
The maximum time the prediction can run before it is automatically canceled. The lifetime is measured from when the prediction is created.
The duration can be specified as string with an optional unit suffix:
- s for seconds (e.g., 30s, 90s)
- m for minutes (e.g., 5m, 15m)
- h for hours (e.g., 1h, 2h30m)
- defaults to seconds if no unit suffix is provided (e.g. 30 is the same as 30s)
You can combine units for more precision (e.g., 1h30m45s).
The minimum allowed duration is 5 seconds.
Request body
Example request
{
"input": {
"prompt": "Tell me a joke",
"system_prompt": "You are a helpful assistant"
},
"webhook": "https://example.com/my-webhook-handler",
"webhook_events_filter": [
"start",
"completed"
]
}Response
Prediction has been created. If the Prefer: wait header is provided it will contain the final output.