Create a prediction using an official model
Create a prediction using an official model.
If you're not running an official model, use the predictions.create operation instead.
Example cURL request:
curl -s -X POST -H 'Prefer: wait' \
-d '{"input": {"prompt": "Write a short poem about the weather."}}' \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.replicate.com/v1/models/meta/meta-llama-3-70b-instruct/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 model.
The name of the model.
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.