Replicate image generation integration for Pipecat
Project description
pipecat-replicate
Replicate image generation integration for Pipecat — a framework for building voice and multimodal conversational AI applications.
Pipecat Compatibility
Tested with Pipecat v0.0.108
Features
- Text-to-image generation using any Replicate-hosted model
- Official models (
owner/name) and versioned community models (owner/name:version) - Sync prediction requests with automatic polling fallback
- Returns
URLImageRawFramefor direct use in Pipecat pipelines - Configurable via the standard Pipecat
Settingsdataclass pattern
Installation
Using pip
pip install pipecat-replicate
Using uv
uv add pipecat-replicate
From source
git clone https://github.com/bnovik0v/pipecat-replicate.git
cd pipecat-replicate
pip install -e .
Quick Start
-
Get your Replicate API token at https://replicate.com/account/api-tokens
-
Set the environment variable:
export REPLICATE_API_TOKEN=r8_...
- Use in a Pipecat pipeline:
import aiohttp
from pipecat.frames.frames import TextFrame
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.runner import PipelineRunner
from pipecat.pipeline.task import PipelineTask
from pipecat_replicate import ReplicateImageGenService
async with aiohttp.ClientSession() as session:
imagegen = ReplicateImageGenService(
aiohttp_session=session,
settings=ReplicateImageGenService.Settings(
model="black-forest-labs/flux-schnell",
aspect_ratio="1:1",
),
)
pipeline = Pipeline([imagegen, ...])
task = PipelineTask(pipeline)
await task.queue_frames([TextFrame("a cat in the style of a screenprint poster")])
runner = PipelineRunner()
await runner.run(task)
Configuration
Settings
| Field | Type | Default | Description |
|---|---|---|---|
model |
str |
"black-forest-labs/flux-schnell" |
Replicate model identifier |
aspect_ratio |
str |
"1:1" |
Aspect ratio for generated images |
num_outputs |
int |
1 |
Number of images to generate (1–4) |
num_inference_steps |
int |
4 |
Number of denoising steps |
seed |
int |
None |
Random seed for reproducible generation |
output_format |
str |
"webp" |
Output image format |
output_quality |
int |
80 |
Output quality (0–100) |
disable_safety_checker |
bool |
False |
Whether to disable the model safety check |
go_fast |
bool |
True |
Use the model's fast generation mode |
megapixels |
str |
"1" |
Approximate megapixel count |
Constructor Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
aiohttp_session |
aiohttp.ClientSession |
(required) | HTTP session for API requests |
api_token |
str |
$REPLICATE_API_TOKEN |
Replicate API token |
settings |
Settings |
(see defaults above) | Generation settings |
base_url |
str |
"https://api.replicate.com/v1" |
API base URL |
wait_timeout_secs |
int |
60 |
Sync wait timeout (Prefer header) |
poll_interval_secs |
float |
0.5 |
Poll interval for async predictions |
max_poll_attempts |
int |
120 |
Maximum number of polling attempts |
Examples
See examples/basic_image_gen.py for a complete example that generates an image and displays it in a Tk window.
REPLICATE_API_TOKEN=r8_... python examples/basic_image_gen.py
Running Tests
uv sync --group dev
uv run pytest
License
BSD 2-Clause — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pipecat_replicate-0.1.0.tar.gz.
File metadata
- Download URL: pipecat_replicate-0.1.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33c6c5f163f176a54e2295a108acc43fb620c1e0b946baed0d9215272ca6d297
|
|
| MD5 |
7c1eeebaacff3cb477addbcdf8ad026b
|
|
| BLAKE2b-256 |
4556530b568ef60f78f4d819ff57f626e16e6aedb474e2e558dcaa43c3a95138
|
Provenance
The following attestation bundles were made for pipecat_replicate-0.1.0.tar.gz:
Publisher:
publish.yml on bnovik0v/pipecat-replicate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pipecat_replicate-0.1.0.tar.gz -
Subject digest:
33c6c5f163f176a54e2295a108acc43fb620c1e0b946baed0d9215272ca6d297 - Sigstore transparency entry: 1300006561
- Sigstore integration time:
-
Permalink:
bnovik0v/pipecat-replicate@856c9b1055dc1cf75c681637a0714c529e5ddf61 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bnovik0v
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@856c9b1055dc1cf75c681637a0714c529e5ddf61 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pipecat_replicate-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pipecat_replicate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9b9d782e0ac2d475d8103ab4581e005791fca7cc890c01f000ce20a8cad1659
|
|
| MD5 |
6be39d540383882c516af372838ebb99
|
|
| BLAKE2b-256 |
288c5c49dce1fe366fe7525a35c48ce5c55570ea69343c9992c9df29c8188107
|
Provenance
The following attestation bundles were made for pipecat_replicate-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on bnovik0v/pipecat-replicate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pipecat_replicate-0.1.0-py3-none-any.whl -
Subject digest:
d9b9d782e0ac2d475d8103ab4581e005791fca7cc890c01f000ce20a8cad1659 - Sigstore transparency entry: 1300006683
- Sigstore integration time:
-
Permalink:
bnovik0v/pipecat-replicate@856c9b1055dc1cf75c681637a0714c529e5ddf61 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bnovik0v
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@856c9b1055dc1cf75c681637a0714c529e5ddf61 -
Trigger Event:
release
-
Statement type: