页面简介
How to use the OpenAI GPT-Live full-duplex model with LiveKit Agents.
正文摘录
Overview GPT-Live is a full-duplex voice model from OpenAI. It listens and speaks at the same time, and it decides when each turn starts and stops. Under the default responses delegation, it sends its reasoning and tool work to a backend Responses model.The plugin implements GPT-Live as a duplex model, and an adapter presents it to the framework as a realtime model. Pass it to AgentSession in place of an LLM.GPT-Live is available in LiveKit Agents through LiveKit Inference and the OpenAI plugin. With LiveKit Inference, you use your LiveKit Cloud credentials instead of a separate OpenAI API key, and LiveKit Cloud bills you for usage. Use the plugin instead if you want to manage your own billing or use OpenAI hosted tools.GPT-Live differs from the OpenAI Realtime API in these ways:Server-driven. No client event creates, cancels, or truncates a response. The model starts and ends its own turns.Model-controlled barge-in. GPT-Live listens while it speaks, and it decides when to stop. The framework can stop the audio it plays to the user, but the model keeps talking until it stops on its own.Delegated reasoning. The voice model handles the conversation. A separate backend model handles the reasoning and decides which tools to call.Append-only context. You can load a conversation before the session starts, and append new items after it starts. You can't change or delete an item.No realtime hybrid. GPT-Live has no text-only response modality, so you can't pair it with a TTS plugin in a realtime hybrid setup.Audio only. The plugin doesn't support video or image input, including to the backend model, even when that model supports images on its own.Split instructions. The voice model and the backend model take separate instruction sets, so a turn-based agent's prompt doesn't carry over unchanged. See Prompting GPT-Live in the OpenAI documentation.LiveKit Inference Use LiveKit Inference to access GPT-Live without a separate OpenAI API key.The following table lists the GPT-Live models available through LiveKit Inference.A checkmark in the EU endpoint column means the model has a dedicated EU endpoint, in addition to the global endpoint. To learn more, see Data residency.Model nameModel IDEU endpointGPT-Live 1openai/gpt-live-1EU endpointUsage Use the DuplexModel class from the inference module to run GPT-Live through LiveKit Inference. In Python, pass delegation and responses_options through extra_kwargs. In Node.js, pass delegation and responsesOptions through modelOptions. You can use this model in the Voice AI quickstart:PythonNode.jsfrom livekit.agents import AgentSession, inference session = AgentSession( llm=inference.DuplexModel( model="openai/gpt-live-1", voice="marin", extra_kwargs={ # backend Responses model that handles the reasoning and the tool calls "responses_options": { "model": "gpt-5.6-luna", "instructions": "Use tools when current information is required.", }, }, ),)import { AgentSession, inference } from '@livekit/agents'; const session = new AgentSession({ llm: new inference.DuplexModel({ model: 'openai/gpt-live-1', voice: 'marin', modelOptions: { // backend Responses model that handles the reasoning and the tool calls responsesOptions: { model: 'gpt-5.6-luna', instructions: 'Use tools when current information is required.', }, }, }),});Authentication uses your LiveKit Cloud credentials. Set LIVEKIT_API_KEY and LIVEKIT_API_SECRET in your .env file, or pass api_key and api_secret directly. In Node.js, these parameters are apiKey and apiSecret.Parameters The following are the main parameters for configuring GPT-Live with LiveKit Inference. For a complete list, see the API reference for Python and Node.js.modelRequiredstringThe model to use: openai/gpt-live-1.voicestringDefault: 'marin'Voice for speech output. You can't change it after the session starts.extra_kwargsOpenAIDuplexOptionsGPT-Live options. Set delegation to responses, which is the default, or to client, as described in Delegation. Set responses_options to configure the backend model, as described in Backend model options.In Node.js, use modelOptions.providerstringDeprecated. Support for provider pinning ends on March 1, 2027. Omit provider to let LiveKit route requests and use fallback providers. See provider pinning deprecation for migration guidance.api_keystringLiveKit API key. Defaults to the LIVEKIT_API_KEY environment variable.In Node.js, use apiKey.api_secretstringLiveKit API secret. Defaults to the LIVEKIT_API_SECRET environment variable.In Node.js, use apiSecret.String descriptorsAs a shortcut, you can also pass the model ID directly to the llm argument in your AgentSession:PythonNode.jsfrom livekit.agents import AgentSession session = AgentSession( llm="openai/gpt-live-1",)import { AgentSession } from '@livekit/agents'; const session = new AgentSession({ llm: 'openai/gpt-live-1',});Plugin Use the OpenAI plugin to connect directly to GPT-Live with your own OpenAI API key. Available inPython|Node.jsInstallation GPT-Live is part of the OpenAI plugin:PythonNode.jsuv add "livekit-agents[openai]~=1.8"pnpm add "@livekit/agents-plugin-openai@1.x"Authentication The OpenAI plugin requires an OpenAI API key on a paid usage tier. GPT-Live isn't available on the Free tier.Set OPENAI_API_KEY in your .env file.Usage Use GPTLiveModel within an AgentSession. For example, you can use it in the Voice AI quickstart.PythonNode.jsfrom livekit.agents import AgentSessionfrom livekit.plugins import openai session = AgentSession( llm=openai.realtime.GPTLiveModel( voice="marin", # backend Responses model that handles the reasoning and the tool calls responses_options={ "model": "gpt-5.6-luna", "instructions": "Use tools when current information is required.", }, ),)import { voice } from '@livekit/agents';import * as openai from '@livekit/agents-plugin-openai'; const session = new voice.AgentSession({ llm: new openai.realtime.GPTLiveModel({ voice: 'marin', // backend Responses model that handles the reasoning and the tool calls responsesOptions: { model: 'gpt-5.6-luna', instructions: 'Use tools when current information is required.', }, }),});Parameters This section describes some of the available parameters. For a complete reference of all available parameters, see the plugin reference links in the Additional resources section.modelstrDefault: gpt-live-1GPT-Live voice model slug.voicestr | dictDefault: marinVoice for speech output: a name such as marin, or {"id": "voice_..."} for a custom voice that your account can use. You can't change it after the session starts.delegationLiteral['responses', 'client']Default: responsesThe destination for delegated work. You can't change it after the session starts. See Delegation.responses_optionsResponsesDelegationOptionsSettings for the backend Responses model, used with responses delegation. See Backend model options.api_keyRequiredstrEnv: OPENAI_API_KEYOpenAI API key.max_session_durationfloat | NoneSeconds before the plugin opens a new connection. The new connection receives the full conversation again, and the model continues from the point where the connection stopped.Backend model options Under responses delegation, GPT-Live sends delegated work to a backend Responses model, which you configure with responses_options. With the plugin, pass it to GPTLiveModel. With LiveKit Inference, pass it inside extra_kwargs. In Node.js, use responsesOptions, inside modelOptions for LiveKit Inference.The responses_options dictionary accepts the following keys. Only model has a default. LiveKit Agents leaves out every other key you don't set, so the OpenAI default for that key applies. For those defaults, see the Responses API reference in the OpenAI documentation.KeyTypeNotesmodelstrResponses model slug. Defaults to gpt-5.6-luna. With LiveKit Inference, use an OpenAI LLM that LiveKit Inference serves.instructionsstrInstructions for the backend model, separate from the voice model's. See Voice and backend instructions.tool_choiceToolChoice | NoneWhether the backend model must call a tool: auto, required, none (call no tool), or a named tool. Python's None is not the same as none: it sends auto.parallel_tool_callsboolWhether the backend model can request more than one tool call at a time.reasoningReasoningResponses reasoning settings, such as {"effort": "medium"}.textResponseTextConfigParamResponses text settings, such as {"verbosity": "low"}.service_tierLiteral['auto', 'default', 'flex', 'priority']Latency and pricing tier for the backend request. With LiveKit Inference, leave it unset or set it to default.max_output_tokensintUpper bound on the tokens one backend response generates. Minimum 16.Voice and backend instructions Two sets of instructions configure GPT-Live, and you can't change either set after the session starts:The voice model takes the agent's instructions: how to converse, when to delegate, and what to say while the work is underway. Set them on the Agent. GPTLiveModel has no instructions parameter.The backend model takes the instructions key of responses_options: how to handle delegated work, which tools to use, and what to hand back to the voice model.The voice model doesn't see the tools, so don't describe them in the persona. Say which requests to delegate and which to answer directly. Without that, the model delegates small talk, or tries to answer a question it has no information about.Prompting GPT-LiveGPT-Live needs a different prompt shape than a turn-based model: the persona, the delegation rules, and the backend procedure each live in a different place. If you're adapting an existing agent, read Prompting GPT-Live in the OpenAI documentation before you reuse its instructions.PythonNode.jsfrom livekit.agents import Agentfrom livekit.plugins import openai class Assistant(Agent): def __init__(self) -> None: super().__init__( # voice persona: the top-level GPT-Live instructions instructions=( "You are a helpful voice assistant for an online furniture store. " "Keep replies short and conversational. " "Ask bef