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.
pip install replicateVerified import paths — ran on the pinned version, not inferred.
Run a model on Replicate. Requires REPLICATE_API_TOKEN environment variable.
Use output[0].read() to get bytes, or output[0].url to get the URL string.
Stick to stable v1.x unless explicitly opting into the v2 beta. Do not install replicate-python-beta alongside replicate.
Use replicate.run() with stream=True parameter, or use predictions.create() with streaming for fine-grained control.
Use versioned model strings for production ('owner/model:hash'). Check replicate.com/owner/model/versions for current hashes.Use replicate.predictions.create() to get a prediction ID immediately, then poll with predictions.get() or use AsyncReplicate for non-blocking calls.
Add credit at replicate.com/account/billing before making API calls. Set up auto-reload to avoid unexpected failures.