How to hit the Replicate API

Replicate runs open models behind one API at https://api.replicate.com/v1. Running a model creates a prediction; add Prefer: wait to get the output in the same response instead of polling.

Authentication

Copy a token from replicate.com/account/api-tokens and send it as Authorization: Bearer <token>. In the examples it's written {{REPLICATE_API_TOKEN}}.

Full reference: https://replicate.com/docs/reference/http

Run a model

Generates an image with FLUX Schnell and waits up to 60 seconds for it. output holds the image URL(s).

curl -X POST https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions \
  -H "Authorization: Bearer {{REPLICATE_API_TOKEN}}" \
  -H "Content-Type: application/json" \
  -H "Prefer: wait" \
  -d '{"input": {"prompt": "a taco astronaut floating above Earth, digital art"}}'
Run in PostTaco

Check a prediction

For predictions still running: poll until status is succeeded or failed.

curl https://api.replicate.com/v1/predictions/{{PREDICTION_ID}} \
  -H "Authorization: Bearer {{REPLICATE_API_TOKEN}}"
Run in PostTaco

Get a model

Description, run count, and the input schema — which parameters the model accepts.

curl https://api.replicate.com/v1/models/black-forest-labs/flux-schnell \
  -H "Authorization: Bearer {{REPLICATE_API_TOKEN}}"
Run in PostTaco

Check your account

The username and account type a token belongs to.

curl https://api.replicate.com/v1/account \
  -H "Authorization: Bearer {{REPLICATE_API_TOKEN}}"
Run in PostTaco