GPT-Live (realtime voice)
Let an OpenAI GPT-Live voice session ask a deployed decision's questions while the user speaks, then run the decision's policies, destinations and log on its answers.
Goal: a voice assistant built on GPT-Live, OpenAI's realtime voice, has to decide during the call — route the caller, qualify a lead, stop a risky request. GPT-Live can delegate those decisions to OpenAI Decisions while the user speaks. Dcision gives that delegation your deployed decision's questions, and turns the answers into an action with your policies, destinations and execution log.
Why go through Dcision
GPT-Live answers fast because the decision happens inside the voice session. Dcision adds what the session doesn't keep:
- Versioned questions. The session asks the questions of the deployed version — the same ones the API, webhooks and the MCP server run. Change them in the editor and deploy; nothing to edit in the voice app's code.
- Policies. Rules,
minConfidenceand theotheroption turn the answers intocontinue,block,escalateorfallback— see Policies and actions. - Refusals. A question the model declines to answer gets the decision's fallback action, with
action_reason: { "type": "refusal", "question": … }. - Destinations. Webhooks, functions, fixed replies and the other destinations fire on the outcome.
- Audit and statistics. Every call is an execution in Executions, and counts in the decision's Overview.
How it works
- Your server reads the delegation of a deployed decision:
GET /v1/decisions/{slug}/openai-live. - It puts
delegationin the GPT-Live session request (WebRTC). GPT-Live then calls OpenAI Decisions itself — native delegation — with those questions. - The session sends
session.delegation.created: savedelegation.id, to recognize the events of this delegation. - Each time the session decides, it sends
decision.completedwith theanswers. - Your server posts those answers to
POST /v1/decisions/{slug}/openai-live/answersand gets the same response as a run:result,confidence,action,action_reason,destinationsandmetrics.
Keep the Dcision API key on your server: the browser or the phone that holds the voice session never sees it.
Export the delegation
Deploy the decision first — the endpoint answers 409 DECISION_NOT_DEPLOYED for a draft. Then:
curl https://api.dcision.io/v1/decisions/lead-qualification/openai-live \
-H "Authorization: Bearer $DCISION_API_KEY"The response holds delegation — { "type": "decisions", "model": "gpt-6-luna", "questions": [ … ] } — and answers_url. Each question has the question key as name, its instructions, and choices or levels with their descriptions. The full response is in the API reference.
Open the Live session
The code below is illustrative: the session request, the WebRTC handshake and the events follow OpenAI's GPT-Live guide. Only delegation comes from Dcision.
const live = await fetch("https://api.dcision.io/v1/decisions/lead-qualification/openai-live", {
headers: { Authorization: `Bearer ${process.env.DCISION_API_KEY}` },
}).then((response) => response.json());
const sessionRequest = {
// …model, voice, instructions and the rest of your GPT-Live session settings
delegation: live.delegation, // { type: "decisions", model, questions }
};The OpenAI key that opens the Live connection needs the api.decisions.write permission.
Forward the answers
let delegationId = null;
function onLiveEvent(event) {
if (event.type === "session.delegation.created") delegationId = event.delegation.id;
if (event.type === "decision.completed") {
// Your server calls Dcision with its API key.
fetch("/live/answers", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ answers: event.answers }),
});
}
}app.post("/live/answers", async (request, response) => {
const decision = await fetch("https://api.dcision.io/v1/decisions/lead-qualification/openai-live/answers", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.DCISION_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ answers: request.body.answers }),
}).then((res) => res.json());
if (decision.action === "block") return response.json({ say: "I can't help with that one." });
if (decision.action === "escalate") return response.json({ transfer: true, reason: decision.action_reason });
return response.json({ route: decision.result.route });
});Send the answers as the event carries them: predicate, choice, score or refusal, each with the question's name. Answers that don't match the deployed questions — a missing question, a choice that isn't an option — answer 400 INVALID_REQUEST. Add model and usage (input_tokens, output_tokens) when you have them; they are recorded with the execution.
Add context with state. The answers endpoint takes an optional state: the app's own data during the call — the customer id, the cart, the account. It is validated against the decision's state schema and reaches destinations ({{state.customer_id}}) and the execution log. To let the session decide on that data too, send the same snapshot to the session with decision.item.create.
During the session
- New questions mid-call. After a deploy, export the delegation again and send it with
session.update; a call that is already running keeps its questions until then. - React to the transcript.
session.triggerswithsession.input_transcript.deltaorsession.output_transcript.deltalets the session act on what is being said — see OpenAI's guide. - Custom delegation. Instead of native delegation, GPT-Live can hand the decision to your app. Your app can then call
POST /v1/decisions/{slug}with the transcript as the state; it adds a round trip, but runs on any engine.
Billing and limits
- Each call to the answers endpoint is billed like a run: it counts toward the plan's included decisions and then uses credits. Exporting the delegation is a read and isn't billed.
metrics.engineis"openai"andmetrics.estimated_cost_usdis0: OpenAI bills the Live session, decisions included, to your OpenAI account.- The execution has source API, provider OpenAI and credential live. Shadow mode doesn't run on these answers.
- The answers endpoint shares the decisions rate-limit window and doesn't support
Idempotency-Key: a retry runs — and is billed — again.