
Replicate API: Access, Rate Limits & SDKs 2026
Replicate turns any model into one call: replicate.run with a bearer token, from Python, JS or HTTP. Runs are async predictions, capped at 30 minutes.
Replicate API verdict
Replicate's API turns running any model into one call.
You authenticate with a bearer REPLICATE_API_TOKEN and call replicate.run with an owner/model id and an input object, from the official Python or JavaScript client. You can also drive the HTTP API directly from any language, with an OpenAI-compatible endpoint for the LLMs it serves.
Build on Replicate when you want to run or host many models, especially image, video, audio or custom models, with one API and no GPU management. replicate.run gets you a result in a few lines, FileOutput handles generated media, and webhooks plus the 30-minute prediction ceiling cover long jobs. Pin versions for reproducibility, save outputs within the hour before they are deleted, and use deployments to keep latency-sensitive models warm and to control hardware and scaling. Reach for a dedicated, OpenAI-compatible LLM host instead when your workload is purely interactive text generation and cold-start latency is unacceptable. Replicate's strength is breadth and ease, not the lowest LLM latency.
- Runs are asynchronous predictions. Long jobs, up to 30 minutes, must be polled or handled via webhook, not awaited as a fast synchronous call.
- API output files are deleted after one hour, so save any images, audio or video you need to keep, and allow-list replicate.delivery for assets.
- Cold boots add latency to the first call on an idle model. Pin a deployment with minimum instances of 1 or more for production latency, paying for idle capacity.
- Pin model versions, as owner/model:version, for reproducibility, since model authors publish new versions that can change behavior.
- Auth
- Bearer REPLICATE_API_TOKEN
- Core call
- replicate.run('owner/model', input)
- Clients
- Python, JavaScript, HTTP
- Long jobs
- Predictions + webhooks (30-min cap)
- Runs
- Any model + your own
Build with the Replicate API
import replicate
output = replicate.run(
"black-forest-labs/flux-schnell",
input={"prompt": "an astronaut riding a horse"},
)
with open("output.png", "wb") as f:
f.write(output[0].read())- Cost levers: pay only for run-time (cold boot not billed to the prediction); pick cheaper model hardware (GPU tier); warm deployment only for latency-critical models.
- Handle: 401 (invalid REPLICATE_API_TOKEN), 429 (API rate limit).
Real Replicate code from the official docs. The raw cURL hello-world is the code block above; full limits and endpoints are in the tables on this page.
Your first Replicate API request
# Python client (recommended): run any model in a few lines
import replicate
output = replicate.run(
"black-forest-labs/flux-schnell",
input={"prompt": "an astronaut riding a horse"},
)
# or raw HTTP:
curl -s https://api.replicate.com/v1/predictions \
-H "Authorization: Bearer ${REPLICATE_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"version":"<model-version>","input":{"prompt":"an astronaut riding a horse"}}'How to authenticate with the Replicate API
| Aspect | Detail | Notes |
|---|---|---|
| Auth | Bearer REPLICATE_API_TOKEN | Set as an environment variable |
| Core call | replicate.run('owner/model', input={...}) | Run any public or custom model |
| Clients | Python, JavaScript (+ other languages) | Wrap the HTTP API |
| HTTP API | REST, usable from any language | POST /v1/predictions; poll for status |
| OpenAI compat | OpenAI-compatible API for served LLMs | Reuse OpenAI SDK integrations |
| Model reference | owner/model[:version] | Pin a version for reproducibility |
| MCP server | Replicate MCP server | Use Replicate from agent tooling |
Replicate core endpoints and features
| Capability | How | Purpose |
|---|---|---|
| Create prediction | POST /v1/predictions | Run a model version with inputs |
| run() helper | replicate.run(model, input) | One-call sync wrapper over predictions |
| Poll status | starting/processing/succeeded/failed/canceled | Track long-running predictions |
| Streaming output | Streaming output | Stream tokens/results as generated |
| File outputs | FileOutput (replicate.delivery) | Images/audio/video returned as files |
| Webhooks | Register a webhook URL | Get results for long jobs without holding a connection |
| Deployments | Create a deployment | Custom hardware + min/max instances (keep warm) |
| Push / fine-tune | Push your own model; fine-tune | Build and host custom models |
Limits, lifecycle and data rules
| Aspect | Detail | Notes |
|---|---|---|
| Prediction timeout | 30 minutes | Contact Replicate for longer jobs |
| Output retention | API output files deleted after 1 hour | Save copies; web predictions kept |
| Rate limits | API request rate limits apply | See HTTP API reference |
| Cold boots | Cold model adds start latency | Pin a deployment to avoid |
| File delivery | Outputs served via replicate.delivery | Allow-list replicate.delivery + *.replicate.delivery |
| Versions | Pin owner/model:version | Reproducible behavior over time |
| Safety | Safety checker on image models; can disable via API | SDXL and fine-tunes |
Clients, ops and developer fit
| Aspect | Detail | Notes |
|---|---|---|
| Clients | Python (import replicate), JavaScript (Replicate) | Plus other community clients |
| File handling | FileOutput: .read()/.blob(), .url() | Save or stream generated media |
| Long jobs | Webhooks + polling | No need to hold a connection |
| Production control | Deployments: hardware + min/max instances | Keep warm, autoscale |
| Teams | Organizations: shared models, tokens, billing | Private team models |
| No infra | Run/host models without managing GPUs | Cloud API abstracts the hardware |
| LLM pricing (tracked) | $0.05-$0.08 / 1M (Granite) | Independent cross-reference; most models billed per run-second |
Replicate API FAQ
How do I authenticate and call the Replicate API?
Create an API token and set it as REPLICATE_API_TOKEN, then use the official client. In Python, import replicate and call replicate.run with an owner/model id and an input object. In JavaScript, create a new Replicate client with your auth token, then call replicate.run with the model and input. You can also drive the HTTP API directly, through POST /v1/predictions, from any language, and there is an OpenAI-compatible endpoint for the LLMs Replicate serves.
How do predictions and long-running jobs work?
Every model run is a prediction object with a status, from starting, which includes cold boot, to processing, succeeded, failed or canceled. Fast models return within milliseconds, while longer ones, especially generative image and video, you poll for status or receive via a webhook. Predictions time out after 30 minutes, though you can contact Replicate for longer, and the run helper wraps create-and-wait for you.
How does Replicate handle file outputs?
Models that generate images, audio or video return FileOutput objects. In Python you call .read or aread, or use the .url attribute. In JavaScript you use .blob or the url method, and both support streaming. Files are served from replicate.delivery, so allow-list replicate.delivery and *.replicate.delivery. API prediction outputs are deleted after one hour, so save copies of anything you need.
Can I run my own models and control hardware?
Yes. Beyond running any public model, you can push your own models, public or private, fine-tune image models, and pin versions for reproducibility. Deployments let you customize the GPU hardware and the scaling configuration, with min and max instances. Setting minimum instances to 1 or more keeps a model warm and removes cold boots for latency-sensitive workloads.
What are the Replicate API limits?
Predictions time out after 30 minutes, API output files are deleted after one hour, and the API enforces request rate limits, documented in the HTTP API reference. The main performance constraint is cold boots on idle models, which you mitigate with a warm deployment. Outputs are served through replicate.delivery, and image models include a safety checker you can disable through the API.
Sources & verification
| Source | What was checked | Last checked |
|---|---|---|
| Replicate Official | Official product page | July 10, 2026 |
| Artificial Analysis | Independent reference | July 10, 2026 |
| Replicate Reference How Does Replicate Work | How Does Replicate Work | July 10, 2026 |
| Replicate Reference Http | Http | July 10, 2026 |
Every fact on this Replicate page is tied to a named source and a verification date. Freshness-sensitive figures trace to the sources above; verify against the vendor before relying on them.
Explore Replicate
Every page on Replicate in one place, you are on api.
Snapshot, score and verdict
You are here
Latency, throughput, uptime and behaviour under scale
Every tier and the entry price
Compared and ranked vs peers
Price and feature change history
Browse the full Large Language Models category
