Replicate HTTP API
Replicate provides a unified HTTP API to run community and official AI models (text, image, audio, video, etc.). The core resource is a "prediction". Developers create runs via POST /v1/predictions or model/deployment-specific endpoints, with support for sync (Prefer: wait) and async modes, SSE streaming, and webhooks. Authentication uses Bearer tokens and the base is https://api.replicate.com/v1. Rate limits are ~600 requests/min for create prediction and ~3000 requests/min for other endpoints. Pricing is per model (time-based or token-based).
支持模型
API 接口列表
Create a prediction (run a community model version), supporting sync via Prefer: wait and default async mode. Returns a prediction object with status and output.
{
"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
"input": {
"prompt": "A photo of a bear riding a bicycle over the moon"
}
}Get the current state and result of a specific prediction (including output, logs, timing, etc.).
curl -s -H 'Authorization: Bearer $REPLICATE_API_TOKEN' https://api.replicate.com/v1/predictions/{id}Cancel a prediction that is not yet completed. Completed predictions cannot be canceled.
curl -s -X POST -H 'Authorization: Bearer $REPLICATE_API_TOKEN' https://api.replicate.com/v1/predictions/{id}/cancelList predictions you have created (from website and API), paginated, returning up to 100 records per page by default.
curl -s -H 'Authorization: Bearer $REPLICATE_API_TOKEN' https://api.replicate.com/v1/predictions
Create a prediction for an official model without requiring a specific version ID (official models manage versioning policy).
{
"input": {
"prompt": "A cozy cabin in the woods"
}
}Create a prediction on a specified deployment, useful for production scenarios (stable model configuration and quotas).
curl -s -X POST -H 'Prefer: wait' -H 'Authorization: Bearer $REPLICATE_API_TOKEN' -H 'Content-Type: application/json' -d '{
"input": { "prompt": "A photo of a bear riding a bicycle over the moon" }
}' https://api.replicate.com/v1/deployments/{owner}/{name}/predictionsDelete the specified deployment. On success returns 204 No Content.
curl -s -X DELETE -H 'Authorization: Bearer $REPLICATE_API_TOKEN' https://api.replicate.com/v1/deployments/{owner}/{name}Get the default webhook secret (returns a JSON object with a key property).
curl -s -H 'Authorization: Bearer $REPLICATE_API_TOKEN' https://api.replicate.com/v1/webhooks/default/secret
Search public models, collections, and docs (Beta), supports query string and result limit.
curl -s -H 'Authorization: Bearer $REPLICATE_API_TOKEN' 'https://api.replicate.com/v1/search?query=flux&models_limit=20'
Get model details (including available versions and metadata; version's openapi_schema helps validate inputs).
curl -s -H 'Authorization: Bearer $REPLICATE_API_TOKEN' https://api.replicate.com/v1/models/{owner}/{name}List versions for the specified model.
curl -s -H 'Authorization: Bearer $REPLICATE_API_TOKEN' https://api.replicate.com/v1/models/{owner}/{name}/versions