Skip to main content

urun-pipecat

uRun services for Pipecat — build voice agents and pipelines on uRun's OpenAI-compatible inference endpoint: an LLM service, streaming speech-to-text, speech synthesis, a combined speech-to-speech service, and a wrapper that colocates a whole voice pipeline onto one speech-to-speech session.

UrunLLMService extends Pipecat's OpenAILLMService to work with https://inference.urun.sh/v1:

  • OpenAI-compatible chat completions — streaming, tools, structured output, all through the endpoint's /v1/chat/completions lane.
  • Reasoning as thought frames — reasoning-capable uRun models stream reasoning on the delta's reasoning_content field (never inside content). The service maps it to LLMThoughtStartFrame / LLMThoughtTextFrame / LLMThoughtEndFrame, so reasoning is available to observers and logging without being sent to TTS.
  • Loud authentication — a uRun API key is required at construction (argument or URUN_API_KEY); a missing key fails immediately, not on the first request.

UrunTTSService is a thin wrapper over Pipecat's OpenAITTSService for uRun's /v1/audio/speech lane (24 kHz mono PCM16): the same defaults (endpoint, API-key handling, qwen3-tts-customvoice:bf16, voice "Ryan", 24 kHz) and any voice string — uRun validates voices server-side against the model's published list and answers a 400 naming the accepted set, so the client does not duplicate the list.

from urun_pipecat import UrunTTSService

tts = UrunTTSService()  # uses URUN_API_KEY from the environment

