NAME
OpenAPI::Client::OpenAI::Path::realtime-sessions - Documentation for the /realtime/sessions path.
DESCRIPTION
This document describes the API endpoint at /realtime/sessions.
PATHS
POST /realtime/sessions
Create session
Create an ephemeral API token for use in client-side applications with the Realtime API. Can be configured with the same session parameters as the session.update client event.
It responds with a session object, plus a client_secret key which contains a usable ephemeral API token that can be used to authenticate browser clients for the Realtime API.
Operation ID
create-realtime-session
$client->create-realtime-session( ... );
Parameters
Request Body
Content Type: application/json
A new Realtime session configuration, with an ephemeral key. Default TTL
for keys is one minute.
Example:
"{\n \"id\": \"sess_001\",\n \"object\": \"realtime.session\",\n \"model\": \"gpt-realtime-2025-08-25\",\n \"modalities\": [\"audio\", \"text\"],\n \"instructions\": \"You are a friendly assistant.\",\n \"voice\": \"alloy\",\n \"input_audio_format\": \"pcm16\",\n \"output_audio_format\": \"pcm16\",\n \"input_audio_transcription\": {\n \"model\": \"whisper-1\"\n },\n \"turn_detection\": null,\n \"tools\": [],\n \"tool_choice\": \"none\",\n \"temperature\": 0.7,\n \"speed\": 1.1,\n \"tracing\": \"auto\",\n \"max_response_output_tokens\": 200,\n \"truncation\": \"auto\",\n \"prompt\": null,\n \"client_secret\": {\n \"value\": \"ek_abc123\",\n \"expires_at\": 1234567890\n }\n}\n"
Responses
Status Code: 200
Session created successfully.
Content Types:
application/jsonExample (See the OpenAI spec for more detail):
{ "id": "sess_001", "object": "realtime.session", "expires_at": 1742188264, "model": "gpt-realtime", "output_modalities": ["audio"], "instructions": "You are a friendly assistant.", "tools": [], "tool_choice": "none", "max_output_tokens": "inf", "tracing": "auto", "truncation": "auto", "prompt": null, "audio": { "input": { "format": { "type": "audio/pcm", "rate": 24000 }, "transcription": { "model": "whisper-1" }, "noise_reduction": null, "turn_detection": null }, "output": { "format": { "type": "audio/pcm", "rate": 24000 }, "voice": "alloy", "speed": 1.0 } } }
SEE ALSO
COPYRIGHT AND LICENSE
Copyright (C) 2023-2026 by Nelson Ferraz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.