Add reasoning.effort support for OpenAI gpt-realtime-2 Feature Type Would make my life…
- User
Add reasoning.effort support for OpenAI gpt-realtime-2
Feature Type
Would make my life easier
Feature Description
OpenAI
gpt-realtime-2supports configurable reasoning viareasoning.effort, but the Python OpenAI Realtime plugin does not seem to expose this option onopenai.realtime.RealtimeModel.It would be useful to support something like:
from livekit.plugins import openai llm = openai.realtime.RealtimeModel( model="gpt-realtime-2", reasoning={"effort": "low"}, )Workarounds / Alternatives
I don't think there is a clean workaround through the current Python
RealtimeModelAPI.The only workaround I can see is patching the plugin locally to add
reasoningto the session update payload.Additional Context
OpenAI docs list these effort values:
minimal,low,medium,high,xhigh.References:
- https://developers.openai.com/api/docs/models/gpt-realtime-2
- https://developers.openai.com/api/docs/guides/realtime-models-prompting#set-reasoning-effort
- Related JS issue: https://github.com/livekit/agents-js/issues/1433
- Related JS PR: https://github.com/livekit/agents-js/pull/1575
Interface
No new interfaces are introduced.
- Assistant
Now let me check what the installed OpenAI SDK supports for reasoning on realtime sessions:
- Assistant
The SDK already supports
reasoning. Let me check its type: - Assistant
Let me check which openai version introduced
RealtimeReasoning: - Assistant
Now let me check the tests directory for existing realtime tests:
- Assistant
Now I'll implement. First, the converter in
utils.py: - Assistant
Now
realtime_model.py— imports first: - Assistant
Add to
_RealtimeOptions: - Assistant
Now the overloads and
__init__: - Assistant
Now the actual
__init__signature and docstring: - Assistant
Now the
_RealtimeOptionsconstruction: - Assistant
Now the model-level
update_options: - Assistant
Now bump the openai dependency minimum since
RealtimeReasoningwas added in openai 2.36.0: - Assistant
Now verify with a smoke test that the session.update payload includes reasoning:
- Assistant
All paths work. Now run lint, format check, and mypy on the touched files:
- Assistant
Same 3 errors exist on HEAD — my changes introduce no new type errors. Let me also run the project's own type-check for the openai plugin:
- Assistant
The uv.lock change is under the
livekit-plugins-openaipackage entry (it has avertexoptional extra), so everything is consistent. All checks pass:ruff format --check/ruff check— cleanmypy -p livekit.plugins.openai(project config) — no issues; the 3 raw--strictwarnings pre-exist on HEAD- Smoke test verified end-to-end payloads
Summary of changes
livekit-plugins-openai/.../realtime/realtime_model.py- Added a
reasoningparameter toRealtimeModel.__init__(both overloads and the implementation), accepting aRealtimeReasoningobject, a dict like , or a plain effort string ().
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.