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.
Release files for pipecat-replicate 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pipecat_replicate-0.1.0.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pipecat_replicate-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.1 kB
Release files / pipecat_replicate-0.1.0.tar.gz
| Download URL | pipecat_replicate-0.1.0.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33c6c5f163f176a54e2295a108acc43fb620c1e0b946baed0d9215272ca6d297
|
|
BLAKE2b-256 checksum How to use checksums |
4556530b568ef60f78f4d819ff57f626e16e6aedb474e2e558dcaa43c3a95138
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.
Transparency logRelease files / pipecat_replicate-0.1.0-py3-none-any.whl
| Download URL | pipecat_replicate-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9b9d782e0ac2d475d8103ab4581e005791fca7cc890c01f000ce20a8cad1659
|
|
BLAKE2b-256 checksum How to use checksums |
288c5c49dce1fe366fe7525a35c48ce5c55570ea69343c9992c9df29c8188107
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.
Transparency log