Run all models with the same API endpoint
You can now use the POST /v1/predictions
HTTP API endpoint to run any model on Replicate, whether it’s an official model or a community model. This removes the confusion about which endpoint to use for different types of models.
What changed?
The POST /v1/predictions
endpoint now accepts official model identifiers in the owner/name
format, in addition to the existing {owner}/{name}:{version_id}
and {version_id}
formats.
The existing POST /v1/models/{model_owner}/{model_name}/predictions
endpoint will still be supported for running official models. If you’re already using that endpoint, you don’t need to change anything.
This change is backward compatible. Existing code will continue to work without any modifications.
Supported version identifiers
When using the POST /v1/predictions
endpoint, you can specify models in these formats:
{owner}/{name}
- For official models (e.g.,black-forest-labs/flux-schnell
){owner}/{name}:{version_id}
- For community models with full version ID (e.g.,replicate/hello-world:9dcd6d78e7c6560c340d916fe32e9f24aabfa331e5cce95fe31f77fb03121426
){version_id}
- Just the 64-character version ID (e.g.,9dcd6d78e7c6560c340d916fe32e9f24aabfa331e5cce95fe31f77fb03121426
)
Example
Here’s an example of how to run an official model (in this case, black-forest-labs/flux-schnell
) using the POST /v1/predictions
operation:
curl -X POST https://api.replicate.com/v1/predictions \
-H "Authorization: Token $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"version": "black-forest-labs/flux-schnell",
"input": {
"prompt": "A photo of a cat"
}
}'