Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# Replicate Python API SDK
# Replicate Python API SDK (beta)

<!-- prettier-ignore -->
[![PyPI version](https://img.shields.io/pypi/v/replicate.svg?label=pypi%20(stable))](https://pypi.org/project/replicate/)
This is the repo for Replicate's official v2 Python SDK, which provides access to Replicate's HTTP API from any Python 3.8+ application.

This is the repo for Replicate's official v2 Python SDK, which provides access to Replicate's HTTP API from any Python 3.8+
application.
⚠️ The v2 SDK is currently in public beta. Check out the [release notes](https://github.com/replicate/replicate-python-beta/releases/tag/v2.0.0-beta.1) and leave feedback on the [GitHub discussion](https://github.com/replicate/replicate-python-beta/discussions/89).

## Docs
🤔 Looking for the legacy v1 Python client? Find it [here](https://github.com/replicate/replicate-python).

- https://sdks.replicate.com/python
- https://replicate.com/docs/reference/http
## Docs

- v2 beta release notes: https://github.com/replicate/replicate-python-beta/releases/tag/v2.0.0-beta.1
- v2 beta migration guide: https://github.com/replicate/replicate-python-beta/blob/main/UPGRADING.md
- v2 beta SDK reference: https://sdks.replicate.com/python
- v2 beta GitHub discussion: https://github.com/replicate/replicate-python-beta/discussions/89
- HTTP API reference: https://replicate.com/docs/reference/http

## Installation

The [`replicate`](https://pypi.org/project/replicate/) package is available on PyPI. Install it with [pip](https://pip.pypa.io/en/stable/):
The [`replicate`](https://pypi.org/project/replicate/) package is available on PyPI. Install it with [pip](https://pip.pypa.io/en/stable/) (using the `--pre` flag to get the latest beta version):

```sh
pip install --pre replicate
Expand Down
24 changes: 14 additions & 10 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# Upgrading from v1 to v2

This guide will help you migrate an existing codebase from the v1 Replicate Python SDK to v2. The v2 SDK is a complete rewrite built in partnership with [Stainless](https://www.stainless.com/customers/replicate), the company that helps design and maintain SDKs for companies like OpenAI, Anthropic, and Cloudflare. The v2 SDK is largely autogenerated from Replicate's OpenAPI specification, providing better type safety, more consistent error handling, and improved async support. Check out the [v2 release notes](https://github.com/replicate/replicate-python-stainless/releases) for more details.
This guide will help you migrate an existing codebase from the v1 Replicate Python SDK to v2.

✋ If you are working on a new project, you don't need to read this document.
🍪 Feed this doc to your coding agent to assist with the upgrade process!

This doc is intended for both humans and agents. 🧑🏽‍🦰 🤝 🤖
If you encounter any issues, please [share feedback on the GitHub Discussions page](https://github.com/replicate/replicate-python-beta/discussions/89).

## Installing the v2 SDK
## Docs

Use pip to install the latest pre-release version of the v2 SDK:
- v2 beta release notes: https://github.com/replicate/replicate-python-beta/releases/tag/v2.0.0-beta.1
- v2 beta SDK reference: https://sdks.replicate.com/python
- v2 beta GitHub discussion: https://github.com/replicate/replicate-python-beta/discussions/89
- HTTP API reference: https://replicate.com/docs/reference/http

## Installing the v2 SDK

Install the latest pre-release version of the v2 SDK from PyPI using pip:

```sh
pip install --pre replicate
Expand Down Expand Up @@ -605,7 +612,7 @@ print(response.http_response.status_code)
prediction = response.parse()
```

The response object is an [`APIResponse`](https://github.com/replicate/replicate-python-stainless/tree/main/src/replicate/_response.py) instance. See the [README](https://github.com/replicate/replicate-python-stainless#accessing-raw-response-data-eg-headers) for full documentation.
The response object is an [`APIResponse`](https://github.com/replicate/replicate-python-beta/tree/main/src/replicate/_response.py) instance. See the [README](https://github.com/replicate/replicate-python-beta#accessing-raw-response-data-eg-headers) for full documentation.

### Streaming response wrapper

Expand All @@ -631,7 +638,4 @@ The following features are not available in v2:

## Getting help

If you encounter issues during the migration process:

- Check the [API documentation](https://replicate.com/docs/reference/http)
- Open an issue on [GitHub](https://github.com/replicate/replicate-python-stainless/issues)
If you encounter issues during the migration process, share your feedback on the [GitHub Discussions page](https://github.com/replicate/replicate-python-beta/discussions/89).