If you have ever wanted to run a machine learning model without setting up your own GPU hardware, you have probably run into Replicate. It is one of the most widely used platforms for running open source and proprietary models through a simple HTTP API, and it comes up constantly in conversations about image generation, video generation, and self-hosted language models. This guide covers what the Replicate API actually is, how to get an API key, how pricing works, and how to make your first call.
What Is the Replicate API
Replicate is a platform for running machine learning models through a hosted API instead of managing your own GPU hardware. You send a request with some input, like a prompt or an image, whatever the model expects. Replicate runs it on hardware it manages, and you get the output back.
Replicate is not a single model, or even a single company's models. It hosts thousands of models contributed by the open source community, plus a set of "official models" it maintains directly. These span image generation, video generation, audio, and large language models. That is different from something like the OpenAI API or the Anthropic API, where you are calling one company's models. On Replicate, you are choosing from a huge and constantly growing catalog, and each model comes from a different creator with its own quirks.
In November 2025, Cloudflare announced it was acquiring Replicate, and the deal closed a few weeks later in December 2025. Replicate continues to operate under its own brand with the same API and pricing, now as part of Cloudflare's broader AI infrastructure push. It is worth knowing about if you are weighing up long-term platform risk, but it has not changed how the API works day to day.
How the Replicate API Works
Models and versions
Every model on Replicate has an owner and a name, like black-forest-labs/flux-schnell or meta/meta-llama-3.1-405b-instruct. Community-published models also have version IDs (long strings of characters) that pin you to an exact snapshot of that model. This matters because model authors can push updates that change behavior or outputs. Official models, by contrast, have stable APIs that do not require pinning a version ID. You just reference the model name directly.
The predictions API
Every run on Replicate is called a "prediction." There are three ways to create one, depending on what you are running: community models use the predictions.create endpoint, official models use models.predictions.create, and deployments (your own dedicated instance of a model) use deployments.predictions.create.
You also choose between two ways of waiting for the result:
Sync mode holds the connection open and hands you the output directly once the model finishes, up to a timeout you can configure (60 seconds by default). Turn it on by setting a Prefer: wait header.
Async mode (the default) replies straight away with a prediction ID and a status of starting. You then either check the prediction URL repeatedly until it is done, which is called polling, or supply a webhook URL that Replicate calls when the run completes.
For anything that might take more than a few seconds, like image or video generation, async mode with polling or webhooks is the more reliable pattern. Sync mode works best for fast, lightweight models.
Getting a Replicate API Key
Replicate creates a default API token for you when you sign up. You can create additional tokens, for separate environments or projects, from your account's API tokens page. Tokens are 40-character strings that always start with the prefix r8_.
To authenticate a request, pass the token in the Authorization header as a Bearer token:
Authorization: Bearer r8_your_token_hereA few practical notes: store the token as an environment variable rather than typing it directly into your code, use different tokens for development and production, and know that Replicate actively scans public GitHub repositories for leaked tokens. If it finds one, it disables the token immediately and emails you, so any app still using it stops working on the spot.
Replicate API Pricing
Replicate is pay-as-you-go, with no subscription and no minimum spend. How you are billed depends on the type of model and how it is hosted.
Public models (the shared catalog) bill you only for the time your prediction is actively processing. Setup time and idle time are free. You are sharing hardware capacity with other users, so you can occasionally hit a cold boot, where a model has to be loaded into memory before it can run, or scaling limits depending on demand from other customers.
Private models and deployments run on hardware dedicated to you, so you pay for all the time an instance is online, including setup and idle time, not just active processing. The exception is "fast booting fine-tunes," which only bill for active time even though they are technically private.
Time-based pricing is charged per second of compute, and the rate depends on which hardware tier a model runs on:
| Hardware | Price per second | Price per hour |
|---|---|---|
| CPU (Small) | $0.000025 | $0.09 |
| CPU | $0.000100 | $0.36 |
| Nvidia T4 | $0.000225 | $0.81 |
| Nvidia L40S | $0.000975 | $3.51 |
| Nvidia A100 (80GB) | $0.001400 | $5.04 |
| Nvidia H100 | $0.001525 | $5.49 |
| Nvidia H200 | $0.001525 | $5.49 |
Multi-GPU tiers (2x, 4x, and 8x configurations) scale at roughly the same per-GPU rate. Note that H200 capacity and the larger multi-GPU options are only available to accounts with a committed spend contract, so they are not something you can pick off the shelf on a standard pay-as-you-go account.
Some models do not bill by time at all. Flux models like black-forest-labs/flux-dev charge per output image ($0.025 each), flux-schnell charges $3.00 per thousand images, and flux-1.1-pro runs $0.04 per image. Language models on Replicate typically bill per token, like deepseek-ai/deepseek-r1 at $3.75 per million input tokens and $0.01 per thousand output tokens. You will find the exact billing method on each model's page before you commit to using it.
Two billing details worth knowing before you build. If a run fails, Replicate does not charge you, though cancelling a run on an official model may still cost you for the time it had already used. And if you run a model that calls other models behind the scenes, you pay for the downstream models too, including any that ran before a failure. If you are comparing the real cost of video models across providers, our breakdown of what you actually pay per second puts the current rates side by side.
Is there a free tier
Not in the sense of ongoing free credits. Replicate lets you run a curated set of models for free to try the platform, but you will be asked to set up billing fairly quickly to go beyond that, and some features are only available once billing is in place. There is no large free-credit grant for new accounts the way some AI APIs offer. Budget for real usage from day one rather than assuming a trial allowance will cover meaningful testing. If you are comparing options with more generous free tiers, see our roundups of what is actually free in AI image APIs and AI video APIs.
Code Example: Your First API Call
Here is a minimal example using Python and the requests library to run an official model. It submits the job, then checks back until the run has either succeeded or failed:
import requests
import time
REPLICATE_API_TOKEN = "r8_your_token_here"
headers = {
"Authorization": f"Bearer {REPLICATE_API_TOKEN}",
"Content-Type": "application/json",
}
# Create a prediction (async mode is the default)
response = requests.post(
"https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions",
headers=headers,
json={"input": {"prompt": "a cat wearing a hat"}},
)
prediction = response.json()
# Check back until the run has finished, one way or the other
get_url = prediction["urls"]["get"]
while prediction["status"] not in ("succeeded", "failed"):
time.sleep(1)
prediction = requests.get(get_url, headers=headers).json()
print(prediction["output"])If you would rather avoid writing your own checking loop, Replicate also has official Python and JavaScript client libraries that handle this pattern for you. You can also pass a webhook URL in the request body to have Replicate notify your server directly when a job completes.
Rate Limits and Reliability
Replicate limits prediction creation to 600 requests per minute. All other endpoints (fetching results, listing predictions, and so on) are capped at 3,000 requests per minute. You will get a 429 response with a message like "Request was throttled. Your rate limit resets in ~30s" if you exceed it. Short bursts above the limit are tolerated before throttling kicks in.
Two situations tighten those limits, and both are worth planning around. As your credit balance runs low, Replicate applies stronger limits to stop you from accidentally overspending. Separately, if you were granted credit and have not added a payment method, you are capped at 1 request per second and a maximum of 6 requests per minute, which is far too low for anything beyond basic testing. Setting up credit auto-reload to keep your balance above $20 avoids both.
On the "is Replicate slow" question: for public models, yes, you can hit cold boots when a model has not been used recently. You are also sharing a request queue with everyone else using that model. If consistent speed matters for your product, a deployment (your own dedicated instance, with a minimum number of instances you set) avoids the shared-queue problem, at the cost of paying for idle time too. Replicate also runs safety checks on some models, so certain prompts and inputs will be rejected regardless of your account status. Our AI content moderation guide covers how to screen user-submitted prompts before they reach the model.
What Replicate Is Good At (and Where It Falls Short)
The biggest strength is breadth. If a new open source model drops on Hugging Face or gets published by a research lab, such as the latest release in the Stable Diffusion family, there is a good chance someone has already pushed a working version to Replicate within days, sometimes hours. That makes it a genuinely useful place to test niche or brand-new models without setting up your own infrastructure to run them.
The tradeoffs are real too. Because community models are published by many different people, quality and reliability vary a lot. Some are well-maintained, with clear documentation of exactly what inputs they accept. Others are abandoned, or break when the underlying model files are updated. Speed is inconsistent across models for the same reason, and error handling is not standardized, since each model's author decides how to validate inputs. If you need a small number of models with rock-solid uptime and predictable behavior, Replicate's official models are the safer bet within the platform. But you are then working with a curated subset rather than the full catalog that draws people to Replicate in the first place.
For teams that want one integration covering image, video, and music generation with a single request and response format, rather than model-by-model quirks, it is worth comparing that experience against a unified API like Apiframe, which we cover more below.
Replicate API Alternatives
If what you actually need is reliable access to a specific set of well-supported image, video, or music models rather than the entire open source catalog, a managed multi-model API can be a simpler fit than Replicate's marketplace-style setup. Apiframe is one option: it gives you one API key and one consistent request format across models like Flux, Seedream, Kling, Veo, and Suno. You are not maintaining separate integration logic for each provider the way you sometimes need to on Replicate. For video generation specifically, tools like Runway and Pika Labs are also worth comparing, and WaveSpeed AI is another hosting platform built along similar lines to Replicate. For image generation, our roundup of the best AI image generator APIs compares the main options on price and output quality. Any of these is a different trade-off (fewer models, more consistency) rather than a drop-in replacement, so check the models directory to see whether it covers what you need before switching anything over.
FAQ
Does Replicate have a free tier?
Not an ongoing one. You can try a curated set of models for free, but you will need to set up billing to use the platform beyond that. There is no large free-credit grant for new accounts.
How do I get a Replicate API key?
Sign up and Replicate creates a default token automatically. You can create and manage additional tokens from your account's API tokens page. Tokens start with r8_ and go in the Authorization: Bearer header.
Is the Replicate API slow?
It can be. Cold boots, where a model has to be loaded into memory before it can run, are common on public models that have not been used recently. You also share a request queue with other customers using the same model. Deployments with dedicated hardware avoid the shared-queue issue.
What does the Replicate API actually cost?
It depends on the model. Most models bill per second of compute time, at a rate set by the hardware tier (T4, A100, H100, and so on). Some models bill per output image or per token instead. There is no subscription or minimum spend, and failed runs are not charged. You only pay for what you successfully run.
Can I run any open source model on Replicate?
Not automatically. Someone needs to have published it to the platform first using Cog, Replicate's open source packaging tool. Most popular open source releases show up quickly, but it is not guaranteed for every model on day one.
Does the Cloudflare acquisition change anything?
Not for day-to-day use. Replicate became part of Cloudflare in December 2025 and still runs under its own brand, with the same API, the same model catalog, and the same pricing.
You can also get an API key and start with free credits if you would rather have a curated, consistent set of models under one key instead of Replicate's full open catalog.
Apiframe Team
The team behind Apiframe - making AI generation accessible to everyone.