NAME
OpenAPI::Client::OpenAI::Path::realtime-client_secrets - Documentation for the /realtime/client_secrets path.
OPERATIONS
POST /realtime/client_secrets
create-realtime-client-secret
$client->create_realtime_client_secret({
body => { ... },
});
Create a Realtime client secret with an associated session configuration.
Client secrets are short-lived tokens that can be passed to a client app, such as a web frontend or mobile client, which grants access to the Realtime API without leaking your main API key. You can configure a custom TTL for each client secret.
You can also attach session configuration options to the client secret, which will be applied to any sessions created using that client secret, but these can also be overridden by the client connection.
Learn more about authentication with client secrets over WebRTC .
Returns the created client secret and the effective session object. The client secret is a string that looks like ek_1234 .
Responses
200 - Client secret created successfully.
Content-Type: application/json
Example:
{
"expires_at" : 1756310470,
"session" : {
"audio" : {
"input" : {
"format" : {
"rate" : 24000,
"type" : "audio/pcm"
},
"noise_reduction" : null,
"transcription" : null,
"turn_detection" : {
"create_response" : true,
"idle_timeout_ms" : null,
"interrupt_response" : true,
"prefix_padding_ms" : 300,
"silence_duration_ms" : 200,
"threshold" : 0.5,
"type" : "server_vad"
}
},
"output" : {
"format" : {
"rate" : 24000,
"type" : "audio/pcm"
},
"speed" : 1,
"voice" : "alloy"
}
},
"expires_at" : 0,
"id" : "sess_C9CiUVUzUzYIssh3ELY1d",
"include" : null,
"instructions" : "You are a friendly assistant.",
"max_output_tokens" : "inf",
"model" : "gpt-realtime-2025-08-25",
"object" : "realtime.session",
"output_modalities" : [
"audio"
],
"prompt" : null,
"tool_choice" : "auto",
"tools" : [],
"tracing" : null,
"truncation" : "auto",
"type" : "realtime"
},
"value" : "ek_68af296e8e408191a1120ab6383263c2"
}
SCHEMAS
RealtimeCreateClientSecretRequest
Properties:
expires_after(object) - Configuration for the client secret expiration. Expiration refers to the time after which a client secret will no longer be valid for creating sessions. The session itself may continue after that time once started. A secret can be used to create multiple sessions until it expires.session(oneOf) - Session configuration to use for the client secret. Choose either a realtime session or a transcription session.
RealtimeCreateClientSecretResponse
Properties:
expires_at(integer, required) - Expiration timestamp for the client secret, in seconds since epoch.session(oneOf, required) - The session configuration for either a realtime or transcription session.value(string, required) - The generated client secret value.
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.