Skip to content
KugelAudioDocs

Speech to speech

Give your product a voice agent that hears callers, answers in a natural voice and checks your systems when it needs to, over one WebSocket.

On this page

Speech to speech runs on Kugel Fluid 1 (fluid-1). To see where it sits in your system before you write code, read Fit it into your stack.

What you get

FeatureWhat it does
Audio both waysPCM16 at 16 or 24 kHz, or G.711 (audio/pcmu, audio/pcma) at 8 kHz. The agent answers in the format you choose.
TranscriptsBoth sides of the call arrive as text next to the audio.
Your systems in the callThe agent asks your backend when a turn needs it, and tells the caller the result.
InterruptionsThe caller can talk over the agent, and an event tells you to stop playing audio.
OpenAI SDK supportThe endpoint follows the OpenAI Live API, so the official OpenAI Python SDK works with a KugelAudio key, and OpenAI's documentation answers your questions. You need no KugelAudio SDK.

How a call works

  1. Your server opens one WebSocket and starts a session with instructions for the agent.
  2. You stream the caller's audio in. The agent's voice streams back, with text of both sides.
  3. The agent answers what it can from your instructions and the conversation.
  4. When a turn needs your systems, the agent tells you. This is a delegation.
  5. You do the work and send the result. The agent tells the caller.
  6. You close the session, and the event that confirms it reports the seconds used.

Terms

TermWhat it means
SessionOne conversation on one WebSocket. It lasts at most one hour and is not stored.
AgentThe voice the caller talks to. It listens, decides what to do and speaks.
DelegationThe agent's request for help with one turn. It tells you when a turn needs your systems.
Back officeWhatever does the delegated work: your own backend, or a model KugelAudio runs for you.
CommentaryFacts you send for the agent to tell the caller.
ThinkingProgress you send for the agent to know, without saying it.
InstructionsThe agent's brief. You set it at the start and can add to it during the call.

Choose who does the work

Your backendKugelAudio's back office
delegation.typeclientresponses
Who decides how to do the workYour codeA model KugelAudio runs
Who runs your toolsYour codeYour code, when the model asks
Who writes what the caller hearsThe agent, from the facts you sendThe model, word for word
Choose it whenYou already have a backend, or your own agentYou want to list your tools and have a model use them

Use OpenAI's documentation

Speech to speech follows the OpenAI Live API, and you build with OpenAI's own SDK. These pages cover what is KugelAudio's: access, hosts, voices, the back office and limits. For every other question, OpenAI's documentation applies as written:

QuestionOpenAI's documentation
Where do I start?Getting started with GPT-Live
How do I connect, start and close a session, and which audio formats are there?WebSockets
Which events carry audio and transcripts, and how do I mute or add earlier conversation?Managing sessions
How do delegation, commentary, thinking and tools work?Delegation and tools
How do I call it from Python?OpenAI Python SDK

Where KugelAudio differs, Coming from OpenAI Live lists it. Everything not listed there works as OpenAI describes.

Prerequisites

  • An API key allowed Realtime sessions. In the dashboard this is Realtime sessions set to Allowed (realtime:write), or an unrestricted key. See key permissions.

Choose a host

Set the SDK's base_url to one of these, with /v1 at the end. The SDK opens /v1/live/sessions on it.

Hostbase_url
Defaulthttps://api.kugelaudio.com/v1
EUhttps://api.eu.kugelaudio.com/v1
UShttps://api.us.kugelaudio.com/v1

Send the key as the dashboard shows it. The eu- key prefix belongs to the KugelAudio SDKs, so a prefixed key fails here.

Next steps