Live voice sessions
Hold a live voice-to-voice conversation with a realtime model or GPT-Live, with your own instructions, over WebRTC.
POST /v2/audio/live/sessions starts a live spoken conversation between a person and a realtime voice model. You set what the model is and does (instructions), how it sounds (voice) and which functions it may call (tools). The person speaks into a microphone and hears the answer within a fraction of a second; both sides arrive as text, too.
The audio goes directly between the person's device and the model over WebRTC. It never passes through DeutschlandGPT. What runs on our servers is the handshake that starts the call, and a monitoring connection to the same call that books the usage, keeps the transcript and enforces the time limit and your budget.
How a session works
- The device creates a WebRTC peer connection with its microphone track and a data channel named
oai-events, and creates an SDP offer. - Your server sends that offer to
POST /v2/audio/live/sessionswith your API key and your session settings. - The answer contains
answer_sdp. Your server passes it to the device, which sets it as the remote description. The call is live. - Model events (transcripts, function calls) arrive on the device's data channel.
GET /v2/audio/live/sessions/{id}returns the transcript of both sides, the usage and the cost so far.POST /v2/audio/live/sessions/{id}/endhangs up.
Your API key stays on your server. Never ship it in an app or a web page. The device only ever sees the SDP answer, which is not a credential. Only a personal API key (sk_…, created in the dashboard) can start sessions.
Request
| Field | Required | Description |
|---|---|---|
sdp | yes | The SDP offer of the device's peer connection. |
instructions | yes | The system instructions: who the model is, what it should do and say. Up to 20,000 characters. |
model | no | gpt-realtime-2.1 (the default), or gpt-live-1.1 / gpt-live-1 (see GPT-Live). |
voice | no | marin (default), cedar, alloy, ash, ballad, coral, echo, sage, shimmer or verse. |
tools | no | Up to 32 functions your device runs: { "type": "function", "name", "description", "parameters" }. See Tools. |
tool_choice | no | auto (default when tools are set), none or required. |
input_audio_noise_reduction | no | near_field (default: a headset or a phone at the ear; filters background noise and other voices best), far_field (a laptop or speakerphone) or null (off). |
turn_detection | no | When the model treats the speaker as finished. Default { "type": "semantic_vad", "eagerness": "auto" }. Or { "type": "server_vad", "silence_duration_ms": 700 }. interrupt_response (default true) lets the speaker interrupt the model. |
max_duration_seconds | no | Hard limit, 30 to 900 seconds (default 900 = 15 minutes). The call is hung up when it is reached. |
Response
{
"id": "6f1c0a52-…",
"object": "live_voice.session",
"model": "gpt-realtime-2.1",
"voice": "marin",
"status": "active",
"started_at": "2026-11-21T09:30:00.000Z",
"expires_at": "2026-11-21T09:45:00.000Z",
"max_duration_seconds": 900,
"answer_sdp": "v=0\r\no=- …",
"request_id": "req_…"
}
GET /v2/audio/live/sessions/{id} and POST /v2/audio/live/sessions/{id}/end answer with the session, its usage and its transcript:
{
"id": "6f1c0a52-…",
"object": "live_voice.session",
"status": "ended",
"end_reason": "caller",
"usage": {
"active_seconds": 0,
"standby_seconds": 0,
"responses": 4,
"input_text_tokens": 512,
"input_audio_tokens": 610,
"cached_input_tokens": 320,
"output_text_tokens": 401,
"output_audio_tokens": 1180,
"transcription_seconds": 21,
"cost_eur": 0.12
},
"transcript": [
{ "item_id": "item_…", "role": "user", "text": "Wie spät ist es in Tokio?", "created_at": "…" },
{
"item_id": "item_…",
"role": "assistant",
"text": "Dort ist es gerade 19 Uhr.",
"created_at": "…"
}
]
}
end_reason is caller (you ended it), max_duration, insufficient_funds (the credits or a spending limit ran out during the call), access_revoked, provider_closed (the device hung up), provider_error or sideband_lost. The last reply of a call can be booked a few seconds after end; read the session again for the final usage. Transcripts are deleted 24 hours after the session ended, so fetch them before then.
Server: start a session
// Your server (Node 18+). The browser posts its SDP offer here.
app.post('/voice/start', async (req, res) => {
const response = await fetch('https://api.deutschlandgpt.de/v2/audio/live/sessions', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
sdp: req.body.sdp,
instructions: 'You are a friendly assistant. Answer in German, briefly.',
voice: 'marin',
max_duration_seconds: 600,
}),
});
const session = await response.json();
if (!response.ok) return res.status(response.status).json(session);
// Keep session.id on your side; give the browser only the answer.
res.json({ sessionId: session.id, answerSdp: session.answer_sdp });
});
Browser: connect
const pc = new RTCPeerConnection();
const audio = new Audio();
audio.autoplay = true;
pc.ontrack = (event) => (audio.srcObject = event.streams[0]);
const microphone = await navigator.mediaDevices.getUserMedia({ audio: true });
pc.addTrack(microphone.getTracks()[0], microphone);
const events = pc.createDataChannel('oai-events');
events.onmessage = (message) => {
const event = JSON.parse(message.data);
if (event.type === 'response.output_audio_transcript.done')
console.log('Assistant:', event.transcript);
if (event.type === 'conversation.item.input_audio_transcription.completed')
console.log('You:', event.transcript);
};
await pc.setLocalDescription(await pc.createOffer());
const started = await fetch('/voice/start', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ sdp: pc.localDescription.sdp }),
}).then((r) => r.json());
await pc.setRemoteDescription({ type: 'answer', sdp: started.answerSdp });
Tools
Functions in tools run on your side. When the model calls one, the device receives response.function_call_arguments.done on the data channel with call_id, name and arguments. Run the function (on the device, or by asking your server) and send the result back on the same channel:
events.send(
JSON.stringify({
type: 'conversation.item.create',
item: { type: 'function_call_output', call_id: event.call_id, output: JSON.stringify(result) },
}),
);
events.send(JSON.stringify({ type: 'response.create' }));
GPT-Live
gpt-live-1.1 and gpt-live-1 (OpenAI GPT-Live) are a second kind of live voice model. They listen and speak at the same time, so they can answer "mhm" while the caller is still talking. Everything above applies: the same three endpoints, the same WebRTC handshake through your server, the same transcript, limits, model allowlist and § 203 rule. This section lists only what is different.
Start a GPT-Live session
The same request, with these fields:
| Field | Required | Description |
|---|---|---|
sdp | yes | The SDP offer of the device's peer connection (with an oai-events data channel). |
instructions | yes | The system instructions: who the model is, what it should do and say. |
model | yes | gpt-live-1.1 or gpt-live-1. |
voice | no | marin (default), the German voices nuri, juni and flitz, and pearl, quartz, ripple, halo, vesper, willow, stone, gleam, meridian, bossa, tempo, beacon, delta, cinder, calandria, compas, hornero, luciernaga, destello, brise, sillage, nira, harema, shida, noeul. |
max_duration_seconds | no | Hard limit, 30 to 900 seconds (default 900 = 15 minutes). The call is hung up when it is reached. |
tools, tool_choice, input_audio_noise_reduction and turn_detection belong to the realtime model. GPT-Live answers them with 400 and the code unsupported_parameter: it decides on its own when the caller has finished, and it hands tasks to your device in a different way (see below).
const response = await fetch('https://api.deutschlandgpt.de/v2/audio/live/sessions', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
sdp: req.body.sdp,
model: 'gpt-live-1.1',
voice: 'nuri',
instructions: 'Du bist eine freundliche Assistentin. Antworte kurz und auf Deutsch.',
max_duration_seconds: 600,
}),
});
Events on the data channel
GPT-Live sends other events than the realtime model:
session.input_transcript.deltaandsession.output_transcript.delta: pieces of what the caller and the model say, withdelta,start_msandend_ms. Put the pieces of each speaker together yourself, or read the finished transcript withGET /v2/audio/live/sessions/{id}.session.delegation.created: the model hands a task to your device (it carries the delegationid). Do the work, then send the result back on the data channel withsession.commentary.append(the model says it, in its own words) orsession.thinking.append(the model knows it, but does not say it right away). Both takecontent(plain text, up to about 500 tokens) and thedelegation_id.
events.send(
JSON.stringify({
type: 'session.commentary.append',
delegation_id: delegationId,
content: 'Das Paket wird morgen zwischen 10 und 12 Uhr geliefert.',
}),
);
OpenAI describes the full event list in its GPT-Live guide.
Billing
A GPT-Live session is billed per second of the call, as OpenAI reports it: usage.active_seconds (the model listens or speaks) and usage.standby_seconds (paused, billed at a lower price). The token fields stay at 0. OpenAI counts the first 15 seconds as soon as the session starts, and they are part of the total, not added to it. The usage grows about every 15 seconds while the call runs, and the credits and spending limits are checked each time; the call is hung up when they run out. A session starts only when the credits cover the first minute.
Billing and limits
A session is billed to your workspace's credits like every Platform API request. With the realtime model: the model's text and audio tokens at their own prices, and the transcription of the speaker per second. A session can only start when the credits cover at least one full spoken answer. During the call the credits and spending limits are checked after every reply, and the call is hung up when they run out. A workspace can hold 5 sessions at once; one key can start 10 per minute.
An API key with a model allowlist needs the model on it: in the key's permissions, under Live Voice Models. A key without an allowlist (the default) may use it.
Live voice sessions are not available to organisations subject to professional secrecy (§ 203 StGB): the model is hosted in the EU, but its provider is not bound by § 203.