Replicate Python Client

1.0.4 · active · verified Sun Mar 01

Python client for running ML models on Replicate's cloud API. v0.x stable client is at 1.x on PyPI. A v2.0 beta (replicate-python-beta) exists as a separate package with a redesigned API. replicate.stream() is deprecated in v2. Billing changed to prepaid credit for new accounts in July 2025.

Warnings

Install

Imports

Quickstart

Run a model on Replicate. Requires REPLICATE_API_TOKEN environment variable.

import replicate

output = replicate.run(
    "black-forest-labs/flux-schnell",
    input={"prompt": "an iguana on the beach"}
)

# output is a list of FileOutput objects for image models
with open('output.png', 'wb') as f:
    f.write(output[0].read())

view raw JSON →