UrunSTTService extends Pipecat's OpenAIRealtimeSTTService for uRun's realtime transcription session (wss://inference.urun.sh/v1/realtime): streaming interim and final transcript frames, the same loud API-key handling, and the default model nemotron-3.5-asr:fp16. uRun binds the session to its model at WebSocket upgrade time, so the service appends &model=... to the session URL at connect time and strips the model from the session configuration it sends afterwards (the bound session refuses an update naming one). The session offers no server-side turn detection yet, so the service requires the pipeline's local VAD (e.g. Silero), which drives the audio-buffer commits.

Final transcripts are commit-driven: the server finalizes a turn only when the client commits the buffer, so finals arrive at utterance boundaries — each local-VAD stop, and input end — rather than continuously, and interim text between boundaries is not durable. The service holds audio back until the session is configured (appending before the session update would lock the session out of transcription), so an utterance that starts immediately after the pipeline starts still produces its final. A final committed at input end races the connection teardown and may not be observed without an error, so a pipeline that must observe every final should end input on a VAD-stop boundary.

The service also exposes consumed_audio_seconds: the audio it has actually handed to the endpoint, counting sends that completed — the input task's direct sends and the held-back audio the configuration drain delivers. A feeder can subtract it from what it pushed to know how much of its audio is still queued and bound that backlog.

from urun_pipecat import UrunSTTService

stt = UrunSTTService()  # uses URUN_API_KEY from the environment

UrunRealtimeVoiceService extends Pipecat's OpenAIRealtimeLLMService for uRun's combined voice-agent realtime session (wss://inference.urun.sh/v1/realtime?model=voice-agent): one speech-to-speech session that takes the user's speech continuously and returns the agent's speech and transcript. The model rides the connect URL (uRun binds the session to it at upgrade time), so the session keeps the model it was dialed with — a runtime settings delta that changes the model is not applied, and the parent logs it as unsupported. The service strips the model from the session.update it sends afterwards — the bound session refuses an update naming one. The endpoint does its own turn detection: the pipeline sends whatever audio arrives, silence included, resampled to the session's 24 kHz mono PCM (URUN_VOICE_SAMPLE_RATE) when the transport captures at another rate. Pass transcript_preview=True to also receive the transcription model's live hypothesis of the open utterance as replaceable preview frames (InterimTranscriptionFrame with a TranscriptPreviewResult result): display-only revisions of the current line, dropped once the utterance's transcript commits, never appended and never part of the conversation history. Off by default; an endpoint without the feature ignores the opt-in and the session runs unchanged.

from urun_pipecat import UrunRealtimeVoiceService

service = UrunRealtimeVoiceService(model="voice-agent")
pipeline = Pipeline([transport.input(), service, transport.output()])

A headset conversation with it, no room needed, is the local microphone example.

Maintained by uRun. See the uRun docs for the inference API reference.

Installation

The package needs Python 3.11+ (tested on 3.11, 3.12, and 3.13) and installs a single runtime dependency: pipecat-ai[openai]>=1.11,<2.

The first release is not on PyPI yet. Until it is published, install from a checkout:

git clone https://github.com/urun-sh/urun-pipecat
pip install "./urun-pipecat"

Once published, the same install works from the package name — with uv as usual:

pip install urun-pipecat        # or: uv add urun-pipecat

Optional extras:

Extra Adds For
(none) the package alone using the services in your own pipeline
[example] the daily and silero Pipecat extras the shipped examples need running urun_pipecat.examples.*
[mic] PyAudio and sounddevice on non-Linux on top of the core package the voice-agent microphone example (python -m urun_pipecat.examples.mic) — a terminal transcript UI with user captions on by default (--no-captions runs voice-only, --no-preview drops the live hypothesis preview)
[dev] pytest and the test doubles working on the package itself

Quickstart

Run a complete voice conversation — speech in, transcript, answer, spoken reply back — with no room, microphone, or speaker. The recorded example speaks a WAV into the pipeline exactly like a user and writes the bot's reply back as audio:

git clone https://github.com/urun-sh/urun-pipecat
cd urun-pipecat
python -m venv .venv
.venv/bin/pip install ".[example]"    # from PyPI once the first release is published

export URUN_API_KEY="urun_sk_..."   # a uRun organization API key

# Any spoken-audio question, converted to the strict input contract —
# mono 16-bit 24 kHz PCM WAV:
ffmpeg -i question.wav -ar 24000 -ac 1 -c:a pcm_s16le question-24k.wav

.venv/bin/python -m urun_pipecat.examples.recorded question-24k.wav

The run prints each recognized user turn, the model's answers (with its reasoning, when the model streams it), and writes the bot's speech to urun-bot-reply.wav (change it with -o). The input contract is strict because the realtime transcription session expects it. The run ends when neither side has spoken for --settle-secs seconds (default 2) — counted from the last speech activity, not from pending work — so a deployment whose answer is slower than the settle window ends the run before the reply is spoken; raise --settle-secs for it.

To talk to the bot live, in a Daily room, run the same pipeline as the foundational example instead.

Usage

from urun_pipecat import UrunLLMService

llm = UrunLLMService()  # uses URUN_API_KEY from the environment

or explicitly:

llm = UrunLLMService(
    api_key="urun_sk_...",
    settings=UrunLLMService.Settings(
        model="qwen3.8-27b:nvfp4",  # any id from GET /v1/models
        system_instruction="You are a helpful voice assistant.",
    ),
)

Use it anywhere a Pipecat LLM service fits, e.g. in a Pipeline:

pipeline = Pipeline(
    [
        transport.input(),
        stt,
        user_aggregator,
        llm,  # <- UrunLLMService
        tts,
        transport.output(),
        assistant_aggregator,
    ]
)

See the examples shipped inside the package for complete, runnable voice pipelines:

Three ways to run a voice pipeline

The same trio of models — ears, brain, voice — can run on uRun three ways, and it is worth keeping them apart:

  • A Pipecat-managed cascade is what the three services build: three independent network lanes — a realtime transcription session, a chat-completions stream, a speech-synthesis call — with Pipecat owning the turns. The pipeline's local VAD declares utterance boundaries, the context aggregators assemble the conversation, tools work, and each lane can use any model from GET /v1/models. Every turn pays three network round trips.
  • A speech-to-speech session (uRun's s2s pool) is a different surface, with or without Pipecat: one duplex WebSocket — audio goes up, transcripts and speech come back down — with turn detection server-side. The three models are fixed when the session starts and share one serving stack. No pipeline code is involved; any client that speaks the session protocol can use it.
  • One-GPU colocation is that same session applied to a Pipecat pipeline: UrunColocated keeps the Pipecat graph — transport, context, bookkeeping — and moves the trio onto one speech-to-speech session, so the three models share one GPU stack behind a single socket instead of three lanes.
Standalone cascade Speech-to-speech session UrunColocated
Who runs the turn Pipecat (local VAD, aggregators) the session, server-side the session; turns mirrored into the context for bookkeeping
Network three lanes one duplex WebSocket one duplex WebSocket
Models any per lane (GET /v1/models) the session's trio, fixed at dial time the colocatable trio (table below)
Pipecat context, tools, transport full none — no Pipecat involved context and transport carry over; tools and pre-seeded context have no wire path yet (v1)

The rest of this section covers the colocation wrapper.

Colocated voice pipelines

A standalone voice pipeline drives three network lanes — a realtime transcription session, a chat-completions stream, a speech synthesis call — so every turn pays three round trips and the three models sit on three serving stacks. uRun's s2s pool colocates all three on one GPU stack behind a single duplex session (the GPT-Live protocol on /v1/live/sessions): audio goes up one socket, transcripts and speech come back down it, and the models share one weights' memory instead of three HTTP lanes.

UrunColocated(pipeline) moves a pipeline onto that session. Wrapping is recognition, not rewriting: build the standalone pipeline exactly as you already do, then wrap it before constructing the PipelineWorker (the worker runs the pipeline object it was constructed with):

from loguru import logger

from urun_pipecat import UrunColocated, UrunColocationError

try:
    pipeline = UrunColocated(pipeline)  # same models, one session
except UrunColocationError:
    # The application owns the fallback. The library never degrades
    # silently: on any refusal the original pipeline is untouched, so
    # log the downgrade loudly and keep serving the same models on
    # the standalone lanes (or re-raise — the choice is the app's).
    logger.warning("colocation rejected; running the standalone pipeline")

The matcher reads the pipeline's behaviour — the models the services are plumbed to use and the hosts they point at — never their class names, so a pipeline of stock OpenAI-shaped services pointed at uRun wraps exactly as well as one using this package's services. It recognizes the voice shape [transport input, STT, user aggregator, LLM, TTS, transport output, assistant aggregator] and replaces the three services with one UrunColocatedSession; the transport processors and the two context aggregators (so your LLMContext) carry over unchanged. The session derives its URL from the chat/speech base (https://host/v1 becomes wss://host/v1/live/sessions; override with the sessions_url argument), requires the same uRun API key, and connects when the pipeline runs — wrapping is offline-safe.

A trio colocates when each model has a slot on the s2s pool:

Lane Colocatable models (quantization suffix ignored)
STT parakeet-tdt-0.6b-v3, whisper-large-v3-turbo, qwen3-asr-1.7b
LLM qwen3.8-27b, gemma-4-12b, phonellm-mini-alpha-2-nvfp4
TTS qwen3-tts-1.7b-base, qwen3-tts-customvoice, qwen3-tts-voicedesign, kokoro-82m, breeze-tts-2

An uncolocatable model, a different shape, or services pointing at different deployments raises UrunColocationError — the wrap never falls back on its own. What the colocated path does differently, it says at wrap time, loudly:

  • the session speaks the pool's configured default voice — the standalone TTS voice setting has no effect on the colocated path;
  • tools registered on the context cannot be called by the colocated engine, and pre-seeded context messages have no wire path to it (v1);
  • the pool does not yet consume the system instruction (v1) — it is forwarded on the session start for when it does;
  • the session is duplex and turn detection is server-side: it responds to spoken audio, and the local VAD/aggregators mirror the turns into the context for bookkeeping.

Run the colocated example (needs a Daily room):

python -m urun_pipecat.examples.colocated

Environment variables

Variable Required Description
URUN_API_KEY yes (unless api_key is passed) A uRun organization API key.
URUN_BASE_URL no Base URL of the chat and speech lanes, overriding the hosted default.
URUN_STT_BASE_URL no WebSocket base URL of the realtime transcription lane, overriding the hosted default.
URUN_MODEL no Chat model id; any id from GET /v1/models.
URUN_TTS_MODEL no Speech model id.
URUN_STT_MODEL no Transcription model id.
DAILY_ROOM_URL for the foundational and colocated examples Daily room URL for the voice pipeline.
DAILY_TOKEN no Daily meeting token for the foundational example.

Running the examples

The foundational and recorded examples build the same voice pipeline: Silero VAD and the three uRun services — the LLM (UrunLLMService), streaming STT (UrunSTTService over uRun's realtime transcription session, nemotron-3.5-asr:fp16; the pipeline's local VAD drives the commits), and TTS (UrunTTSService: qwen3-tts-customvoice:bf16, voice "Ryan", 24 kHz). The colocated example builds the same graph with the colocatable trio pinned (Parakeet TDT 0.6B v3 → Qwen3.8-27B → Qwen3-TTS) and wraps it with UrunColocated — see the colocation section above.

git clone https://github.com/urun-sh/urun-pipecat
pip install -e "urun-pipecat[example]"    # from PyPI once the first release is published
export URUN_API_KEY="urun_sk_..."

# A live room conversation (needs a Daily room):
export DAILY_ROOM_URL="https://your-domain.daily.co/?room=..."
python -m urun_pipecat.examples.foundational

# Or a recorded one (no room, no microphone): speak a WAV into the
# pipeline and get the bot's reply back as a WAV. The input must be mono
# 16-bit 24 kHz PCM — convert with `ffmpeg -i input.wav -ar 24000 -ac 1
# -c:a pcm_s16le input-24k.wav`.
python -m urun_pipecat.examples.recorded input-24k.wav

# Or talk to the combined voice-agent with your microphone and speakers
# (real hardware, and the PipeWire/PortAudio prerequisites described in
# the [mic example's README](examples/voice-agent-mic/README.md)):
pip install "urun-pipecat[mic]"
python -m urun_pipecat.examples.mic --check-mic   # keyless two-second capture check
python -m urun_pipecat.examples.mic               # a 60-second voice session
python -m urun_pipecat.examples.mic --no-captions # the same, voice-only (no input transcription)

# Or serve the same voice-agent pipeline to a browser over RTVI: a
# single-client WebSocket bot any RTVI client can dial. The paired browser
# client — `@pipecat-ai/client-js` over the WebSocket transport — lives in
# the [examples repository](https://github.com/urun-sh/examples), app
# `rtvi-voice-client`.
python -m urun_pipecat.examples.rtvi_ws --port 8765

Models

uRun has no default model: GET /v1/models with your API key is the authoritative list. The service's default model constant is a convenience only; pass your own via settings=UrunLLMService.Settings(model=...). See the uRun inference API docs for the request/response contract, including how reasoning streams on reasoning_content.

Version compatibility

The package requires Python 3.11+ (CI tests 3.11, 3.12, and 3.13) and is tested with pipecat-ai 1.11.0 (the minimum) and 1.17.0 (current at the time of testing), via pipecat-ai[openai]; the example also needs the daily and silero extras. The dependency is pinned >=1.11.0,<2.0. A pipeline built on these services speaks RTVI when it is fronted by a Pipecat transport bot — the shipped WebSocket bot (urun_pipecat.examples.rtvi_ws, run by the rtvi-voice-client example in the uRun examples repository) is driven by the @pipecat-ai client SDKs; the same pipeline behind any other RTVI-capable transport is reachable the same way.

The test suite runs offline, against local fakes of uRun's lanes, and is run against both versions:

python -m venv .venv-min
.venv-min/bin/pip install "pipecat-ai[openai]==1.11.0" -e ".[dev,example]"
.venv-min/bin/python -m pytest tests -q

python -m venv .venv-current
.venv-current/bin/pip install "pipecat-ai[openai]==1.17.0" -e ".[dev,example]"
.venv-current/bin/python -m pytest tests -q

Troubleshooting

Missing API key. Every service requires a uRun API key at construction — the api_key argument or URUN_API_KEY — and fails there, loudly, not on the first request.

A model id is not accepted. GET /v1/models with your API key is the authoritative model list; the services' default models are conveniences only. Pass your own through each service's Settings.

TTS answers 400 naming voices. uRun validates voice strings server-side against the model's published list and the error names the accepted set — pass one of those.

No final transcripts. uRun's realtime transcription session has no server-side VAD: finals are commit-driven and arrive at utterance boundaries — each local-VAD stop, and input end — and interim text is not durable across boundaries. Keep turn detection off (the service default) and wire a VAD analyzer into the user context aggregator, as the shipped examples do.

The first request is slow. The first request against a model can take longer than warm ones while its serving stack becomes ready; subsequent requests are faster. If a client aborts early, retry the request.

Colocation refuses the pipeline (UrunColocationError). The wrapper never falls back on its own. Check that each lane's model is in the colocatable table above, all three services point at one uRun deployment, the pipeline matches the recognized voice shape (standard aggregator order, no custom processors between them), and the wrap happens before the PipelineWorker is constructed.

The recorded example rejects a WAV. The input must be mono 16-bit 24 kHz PCM WAV — convert with the ffmpeg command in the quickstart.

Pipecat import errors. The package needs pipecat-ai[openai]>=1.11.0,<2.0; older Pipecat 0.x/1.x versions are not supported.

Release notes

Release notes live in CHANGELOG.md; the package is published to PyPI as urun-pipecat.

License

BSD-2-Clause. See LICENSE.

Metadata

Release files for urun-pipecat 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for urun-pipecat 0.1.0
File Size Uploaded Provenance Actions
urun_pipecat-0.1.0.tar.gz 185.9 kB With provenance Details for urun_pipecat-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for urun-pipecat 0.1.0
File Interpreter ABI Platform Actions
urun_pipecat-0.1.0-py3-none-any.whl Python 3 none any Details for urun_pipecat-0.1.0-py3-none-any.whl

Total release size: 285.3 kB

Release files / urun_pipecat-0.1.0.tar.gz

Download URL urun_pipecat-0.1.0.tar.gz
Size 185.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8c4525ad095a2c96080d7fe0e31303c33a1fee5dd007375401b631b1c860c7ed
BLAKE2b-256 checksum
How to use checksums
b7f1bd4d52aed6faf116f9c689d48fb0fe88074e918bc91622814537eb4448ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 2, 2026.

Transparency log

Release files / urun_pipecat-0.1.0-py3-none-any.whl

Download URL urun_pipecat-0.1.0-py3-none-any.whl
Size 99.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e03b8468cfcc74beb7d68fa80cf07bb19e252e243d38ec61ed425a2b555d3dac
BLAKE2b-256 checksum
How to use checksums
a3814d1f0f47ef5a6723f802afaf6c7f84fcf14451c15f9944c29d1603be9aca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 2, 2026.

Transparency log

Security for urun-pipecat 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for urun_pipecat-0.1.0.tar.gz

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 Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page