Skip to content
orukSign up
Speech-to-textVoice agentsModelsPricingResearchAPI docsQuickstartSDKsMCP serverIntegrationsBenchmarksStatusLog in

LiveKit audio to Oruk Realtime

A Python process joins your LiveKit room, subscribes to a participant’s audio track and forwards it to Oruk Realtime. LiveKit resamples the track to mono 16 kHz, which is what Realtime expects, so no conversion is needed. The process receives a live transcript and an emotion score for each phrase.

Updated

1. Install

Shell
python -m pip install livekit "websockets>=14"
export ORUK_API_KEY=... LIVEKIT_URL=wss://your-project.livekit.cloud LIVEKIT_TOKEN=...

The token is a LiveKit access token for the room, with permission to subscribe.

2. Forward a track

One Realtime session for each audio track.

forward.py
import asyncio, json, os

import websockets
from livekit import rtc

ORUK_URL = "wss://speech-api.oruk.ai/v1/realtime?model=oruk-realtime"


async def forward(track: rtc.Track) -> None:
    """Send one participant's audio to Oruk Realtime and print what comes back."""
    async with websockets.connect(
        ORUK_URL,
        subprotocols=["oruk-realtime"],
        additional_headers={"Authorization": f"Bearer {os.environ['ORUK_API_KEY']}"},
    ) as oruk:
        await oruk.send(json.dumps({
            "type": "session.update",
            "session": {"model": "oruk-realtime", "language": "auto",
                        "sample_rate": 16000, "phrase_emotions": True},
        }))

        async def send_audio() -> None:
            # LiveKit resamples to mono 16 kHz; frame.data is signed 16-bit PCM.
            async for event in rtc.AudioStream(track, sample_rate=16000, num_channels=1):
                await oruk.send(event.frame.data.tobytes())
            await oruk.send(json.dumps({"type": "input_audio_buffer.commit"}))

        async def read_events() -> None:
            async for message in oruk:
                event = json.loads(message)
                if event["type"] == "conversation.item.input_audio_transcription.completed":
                    print("said", event)
                elif event["type"] == "conversation.item.input_audio_emotion.completed":
                    print("sounded", event)

        await asyncio.gather(send_audio(), read_events())


async def main() -> None:
    room = rtc.Room()
    tasks: set[asyncio.Task] = set()

    @room.on("track_subscribed")
    def on_track(track: rtc.Track, publication, participant) -> None:
        if track.kind == rtc.TrackKind.KIND_AUDIO:
            task = asyncio.create_task(forward(track))
            tasks.add(task)
            task.add_done_callback(tasks.discard)

    await room.connect(os.environ["LIVEKIT_URL"], os.environ["LIVEKIT_TOKEN"])
    await asyncio.Event().wait()


asyncio.run(main())

Reference code, written against LiveKit’s Python SDK and Oruk’s published Realtime protocol. Run it in your own room before production.

Questions

Is this a LiveKit Agents plugin?
No. It is a room participant that forwards audio, built on the LiveKit Python SDK. Oruk does not publish a LiveKit Agents speech-to-text plugin. The maintained framework adapter is for Pipecat.
Can I use the transcripts in a LiveKit agent?
Yes. Run the forwarder inside your agent process and hand each final transcript, with its tone scores, to your language model.
How many participants can one process handle?
One Realtime session for each audio track. The example opens a session whenever a track is subscribed.
What happens after ten minutes?
A Realtime session ends. Open a new one for the same track and keep forwarding.

Try it on your own audio.

The demo needs no account. The trial needs a card.