Translations
Client Secrets
Create translation client secret
post /realtime/translations/client_secrets
Create a Realtime translation client secret with an associated translation 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 Translation API without leaking your main API key. You can configure a custom TTL for each client secret.
Returns the created client secret and the effective translation session object.
The client secret is a string that looks like ek_1234.
Body Parameters
-
session: RealtimeTranslationSessionCreateRequestRealtime translation session configuration. Translation sessions stream source audio in and translated audio plus transcript deltas out continuously.
-
model: stringThe Realtime translation model used for this session.
-
audio: optional object { input, output }Configuration for translation input and output audio.
-
input: optional object { noise_reduction, transcription }-
noise_reduction: optional object { type }Optional input noise reduction. Set to
nullto disable it.-
type: NoiseReductionTypeType of noise reduction.
near_fieldis for close-talking microphones such as headphones,far_fieldis for far-field microphones such as laptop or conference room microphones.-
"near_field" -
"far_field"
-
-
-
transcription: optional object { model }Optional source-language transcription. When configured, the server emits
session.input_transcript.deltaevents. Translation itself still runs from the input audio stream.-
model: stringThe transcription model to use for source transcript deltas.
-
-
-
output: optional object { language }-
language: optional stringTarget language for translated output audio and transcript deltas.
-
-
-
-
expires_after: optional object { anchor, seconds }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.
-
anchor: optional "created_at"The anchor point for the client secret expiration, meaning that
secondswill be added to thecreated_attime of the client secret to produce an expiration timestamp. Onlycreated_atis currently supported."created_at"
-
seconds: optional numberThe number of seconds from the anchor point to the expiration. Select a value between
10and7200(2 hours). This default to 600 seconds (10 minutes) if not specified.
-
Returns
-
RealtimeTranslationClientSecretCreateResponse object { expires_at, session, value }Response from creating a translation session and client secret for the Realtime API.
-
expires_at: numberExpiration timestamp for the client secret, in seconds since epoch.
-
session: RealtimeTranslationSessionA Realtime translation session. Translation sessions continuously translate input audio into the configured output language.
-
id: stringUnique identifier for the session that looks like
sess_1234567890abcdef. -
audio: object { input, output }Configuration for translation input and output audio.
-
input: optional object { noise_reduction, transcription }-
noise_reduction: optional object { type }Optional input noise reduction.
-
type: NoiseReductionTypeType of noise reduction.
near_fieldis for close-talking microphones such as headphones,far_fieldis for far-field microphones such as laptop or conference room microphones.-
"near_field" -
"far_field"
-
-
-
transcription: optional object { model }Optional source-language transcription. When configured, the server emits
session.input_transcript.deltaevents. Translation itself still runs from the input audio stream.-
model: stringThe transcription model used for source transcript deltas.
-
-
-
output: optional object { language }-
language: optional stringTarget language for translated output audio and transcript deltas.
-
-
-
expires_at: numberExpiration timestamp for the session, in seconds since epoch.
-
model: stringThe Realtime translation model used for this session. This field is set at session creation and cannot be changed with
session.update. -
type: "translation"The session type. Always
translationfor Realtime translation sessions."translation"
-
-
value: stringThe generated client secret value.
-
Example
curl https://api.openai.com/v1/realtime/translations/client_secrets \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"session": {
"model": "model"
}
}'
Response
{
"expires_at": 0,
"session": {
"id": "id",
"audio": {
"input": {
"noise_reduction": {
"type": "near_field"
},
"transcription": {
"model": "model"
}
},
"output": {
"language": "language"
}
},
"expires_at": 0,
"model": "model",
"type": "translation"
},
"value": "value"
}
Example
curl -X POST https://api.openai.com/v1/realtime/translations/client_secrets \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"expires_after": {
"anchor": "created_at",
"seconds": 600
},
"session": {
"model": "gpt-realtime-translate",
"audio": {
"input": {
"transcription": {
"model": "gpt-realtime-whisper"
},
"noise_reduction": null
},
"output": {
"language": "es"
}
}
}
}'
Response
{
"value": "ek_68af296e8e408191a1120ab6383263c2",
"expires_at": 1756310470,
"session": {
"id": "sess_C9CiUVUzUzYIssh3ELY1d",
"type": "translation",
"expires_at": 1756310470,
"model": "gpt-realtime-translate",
"audio": {
"input": {
"transcription": {
"model": "gpt-realtime-whisper"
},
"noise_reduction": null
},
"output": {
"language": "es"
}
}
}
}