Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

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.

Create translation client secret

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 example
{
  "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"
      }
    }
  }
}
Body Parameters
JSON
session: RealtimeTranslationSessionCreateRequest { model, audio }

Realtime translation session configuration. Translation sessions stream source audio in and translated audio plus transcript deltas out continuously.

model: string

The 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, strength } or null

Optional input noise reduction. Set to null to disable it.

Type of noise reduction. near_field is for close-talking microphones such as headphones, far_field is for far-field microphones such as laptop or conference room microphones.

One of the following:
"near_field"
"far_field"
strength: optional number (default: 1)

Input noise suppression strength. Higher values apply more suppression. Defaults to 1 when noise reduction is first enabled. Omitting strength from a session update preserves the current strength.

minimum0
maximum1
transcription: optional object { model } or null

Optional source-language transcription. When configured, the server emits session.input_transcript.delta events. Translation itself still runs from the input audio stream.

model: string

The transcription model to use for source transcript deltas.

output: optional object { language }
language: optional string

Target 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" (default: "created_at")

The anchor point for the client secret expiration, meaning that seconds will be added to the created_at time of the client secret to produce an expiration timestamp. Only created_at is currently supported.

seconds: optional integer (default: 600)

The number of seconds from the anchor point to the expiration. Select a value between 10 and 7200 (2 hours). This default to 600 seconds (10 minutes) if not specified.

formatint64
minimum10
maximum7200
Returns
RealtimeTranslationClientSecretCreateResponse object { expires_at, session, value }

Response from creating a translation session and client secret for the Realtime API.

expires_at: integer

Expiration timestamp for the client secret, in seconds since epoch.

formatunixtime
session: RealtimeTranslationSession { id, audio, expires_at, 2 more }

A Realtime translation session. Translation sessions continuously translate input audio into the configured output language.

id: string

Unique 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, strength } or null

Optional input noise reduction.

Type of noise reduction. near_field is for close-talking microphones such as headphones, far_field is for far-field microphones such as laptop or conference room microphones.

One of the following:
"near_field"
"far_field"
strength: optional number (default: 1)

Input noise suppression strength. Higher values apply more suppression. Defaults to 1 when noise reduction is first enabled. Omitting strength from a session update preserves the current strength.

minimum0
maximum1
transcription: optional object { model } or null

Optional source-language transcription. When configured, the server emits session.input_transcript.delta events. Translation itself still runs from the input audio stream.

model: string

The transcription model used for source transcript deltas.

output: optional object { language }
language: optional string

Target language for translated output audio and transcript deltas.

expires_at: integer

Expiration timestamp for the session, in seconds since epoch.

formatunixtime
model: string

The 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 translation for Realtime translation sessions.

value: string

The generated client secret value.

Returns Examples
Response example
{
  "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"
      }
    }
  }
}