resources/realtime/subresources/translations/index.md +0 −246 deleted
File Deleted View Diff
1# Translations
2
3# Client Secrets
4
5## Create translation client secret
6
7**post** `/realtime/translations/client_secrets`
8
9Create a Realtime translation client secret with an associated translation session configuration.
10
11Client secrets are short-lived tokens that can be passed to a client app,
12such as a web frontend or mobile client, which grants access to the Realtime
13Translation API without leaking your main API key. You can configure a custom
14TTL for each client secret.
15
16Returns the created client secret and the effective translation session object.
17The client secret is a string that looks like `ek_1234`.
18
19### Body Parameters
20
21- `session: RealtimeTranslationSessionCreateRequest`
22
23 Realtime translation session configuration. Translation sessions stream source
24 audio in and translated audio plus transcript deltas out continuously.
25
26 - `model: string`
27
28 The Realtime translation model used for this session.
29
30 - `audio: optional object { input, output }`
31
32 Configuration for translation input and output audio.
33
34 - `input: optional object { noise_reduction, transcription }`
35
36 - `noise_reduction: optional object { type }`
37
38 Optional input noise reduction. Set to `null` to disable it.
39
40 - `type: NoiseReductionType`
41
42 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.
43
44 - `"near_field"`
45
46 - `"far_field"`
47
48 - `transcription: optional object { model }`
49
50 Optional source-language transcription. When configured, the server emits
51 `session.input_transcript.delta` events. Translation itself still runs from
52 the input audio stream.
53
54 - `model: string`
55
56 The transcription model to use for source transcript deltas.
57
58 - `output: optional object { language }`
59
60 - `language: optional string`
61
62 Target language for translated output audio and transcript deltas.
63
64- `expires_after: optional object { anchor, seconds }`
65
66 Configuration for the client secret expiration. Expiration refers to the time after which
67 a client secret will no longer be valid for creating sessions. The session itself may
68 continue after that time once started. A secret can be used to create multiple sessions
69 until it expires.
70
71 - `anchor: optional "created_at"`
72
73 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.
74
75 - `"created_at"`
76
77 - `seconds: optional number`
78
79 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.
80
81### Returns
82
83- `RealtimeTranslationClientSecretCreateResponse object { expires_at, session, value }`
84
85 Response from creating a translation session and client secret for the Realtime API.
86
87 - `expires_at: number`
88
89 Expiration timestamp for the client secret, in seconds since epoch.
90
91 - `session: RealtimeTranslationSession`
92
93 A Realtime translation session. Translation sessions continuously translate input
94 audio into the configured output language.
95
96 - `id: string`
97
98 Unique identifier for the session that looks like `sess_1234567890abcdef`.
99
100 - `audio: object { input, output }`
101
102 Configuration for translation input and output audio.
103
104 - `input: optional object { noise_reduction, transcription }`
105
106 - `noise_reduction: optional object { type }`
107
108 Optional input noise reduction.
109
110 - `type: NoiseReductionType`
111
112 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.
113
114 - `"near_field"`
115
116 - `"far_field"`
117
118 - `transcription: optional object { model }`
119
120 Optional source-language transcription. When configured, the server emits
121 `session.input_transcript.delta` events. Translation itself still runs from
122 the input audio stream.
123
124 - `model: string`
125
126 The transcription model used for source transcript deltas.
127
128 - `output: optional object { language }`
129
130 - `language: optional string`
131
132 Target language for translated output audio and transcript deltas.
133
134 - `expires_at: number`
135
136 Expiration timestamp for the session, in seconds since epoch.
137
138 - `model: string`
139
140 The Realtime translation model used for this session. This field is set at
141 session creation and cannot be changed with `session.update`.
142
143 - `type: "translation"`
144
145 The session type. Always `translation` for Realtime translation sessions.
146
147 - `"translation"`
148
149 - `value: string`
150
151 The generated client secret value.
152
153### Example
154
155```http
156curl https://api.openai.com/v1/realtime/translations/client_secrets \
157 -H 'Content-Type: application/json' \
158 -H "Authorization: Bearer $OPENAI_API_KEY" \
159 -d '{
160 "session": {
161 "model": "model"
162 }
163 }'
164```
165
166#### Response
167
168```json
169{
170 "expires_at": 0,
171 "session": {
172 "id": "id",
173 "audio": {
174 "input": {
175 "noise_reduction": {
176 "type": "near_field"
177 },
178 "transcription": {
179 "model": "model"
180 }
181 },
182 "output": {
183 "language": "language"
184 }
185 },
186 "expires_at": 0,
187 "model": "model",
188 "type": "translation"
189 },
190 "value": "value"
191}
192```
193
194### Example
195
196```http
197curl -X POST https://api.openai.com/v1/realtime/translations/client_secrets \
198 -H "Authorization: Bearer $OPENAI_API_KEY" \
199 -H "Content-Type: application/json" \
200 -d '{
201 "expires_after": {
202 "anchor": "created_at",
203 "seconds": 600
204 },
205 "session": {
206 "model": "gpt-realtime-translate",
207 "audio": {
208 "input": {
209 "transcription": {
210 "model": "gpt-realtime-whisper"
211 },
212 "noise_reduction": null
213 },
214 "output": {
215 "language": "es"
216 }
217 }
218 }
219 }'
220```
221
222#### Response
223
224```json
225{
226 "value": "ek_68af296e8e408191a1120ab6383263c2",
227 "expires_at": 1756310470,
228 "session": {
229 "id": "sess_C9CiUVUzUzYIssh3ELY1d",
230 "type": "translation",
231 "expires_at": 1756310470,
232 "model": "gpt-realtime-translate",
233 "audio": {
234 "input": {
235 "transcription": {
236 "model": "gpt-realtime-whisper"
237 },
238 "noise_reduction": null
239 },
240 "output": {
241 "language": "es"
242 }
243 }
244 }
245}
246```