ReleaseReplicateReplicatepublished Oct 23, 2025seen 5d

replicate/replicate-python-beta v2.0.0-beta.1

replicate/replicate-python-beta

Open original ↗

Captured source

source ↗
published Oct 23, 2025seen 5dcaptured 8hhttp 200method plain

Python SDK 2.0.0 beta

Repository: replicate/replicate-python-beta

Tag: v2.0.0-beta.1

Published: 2025-10-23T16:34:47Z

Prerelease: no

Release notes: Replicate’s v2 Python SDK is now in public beta. 🎉

As always, the replicate package is published on PyPI, and you can install it with pip using the --pre flag:

pip install --pre replicate

What’s new?

This new version is a complete rewrite of the SDK, built in partnership with Stainless, the team that helps design and maintain official SDKs for companies like OpenAI, Anthropic, and Cloudflare.

Replicate's v2 Python SDK is generated dynamically from our public OpenAPI schema. This allows us to automate client code generation and provide a Python API with method names, type hints, and documentation that is perfectly consistent with our HTTP API.

Now that most of the client code is generated dynamically, all changes to Replicate’s HTTP API are automatically supported by the Python SDK. This means whenever we add a new operation (like the new search API) or improve our docs for an existing API (like predictions.create()), the changes are automatically published in a new release of the Python SDK.

Running models

We think running AI models should be as easy as installing and running a package from PyPI.

With this idea in mind, we designed a new `replicate.use()` method that lets you run models as Python functions:

# pip install --pre replicate

import replicate

claude = replicate.use("anthropic/claude-4.5-sonnet")
seedream = replicate.use("bytedance/seedream-4")
veo = replicate.use("google/veo-3-fast")

# Enhance a simple prompt
image_prompt = claude(prompt="bananas wearing cowboy hats", system_prompt="turn prompts into image prompts")

# Generate an image from the enhanced prompt
images = seedream(prompt=image_prompt)

# Generate a video from the image
video = veo(prompt="dancing bananas", image_input=images[0])

open(video)

The new .use() method also supports streaming output. Here’s an example showing how to consume output tokens from Claude Sonnet 4.5 while the model is running:

import replicate

claude = replicate.use("anthropic/claude-4.5-sonnet", streaming=True)

for chunk in claude(prompt="Write a haiku about streaming output."):
print(str(chunk), end="")

# Bytes flow through the pipe
# Data chunks arrive in waves
# Code drinks from the stream

---

API design

Our new SDK was designed to be approachable for newcomers while also being feature-complete for power users. There are three levels of APIs built into the new SDK, varying from simple high-level abstractions to powerful low-level methods that you give you complete control:

🍰 High-level API

The v2 SDK provides a new replicate.use() method that make it easy to run models and get their output all at once or as a streaming response. The replicate.run() method is still supported so your applications will continue to work, but recommend using use() going forward.

🛠️ Mid-level API

The v2 SDK has methods for every single operation available in our public HTTP API, like search(), predictions.create() , and collections.list(). These more fine-grained methods are defined by our OpenAPI schema, and updated in lock-step with our API. Every new feature, bug fix, or documentation improvement in our API becomes available immediately in a new release of the Python SDK. See our HTTP API docs and Python SDK docs for reference.

The SDK now supports all of these API operations:

Excerpt shown — open the source for the full document.

Notability

notability 5.0/10

Beta release of Replicate Python client library.