python/resources/audio/subresources/transcriptions/index.md +0 −1718 deleted
File Deleted View Diff
1# Transcriptions
2
3## Create transcription
4
5`audio.transcriptions.create(TranscriptionCreateParams**kwargs) -> TranscriptionCreateResponse`
6
7**post** `/audio/transcriptions`
8
9Transcribes audio into the input language.
10
11Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
12format, or a stream of transcript events.
13
14### Parameters
15
16- `file: FileTypes`
17
18 The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
19
20- `model: Union[str, AudioModel]`
21
22 ID of the model to use. The options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1` (which is powered by our open source Whisper V2 model), and `gpt-4o-transcribe-diarize`.
23
24 - `str`
25
26 - `Literal["whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe", 2 more]`
27
28 - `"whisper-1"`
29
30 - `"gpt-4o-transcribe"`
31
32 - `"gpt-4o-mini-transcribe"`
33
34 - `"gpt-4o-mini-transcribe-2025-12-15"`
35
36 - `"gpt-4o-transcribe-diarize"`
37
38- `chunking_strategy: Optional[ChunkingStrategy]`
39
40 Controls how the audio is cut into chunks. When set to `"auto"`, the server first normalizes loudness and then uses voice activity detection (VAD) to choose boundaries. `server_vad` object can be provided to tweak VAD detection parameters manually. If unset, the audio is transcribed as a single block. Required when using `gpt-4o-transcribe-diarize` for inputs longer than 30 seconds.
41
42 - `Literal["auto"]`
43
44 Automatically set chunking parameters based on the audio. Must be set to `"auto"`.
45
46 - `"auto"`
47
48 - `class ChunkingStrategyVadConfig: …`
49
50 - `type: Literal["server_vad"]`
51
52 Must be set to `server_vad` to enable manual chunking using server side VAD.
53
54 - `"server_vad"`
55
56 - `prefix_padding_ms: Optional[int]`
57
58 Amount of audio to include before the VAD detected speech (in
59 milliseconds).
60
61 - `silence_duration_ms: Optional[int]`
62
63 Duration of silence to detect speech stop (in milliseconds).
64 With shorter values the model will respond more quickly,
65 but may jump in on short pauses from the user.
66
67 - `threshold: Optional[float]`
68
69 Sensitivity threshold (0.0 to 1.0) for voice activity detection. A
70 higher threshold will require louder audio to activate the model, and
71 thus might perform better in noisy environments.
72
73- `include: Optional[List[TranscriptionInclude]]`
74
75 Additional information to include in the transcription response.
76 `logprobs` will return the log probabilities of the tokens in the
77 response to understand the model's confidence in the transcription.
78 `logprobs` only works with response_format set to `json` and only with
79 the models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported when using `gpt-4o-transcribe-diarize`.
80
81 - `"logprobs"`
82
83- `known_speaker_names: Optional[Sequence[str]]`
84
85 Optional list of speaker names that correspond to the audio samples provided in `known_speaker_references[]`. Each entry should be a short identifier (for example `customer` or `agent`). Up to 4 speakers are supported.
86
87- `known_speaker_references: Optional[Sequence[str]]`
88
89 Optional list of audio samples (as [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) that contain known speaker references matching `known_speaker_names[]`. Each sample must be between 2 and 10 seconds, and can use any of the same input audio formats supported by `file`.
90
91- `language: Optional[str]`
92
93 The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency.
94
95- `prompt: Optional[str]`
96
97 An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`.
98
99- `response_format: Optional[AudioResponseFormat]`
100
101 The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported format is `json`. For `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and `diarized_json`, with `diarized_json` required to receive speaker annotations.
102
103 - `"json"`
104
105 - `"text"`
106
107 - `"srt"`
108
109 - `"verbose_json"`
110
111 - `"vtt"`
112
113 - `"diarized_json"`
114
115- `stream: Optional[Literal[false]]`
116
117 If set to true, the model response data will be streamed to the client
118 as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
119 See the [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
120 for more information.
121
122 Note: Streaming is not supported for the `whisper-1` model and will be ignored.
123
124 - `false`
125
126- `temperature: Optional[float]`
127
128 The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
129
130- `timestamp_granularities: Optional[List[Literal["word", "segment"]]]`
131
132 The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.
133 This option is not available for `gpt-4o-transcribe-diarize`.
134
135 - `"word"`
136
137 - `"segment"`
138
139### Returns
140
141- `TranscriptionCreateResponse`
142
143 Represents a transcription response returned by model, based on the provided input.
144
145 - `class Transcription: …`
146
147 Represents a transcription response returned by model, based on the provided input.
148
149 - `text: str`
150
151 The transcribed text.
152
153 - `logprobs: Optional[List[Logprob]]`
154
155 The log probabilities of the tokens in the transcription. Only returned with the models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` array.
156
157 - `token: Optional[str]`
158
159 The token in the transcription.
160
161 - `bytes: Optional[List[float]]`
162
163 The bytes of the token.
164
165 - `logprob: Optional[float]`
166
167 The log probability of the token.
168
169 - `usage: Optional[Usage]`
170
171 Token usage statistics for the request.
172
173 - `class UsageTokens: …`
174
175 Usage statistics for models billed by token usage.
176
177 - `input_tokens: int`
178
179 Number of input tokens billed for this request.
180
181 - `output_tokens: int`
182
183 Number of output tokens generated.
184
185 - `total_tokens: int`
186
187 Total number of tokens used (input + output).
188
189 - `type: Literal["tokens"]`
190
191 The type of the usage object. Always `tokens` for this variant.
192
193 - `"tokens"`
194
195 - `input_token_details: Optional[UsageTokensInputTokenDetails]`
196
197 Details about the input tokens billed for this request.
198
199 - `audio_tokens: Optional[int]`
200
201 Number of audio tokens billed for this request.
202
203 - `text_tokens: Optional[int]`
204
205 Number of text tokens billed for this request.
206
207 - `class UsageDuration: …`
208
209 Usage statistics for models billed by audio input duration.
210
211 - `seconds: float`
212
213 Duration of the input audio in seconds.
214
215 - `type: Literal["duration"]`
216
217 The type of the usage object. Always `duration` for this variant.
218
219 - `"duration"`
220
221 - `class TranscriptionDiarized: …`
222
223 Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations.
224
225 - `duration: float`
226
227 Duration of the input audio in seconds.
228
229 - `segments: List[TranscriptionDiarizedSegment]`
230
231 Segments of the transcript annotated with timestamps and speaker labels.
232
233 - `id: str`
234
235 Unique identifier for the segment.
236
237 - `end: float`
238
239 End timestamp of the segment in seconds.
240
241 - `speaker: str`
242
243 Speaker label for this segment. When known speakers are provided, the label matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially using capital letters (`A`, `B`, ...).
244
245 - `start: float`
246
247 Start timestamp of the segment in seconds.
248
249 - `text: str`
250
251 Transcript text for this segment.
252
253 - `type: Literal["transcript.text.segment"]`
254
255 The type of the segment. Always `transcript.text.segment`.
256
257 - `"transcript.text.segment"`
258
259 - `task: Literal["transcribe"]`
260
261 The type of task that was run. Always `transcribe`.
262
263 - `"transcribe"`
264
265 - `text: str`
266
267 The concatenated transcript text for the entire audio input.
268
269 - `usage: Optional[Usage]`
270
271 Token or duration usage statistics for the request.
272
273 - `class UsageTokens: …`
274
275 Usage statistics for models billed by token usage.
276
277 - `input_tokens: int`
278
279 Number of input tokens billed for this request.
280
281 - `output_tokens: int`
282
283 Number of output tokens generated.
284
285 - `total_tokens: int`
286
287 Total number of tokens used (input + output).
288
289 - `type: Literal["tokens"]`
290
291 The type of the usage object. Always `tokens` for this variant.
292
293 - `"tokens"`
294
295 - `input_token_details: Optional[UsageTokensInputTokenDetails]`
296
297 Details about the input tokens billed for this request.
298
299 - `audio_tokens: Optional[int]`
300
301 Number of audio tokens billed for this request.
302
303 - `text_tokens: Optional[int]`
304
305 Number of text tokens billed for this request.
306
307 - `class UsageDuration: …`
308
309 Usage statistics for models billed by audio input duration.
310
311 - `seconds: float`
312
313 Duration of the input audio in seconds.
314
315 - `type: Literal["duration"]`
316
317 The type of the usage object. Always `duration` for this variant.
318
319 - `"duration"`
320
321 - `class TranscriptionVerbose: …`
322
323 Represents a verbose json transcription response returned by model, based on the provided input.
324
325 - `duration: float`
326
327 The duration of the input audio.
328
329 - `language: str`
330
331 The language of the input audio.
332
333 - `text: str`
334
335 The transcribed text.
336
337 - `segments: Optional[List[TranscriptionSegment]]`
338
339 Segments of the transcribed text and their corresponding details.
340
341 - `id: int`
342
343 Unique identifier of the segment.
344
345 - `avg_logprob: float`
346
347 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
348
349 - `compression_ratio: float`
350
351 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
352
353 - `end: float`
354
355 End time of the segment in seconds.
356
357 - `no_speech_prob: float`
358
359 Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent.
360
361 - `seek: int`
362
363 Seek offset of the segment.
364
365 - `start: float`
366
367 Start time of the segment in seconds.
368
369 - `temperature: float`
370
371 Temperature parameter used for generating the segment.
372
373 - `text: str`
374
375 Text content of the segment.
376
377 - `tokens: List[int]`
378
379 Array of token IDs for the text content.
380
381 - `usage: Optional[Usage]`
382
383 Usage statistics for models billed by audio input duration.
384
385 - `seconds: float`
386
387 Duration of the input audio in seconds.
388
389 - `type: Literal["duration"]`
390
391 The type of the usage object. Always `duration` for this variant.
392
393 - `"duration"`
394
395 - `words: Optional[List[TranscriptionWord]]`
396
397 Extracted words and their corresponding timestamps.
398
399 - `end: float`
400
401 End time of the word in seconds.
402
403 - `start: float`
404
405 Start time of the word in seconds.
406
407 - `word: str`
408
409 The text content of the word.
410
411### Example
412
413```python
414import os
415from openai import OpenAI
416
417client = OpenAI(
418 api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
419)
420for transcription in client.audio.transcriptions.create(
421 file=b"Example data",
422 model="gpt-4o-transcribe",
423):
424 print(transcription)
425```
426
427#### Response
428
429```json
430{
431 "text": "text",
432 "logprobs": [
433 {
434 "token": "token",
435 "bytes": [
436 0
437 ],
438 "logprob": 0
439 }
440 ],
441 "usage": {
442 "input_tokens": 0,
443 "output_tokens": 0,
444 "total_tokens": 0,
445 "type": "tokens",
446 "input_token_details": {
447 "audio_tokens": 0,
448 "text_tokens": 0
449 }
450 }
451}
452```
453
454### Example
455
456```python
457from openai import OpenAI
458client = OpenAI()
459
460audio_file = open("speech.mp3", "rb")
461transcript = client.audio.transcriptions.create(
462 model="gpt-4o-transcribe",
463 file=audio_file
464)
465```
466
467#### Response
468
469```json
470{
471 "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.",
472 "usage": {
473 "type": "tokens",
474 "input_tokens": 14,
475 "input_token_details": {
476 "text_tokens": 0,
477 "audio_tokens": 14
478 },
479 "output_tokens": 45,
480 "total_tokens": 59
481 }
482}
483```
484
485### Diarization
486
487```python
488import base64
489from openai import OpenAI
490
491client = OpenAI()
492
493def to_data_url(path: str) -> str:
494 with open(path, "rb") as fh:
495 return "data:audio/wav;base64," + base64.b64encode(fh.read()).decode("utf-8")
496
497with open("meeting.wav", "rb") as audio_file:
498 transcript = client.audio.transcriptions.create(
499 model="gpt-4o-transcribe-diarize",
500 file=audio_file,
501 response_format="diarized_json",
502 chunking_strategy="auto",
503 extra_body={
504 "known_speaker_names": ["agent"],
505 "known_speaker_references": [to_data_url("agent.wav")],
506 },
507 )
508
509print(transcript.segments)
510```
511
512#### Response
513
514```json
515{
516 "task": "transcribe",
517 "duration": 27.4,
518 "text": "Agent: Thanks for calling OpenAI support.\nA: Hi, I'm trying to enable diarization.\nAgent: Happy to walk you through the steps.",
519 "segments": [
520 {
521 "type": "transcript.text.segment",
522 "id": "seg_001",
523 "start": 0.0,
524 "end": 4.7,
525 "text": "Thanks for calling OpenAI support.",
526 "speaker": "agent"
527 },
528 {
529 "type": "transcript.text.segment",
530 "id": "seg_002",
531 "start": 4.7,
532 "end": 11.8,
533 "text": "Hi, I'm trying to enable diarization.",
534 "speaker": "A"
535 },
536 {
537 "type": "transcript.text.segment",
538 "id": "seg_003",
539 "start": 12.1,
540 "end": 18.5,
541 "text": "Happy to walk you through the steps.",
542 "speaker": "agent"
543 }
544 ],
545 "usage": {
546 "type": "duration",
547 "seconds": 27
548 }
549}
550```
551
552### Streaming
553
554```python
555from openai import OpenAI
556client = OpenAI()
557
558audio_file = open("speech.mp3", "rb")
559stream = client.audio.transcriptions.create(
560 file=audio_file,
561 model="gpt-4o-mini-transcribe",
562 stream=True
563)
564
565for event in stream:
566 print(event)
567```
568
569#### Response
570
571```json
572data: {"type":"transcript.text.delta","delta":"I","logprobs":[{"token":"I","logprob":-0.00007588794,"bytes":[73]}]}
573
574data: {"type":"transcript.text.delta","delta":" see","logprobs":[{"token":" see","logprob":-3.1281633e-7,"bytes":[32,115,101,101]}]}
575
576data: {"type":"transcript.text.delta","delta":" skies","logprobs":[{"token":" skies","logprob":-2.3392786e-6,"bytes":[32,115,107,105,101,115]}]}
577
578data: {"type":"transcript.text.delta","delta":" of","logprobs":[{"token":" of","logprob":-3.1281633e-7,"bytes":[32,111,102]}]}
579
580data: {"type":"transcript.text.delta","delta":" blue","logprobs":[{"token":" blue","logprob":-1.0280384e-6,"bytes":[32,98,108,117,101]}]}
581
582data: {"type":"transcript.text.delta","delta":" and","logprobs":[{"token":" and","logprob":-0.0005108566,"bytes":[32,97,110,100]}]}
583
584data: {"type":"transcript.text.delta","delta":" clouds","logprobs":[{"token":" clouds","logprob":-1.9361265e-7,"bytes":[32,99,108,111,117,100,115]}]}
585
586data: {"type":"transcript.text.delta","delta":" of","logprobs":[{"token":" of","logprob":-1.9361265e-7,"bytes":[32,111,102]}]}
587
588data: {"type":"transcript.text.delta","delta":" white","logprobs":[{"token":" white","logprob":-7.89631e-7,"bytes":[32,119,104,105,116,101]}]}
589
590data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.0014890312,"bytes":[44]}]}
591
592data: {"type":"transcript.text.delta","delta":" the","logprobs":[{"token":" the","logprob":-0.0110956915,"bytes":[32,116,104,101]}]}
593
594data: {"type":"transcript.text.delta","delta":" bright","logprobs":[{"token":" bright","logprob":0.0,"bytes":[32,98,114,105,103,104,116]}]}
595
596data: {"type":"transcript.text.delta","delta":" blessed","logprobs":[{"token":" blessed","logprob":-0.000045848617,"bytes":[32,98,108,101,115,115,101,100]}]}
597
598data: {"type":"transcript.text.delta","delta":" days","logprobs":[{"token":" days","logprob":-0.000010802739,"bytes":[32,100,97,121,115]}]}
599
600data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.00001700133,"bytes":[44]}]}
601
602data: {"type":"transcript.text.delta","delta":" the","logprobs":[{"token":" the","logprob":-0.0000118755715,"bytes":[32,116,104,101]}]}
603
604data: {"type":"transcript.text.delta","delta":" dark","logprobs":[{"token":" dark","logprob":-5.5122365e-7,"bytes":[32,100,97,114,107]}]}
605
606data: {"type":"transcript.text.delta","delta":" sacred","logprobs":[{"token":" sacred","logprob":-5.4385737e-6,"bytes":[32,115,97,99,114,101,100]}]}
607
608data: {"type":"transcript.text.delta","delta":" nights","logprobs":[{"token":" nights","logprob":-4.00813e-6,"bytes":[32,110,105,103,104,116,115]}]}
609
610data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.0036910512,"bytes":[44]}]}
611
612data: {"type":"transcript.text.delta","delta":" and","logprobs":[{"token":" and","logprob":-0.0031903093,"bytes":[32,97,110,100]}]}
613
614data: {"type":"transcript.text.delta","delta":" I","logprobs":[{"token":" I","logprob":-1.504853e-6,"bytes":[32,73]}]}
615
616data: {"type":"transcript.text.delta","delta":" think","logprobs":[{"token":" think","logprob":-4.3202e-7,"bytes":[32,116,104,105,110,107]}]}
617
618data: {"type":"transcript.text.delta","delta":" to","logprobs":[{"token":" to","logprob":-1.9361265e-7,"bytes":[32,116,111]}]}
619
620data: {"type":"transcript.text.delta","delta":" myself","logprobs":[{"token":" myself","logprob":-1.7432603e-6,"bytes":[32,109,121,115,101,108,102]}]}
621
622data: {"type":"transcript.text.delta","delta":",","logprobs":[{"token":",","logprob":-0.29254505,"bytes":[44]}]}
623
624data: {"type":"transcript.text.delta","delta":" what","logprobs":[{"token":" what","logprob":-0.016815351,"bytes":[32,119,104,97,116]}]}
625
626data: {"type":"transcript.text.delta","delta":" a","logprobs":[{"token":" a","logprob":-3.1281633e-7,"bytes":[32,97]}]}
627
628data: {"type":"transcript.text.delta","delta":" wonderful","logprobs":[{"token":" wonderful","logprob":-2.1008714e-6,"bytes":[32,119,111,110,100,101,114,102,117,108]}]}
629
630data: {"type":"transcript.text.delta","delta":" world","logprobs":[{"token":" world","logprob":-8.180258e-6,"bytes":[32,119,111,114,108,100]}]}
631
632data: {"type":"transcript.text.delta","delta":".","logprobs":[{"token":".","logprob":-0.014231676,"bytes":[46]}]}
633
634data: {"type":"transcript.text.done","text":"I see skies of blue and clouds of white, the bright blessed days, the dark sacred nights, and I think to myself, what a wonderful world.","logprobs":[{"token":"I","logprob":-0.00007588794,"bytes":[73]},{"token":" see","logprob":-3.1281633e-7,"bytes":[32,115,101,101]},{"token":" skies","logprob":-2.3392786e-6,"bytes":[32,115,107,105,101,115]},{"token":" of","logprob":-3.1281633e-7,"bytes":[32,111,102]},{"token":" blue","logprob":-1.0280384e-6,"bytes":[32,98,108,117,101]},{"token":" and","logprob":-0.0005108566,"bytes":[32,97,110,100]},{"token":" clouds","logprob":-1.9361265e-7,"bytes":[32,99,108,111,117,100,115]},{"token":" of","logprob":-1.9361265e-7,"bytes":[32,111,102]},{"token":" white","logprob":-7.89631e-7,"bytes":[32,119,104,105,116,101]},{"token":",","logprob":-0.0014890312,"bytes":[44]},{"token":" the","logprob":-0.0110956915,"bytes":[32,116,104,101]},{"token":" bright","logprob":0.0,"bytes":[32,98,114,105,103,104,116]},{"token":" blessed","logprob":-0.000045848617,"bytes":[32,98,108,101,115,115,101,100]},{"token":" days","logprob":-0.000010802739,"bytes":[32,100,97,121,115]},{"token":",","logprob":-0.00001700133,"bytes":[44]},{"token":" the","logprob":-0.0000118755715,"bytes":[32,116,104,101]},{"token":" dark","logprob":-5.5122365e-7,"bytes":[32,100,97,114,107]},{"token":" sacred","logprob":-5.4385737e-6,"bytes":[32,115,97,99,114,101,100]},{"token":" nights","logprob":-4.00813e-6,"bytes":[32,110,105,103,104,116,115]},{"token":",","logprob":-0.0036910512,"bytes":[44]},{"token":" and","logprob":-0.0031903093,"bytes":[32,97,110,100]},{"token":" I","logprob":-1.504853e-6,"bytes":[32,73]},{"token":" think","logprob":-4.3202e-7,"bytes":[32,116,104,105,110,107]},{"token":" to","logprob":-1.9361265e-7,"bytes":[32,116,111]},{"token":" myself","logprob":-1.7432603e-6,"bytes":[32,109,121,115,101,108,102]},{"token":",","logprob":-0.29254505,"bytes":[44]},{"token":" what","logprob":-0.016815351,"bytes":[32,119,104,97,116]},{"token":" a","logprob":-3.1281633e-7,"bytes":[32,97]},{"token":" wonderful","logprob":-2.1008714e-6,"bytes":[32,119,111,110,100,101,114,102,117,108]},{"token":" world","logprob":-8.180258e-6,"bytes":[32,119,111,114,108,100]},{"token":".","logprob":-0.014231676,"bytes":[46]}],"usage":{"input_tokens":14,"input_token_details":{"text_tokens":0,"audio_tokens":14},"output_tokens":45,"total_tokens":59}}
635```
636
637### Logprobs
638
639```python
640from openai import OpenAI
641client = OpenAI()
642
643audio_file = open("speech.mp3", "rb")
644transcript = client.audio.transcriptions.create(
645 file=audio_file,
646 model="gpt-4o-transcribe",
647 response_format="json",
648 include=["logprobs"]
649)
650
651print(transcript)
652```
653
654#### Response
655
656```json
657{
658 "text": "Hey, my knee is hurting and I want to see the doctor tomorrow ideally.",
659 "logprobs": [
660 { "token": "Hey", "logprob": -1.0415299, "bytes": [72, 101, 121] },
661 { "token": ",", "logprob": -9.805982e-5, "bytes": [44] },
662 { "token": " my", "logprob": -0.00229799, "bytes": [32, 109, 121] },
663 {
664 "token": " knee",
665 "logprob": -4.7159858e-5,
666 "bytes": [32, 107, 110, 101, 101]
667 },
668 { "token": " is", "logprob": -0.043909557, "bytes": [32, 105, 115] },
669 {
670 "token": " hurting",
671 "logprob": -1.1041146e-5,
672 "bytes": [32, 104, 117, 114, 116, 105, 110, 103]
673 },
674 { "token": " and", "logprob": -0.011076359, "bytes": [32, 97, 110, 100] },
675 { "token": " I", "logprob": -5.3193703e-6, "bytes": [32, 73] },
676 {
677 "token": " want",
678 "logprob": -0.0017156356,
679 "bytes": [32, 119, 97, 110, 116]
680 },
681 { "token": " to", "logprob": -7.89631e-7, "bytes": [32, 116, 111] },
682 { "token": " see", "logprob": -5.5122365e-7, "bytes": [32, 115, 101, 101] },
683 { "token": " the", "logprob": -0.0040786397, "bytes": [32, 116, 104, 101] },
684 {
685 "token": " doctor",
686 "logprob": -2.3392786e-6,
687 "bytes": [32, 100, 111, 99, 116, 111, 114]
688 },
689 {
690 "token": " tomorrow",
691 "logprob": -7.89631e-7,
692 "bytes": [32, 116, 111, 109, 111, 114, 114, 111, 119]
693 },
694 {
695 "token": " ideally",
696 "logprob": -0.5800861,
697 "bytes": [32, 105, 100, 101, 97, 108, 108, 121]
698 },
699 { "token": ".", "logprob": -0.00011093382, "bytes": [46] }
700 ],
701 "usage": {
702 "type": "tokens",
703 "input_tokens": 14,
704 "input_token_details": {
705 "text_tokens": 0,
706 "audio_tokens": 14
707 },
708 "output_tokens": 45,
709 "total_tokens": 59
710 }
711}
712```
713
714### Word timestamps
715
716```python
717from openai import OpenAI
718client = OpenAI()
719
720audio_file = open("speech.mp3", "rb")
721transcript = client.audio.transcriptions.create(
722 file=audio_file,
723 model="whisper-1",
724 response_format="verbose_json",
725 timestamp_granularities=["word"]
726)
727
728print(transcript.words)
729```
730
731#### Response
732
733```json
734{
735 "task": "transcribe",
736 "language": "english",
737 "duration": 8.470000267028809,
738 "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.",
739 "words": [
740 {
741 "word": "The",
742 "start": 0.0,
743 "end": 0.23999999463558197
744 },
745 ...
746 {
747 "word": "volleyball",
748 "start": 7.400000095367432,
749 "end": 7.900000095367432
750 }
751 ],
752 "usage": {
753 "type": "duration",
754 "seconds": 9
755 }
756}
757```
758
759### Segment timestamps
760
761```python
762from openai import OpenAI
763client = OpenAI()
764
765audio_file = open("speech.mp3", "rb")
766transcript = client.audio.transcriptions.create(
767 file=audio_file,
768 model="whisper-1",
769 response_format="verbose_json",
770 timestamp_granularities=["segment"]
771)
772
773print(transcript.words)
774```
775
776#### Response
777
778```json
779{
780 "task": "transcribe",
781 "language": "english",
782 "duration": 8.470000267028809,
783 "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.",
784 "segments": [
785 {
786 "id": 0,
787 "seek": 0,
788 "start": 0.0,
789 "end": 3.319999933242798,
790 "text": " The beach was a popular spot on a hot summer day.",
791 "tokens": [
792 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530
793 ],
794 "temperature": 0.0,
795 "avg_logprob": -0.2860786020755768,
796 "compression_ratio": 1.2363636493682861,
797 "no_speech_prob": 0.00985979475080967
798 },
799 ...
800 ],
801 "usage": {
802 "type": "duration",
803 "seconds": 9
804 }
805}
806```
807
808## Domain Types
809
810### Transcription
811
812- `class Transcription: …`
813
814 Represents a transcription response returned by model, based on the provided input.
815
816 - `text: str`
817
818 The transcribed text.
819
820 - `logprobs: Optional[List[Logprob]]`
821
822 The log probabilities of the tokens in the transcription. Only returned with the models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` array.
823
824 - `token: Optional[str]`
825
826 The token in the transcription.
827
828 - `bytes: Optional[List[float]]`
829
830 The bytes of the token.
831
832 - `logprob: Optional[float]`
833
834 The log probability of the token.
835
836 - `usage: Optional[Usage]`
837
838 Token usage statistics for the request.
839
840 - `class UsageTokens: …`
841
842 Usage statistics for models billed by token usage.
843
844 - `input_tokens: int`
845
846 Number of input tokens billed for this request.
847
848 - `output_tokens: int`
849
850 Number of output tokens generated.
851
852 - `total_tokens: int`
853
854 Total number of tokens used (input + output).
855
856 - `type: Literal["tokens"]`
857
858 The type of the usage object. Always `tokens` for this variant.
859
860 - `"tokens"`
861
862 - `input_token_details: Optional[UsageTokensInputTokenDetails]`
863
864 Details about the input tokens billed for this request.
865
866 - `audio_tokens: Optional[int]`
867
868 Number of audio tokens billed for this request.
869
870 - `text_tokens: Optional[int]`
871
872 Number of text tokens billed for this request.
873
874 - `class UsageDuration: …`
875
876 Usage statistics for models billed by audio input duration.
877
878 - `seconds: float`
879
880 Duration of the input audio in seconds.
881
882 - `type: Literal["duration"]`
883
884 The type of the usage object. Always `duration` for this variant.
885
886 - `"duration"`
887
888### Transcription Diarized
889
890- `class TranscriptionDiarized: …`
891
892 Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations.
893
894 - `duration: float`
895
896 Duration of the input audio in seconds.
897
898 - `segments: List[TranscriptionDiarizedSegment]`
899
900 Segments of the transcript annotated with timestamps and speaker labels.
901
902 - `id: str`
903
904 Unique identifier for the segment.
905
906 - `end: float`
907
908 End timestamp of the segment in seconds.
909
910 - `speaker: str`
911
912 Speaker label for this segment. When known speakers are provided, the label matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially using capital letters (`A`, `B`, ...).
913
914 - `start: float`
915
916 Start timestamp of the segment in seconds.
917
918 - `text: str`
919
920 Transcript text for this segment.
921
922 - `type: Literal["transcript.text.segment"]`
923
924 The type of the segment. Always `transcript.text.segment`.
925
926 - `"transcript.text.segment"`
927
928 - `task: Literal["transcribe"]`
929
930 The type of task that was run. Always `transcribe`.
931
932 - `"transcribe"`
933
934 - `text: str`
935
936 The concatenated transcript text for the entire audio input.
937
938 - `usage: Optional[Usage]`
939
940 Token or duration usage statistics for the request.
941
942 - `class UsageTokens: …`
943
944 Usage statistics for models billed by token usage.
945
946 - `input_tokens: int`
947
948 Number of input tokens billed for this request.
949
950 - `output_tokens: int`
951
952 Number of output tokens generated.
953
954 - `total_tokens: int`
955
956 Total number of tokens used (input + output).
957
958 - `type: Literal["tokens"]`
959
960 The type of the usage object. Always `tokens` for this variant.
961
962 - `"tokens"`
963
964 - `input_token_details: Optional[UsageTokensInputTokenDetails]`
965
966 Details about the input tokens billed for this request.
967
968 - `audio_tokens: Optional[int]`
969
970 Number of audio tokens billed for this request.
971
972 - `text_tokens: Optional[int]`
973
974 Number of text tokens billed for this request.
975
976 - `class UsageDuration: …`
977
978 Usage statistics for models billed by audio input duration.
979
980 - `seconds: float`
981
982 Duration of the input audio in seconds.
983
984 - `type: Literal["duration"]`
985
986 The type of the usage object. Always `duration` for this variant.
987
988 - `"duration"`
989
990### Transcription Diarized Segment
991
992- `class TranscriptionDiarizedSegment: …`
993
994 A segment of diarized transcript text with speaker metadata.
995
996 - `id: str`
997
998 Unique identifier for the segment.
999
1000 - `end: float`
1001
1002 End timestamp of the segment in seconds.
1003
1004 - `speaker: str`
1005
1006 Speaker label for this segment. When known speakers are provided, the label matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially using capital letters (`A`, `B`, ...).
1007
1008 - `start: float`
1009
1010 Start timestamp of the segment in seconds.
1011
1012 - `text: str`
1013
1014 Transcript text for this segment.
1015
1016 - `type: Literal["transcript.text.segment"]`
1017
1018 The type of the segment. Always `transcript.text.segment`.
1019
1020 - `"transcript.text.segment"`
1021
1022### Transcription Include
1023
1024- `Literal["logprobs"]`
1025
1026 - `"logprobs"`
1027
1028### Transcription Segment
1029
1030- `class TranscriptionSegment: …`
1031
1032 - `id: int`
1033
1034 Unique identifier of the segment.
1035
1036 - `avg_logprob: float`
1037
1038 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
1039
1040 - `compression_ratio: float`
1041
1042 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
1043
1044 - `end: float`
1045
1046 End time of the segment in seconds.
1047
1048 - `no_speech_prob: float`
1049
1050 Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent.
1051
1052 - `seek: int`
1053
1054 Seek offset of the segment.
1055
1056 - `start: float`
1057
1058 Start time of the segment in seconds.
1059
1060 - `temperature: float`
1061
1062 Temperature parameter used for generating the segment.
1063
1064 - `text: str`
1065
1066 Text content of the segment.
1067
1068 - `tokens: List[int]`
1069
1070 Array of token IDs for the text content.
1071
1072### Transcription Stream Event
1073
1074- `TranscriptionStreamEvent`
1075
1076 Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with `stream` set to `true` and `response_format` set to `diarized_json`.
1077
1078 - `class TranscriptionTextSegmentEvent: …`
1079
1080 Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with `stream` set to `true` and `response_format` set to `diarized_json`.
1081
1082 - `id: str`
1083
1084 Unique identifier for the segment.
1085
1086 - `end: float`
1087
1088 End timestamp of the segment in seconds.
1089
1090 - `speaker: str`
1091
1092 Speaker label for this segment.
1093
1094 - `start: float`
1095
1096 Start timestamp of the segment in seconds.
1097
1098 - `text: str`
1099
1100 Transcript text for this segment.
1101
1102 - `type: Literal["transcript.text.segment"]`
1103
1104 The type of the event. Always `transcript.text.segment`.
1105
1106 - `"transcript.text.segment"`
1107
1108 - `class TranscriptionTextDeltaEvent: …`
1109
1110 Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`.
1111
1112 - `delta: str`
1113
1114 The text delta that was additionally transcribed.
1115
1116 - `type: Literal["transcript.text.delta"]`
1117
1118 The type of the event. Always `transcript.text.delta`.
1119
1120 - `"transcript.text.delta"`
1121
1122 - `logprobs: Optional[List[Logprob]]`
1123
1124 The log probabilities of the delta. Only included if you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `include[]` parameter set to `logprobs`.
1125
1126 - `token: Optional[str]`
1127
1128 The token that was used to generate the log probability.
1129
1130 - `bytes: Optional[List[int]]`
1131
1132 The bytes that were used to generate the log probability.
1133
1134 - `logprob: Optional[float]`
1135
1136 The log probability of the token.
1137
1138 - `segment_id: Optional[str]`
1139
1140 Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`.
1141
1142 - `class TranscriptionTextDoneEvent: …`
1143
1144 Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`.
1145
1146 - `text: str`
1147
1148 The text that was transcribed.
1149
1150 - `type: Literal["transcript.text.done"]`
1151
1152 The type of the event. Always `transcript.text.done`.
1153
1154 - `"transcript.text.done"`
1155
1156 - `logprobs: Optional[List[Logprob]]`
1157
1158 The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `include[]` parameter set to `logprobs`.
1159
1160 - `token: Optional[str]`
1161
1162 The token that was used to generate the log probability.
1163
1164 - `bytes: Optional[List[int]]`
1165
1166 The bytes that were used to generate the log probability.
1167
1168 - `logprob: Optional[float]`
1169
1170 The log probability of the token.
1171
1172 - `usage: Optional[Usage]`
1173
1174 Usage statistics for models billed by token usage.
1175
1176 - `input_tokens: int`
1177
1178 Number of input tokens billed for this request.
1179
1180 - `output_tokens: int`
1181
1182 Number of output tokens generated.
1183
1184 - `total_tokens: int`
1185
1186 Total number of tokens used (input + output).
1187
1188 - `type: Literal["tokens"]`
1189
1190 The type of the usage object. Always `tokens` for this variant.
1191
1192 - `"tokens"`
1193
1194 - `input_token_details: Optional[UsageInputTokenDetails]`
1195
1196 Details about the input tokens billed for this request.
1197
1198 - `audio_tokens: Optional[int]`
1199
1200 Number of audio tokens billed for this request.
1201
1202 - `text_tokens: Optional[int]`
1203
1204 Number of text tokens billed for this request.
1205
1206### Transcription Text Delta Event
1207
1208- `class TranscriptionTextDeltaEvent: …`
1209
1210 Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`.
1211
1212 - `delta: str`
1213
1214 The text delta that was additionally transcribed.
1215
1216 - `type: Literal["transcript.text.delta"]`
1217
1218 The type of the event. Always `transcript.text.delta`.
1219
1220 - `"transcript.text.delta"`
1221
1222 - `logprobs: Optional[List[Logprob]]`
1223
1224 The log probabilities of the delta. Only included if you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `include[]` parameter set to `logprobs`.
1225
1226 - `token: Optional[str]`
1227
1228 The token that was used to generate the log probability.
1229
1230 - `bytes: Optional[List[int]]`
1231
1232 The bytes that were used to generate the log probability.
1233
1234 - `logprob: Optional[float]`
1235
1236 The log probability of the token.
1237
1238 - `segment_id: Optional[str]`
1239
1240 Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`.
1241
1242### Transcription Text Done Event
1243
1244- `class TranscriptionTextDoneEvent: …`
1245
1246 Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`.
1247
1248 - `text: str`
1249
1250 The text that was transcribed.
1251
1252 - `type: Literal["transcript.text.done"]`
1253
1254 The type of the event. Always `transcript.text.done`.
1255
1256 - `"transcript.text.done"`
1257
1258 - `logprobs: Optional[List[Logprob]]`
1259
1260 The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with the `include[]` parameter set to `logprobs`.
1261
1262 - `token: Optional[str]`
1263
1264 The token that was used to generate the log probability.
1265
1266 - `bytes: Optional[List[int]]`
1267
1268 The bytes that were used to generate the log probability.
1269
1270 - `logprob: Optional[float]`
1271
1272 The log probability of the token.
1273
1274 - `usage: Optional[Usage]`
1275
1276 Usage statistics for models billed by token usage.
1277
1278 - `input_tokens: int`
1279
1280 Number of input tokens billed for this request.
1281
1282 - `output_tokens: int`
1283
1284 Number of output tokens generated.
1285
1286 - `total_tokens: int`
1287
1288 Total number of tokens used (input + output).
1289
1290 - `type: Literal["tokens"]`
1291
1292 The type of the usage object. Always `tokens` for this variant.
1293
1294 - `"tokens"`
1295
1296 - `input_token_details: Optional[UsageInputTokenDetails]`
1297
1298 Details about the input tokens billed for this request.
1299
1300 - `audio_tokens: Optional[int]`
1301
1302 Number of audio tokens billed for this request.
1303
1304 - `text_tokens: Optional[int]`
1305
1306 Number of text tokens billed for this request.
1307
1308### Transcription Text Segment Event
1309
1310- `class TranscriptionTextSegmentEvent: …`
1311
1312 Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) with `stream` set to `true` and `response_format` set to `diarized_json`.
1313
1314 - `id: str`
1315
1316 Unique identifier for the segment.
1317
1318 - `end: float`
1319
1320 End timestamp of the segment in seconds.
1321
1322 - `speaker: str`
1323
1324 Speaker label for this segment.
1325
1326 - `start: float`
1327
1328 Start timestamp of the segment in seconds.
1329
1330 - `text: str`
1331
1332 Transcript text for this segment.
1333
1334 - `type: Literal["transcript.text.segment"]`
1335
1336 The type of the event. Always `transcript.text.segment`.
1337
1338 - `"transcript.text.segment"`
1339
1340### Transcription Verbose
1341
1342- `class TranscriptionVerbose: …`
1343
1344 Represents a verbose json transcription response returned by model, based on the provided input.
1345
1346 - `duration: float`
1347
1348 The duration of the input audio.
1349
1350 - `language: str`
1351
1352 The language of the input audio.
1353
1354 - `text: str`
1355
1356 The transcribed text.
1357
1358 - `segments: Optional[List[TranscriptionSegment]]`
1359
1360 Segments of the transcribed text and their corresponding details.
1361
1362 - `id: int`
1363
1364 Unique identifier of the segment.
1365
1366 - `avg_logprob: float`
1367
1368 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
1369
1370 - `compression_ratio: float`
1371
1372 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
1373
1374 - `end: float`
1375
1376 End time of the segment in seconds.
1377
1378 - `no_speech_prob: float`
1379
1380 Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent.
1381
1382 - `seek: int`
1383
1384 Seek offset of the segment.
1385
1386 - `start: float`
1387
1388 Start time of the segment in seconds.
1389
1390 - `temperature: float`
1391
1392 Temperature parameter used for generating the segment.
1393
1394 - `text: str`
1395
1396 Text content of the segment.
1397
1398 - `tokens: List[int]`
1399
1400 Array of token IDs for the text content.
1401
1402 - `usage: Optional[Usage]`
1403
1404 Usage statistics for models billed by audio input duration.
1405
1406 - `seconds: float`
1407
1408 Duration of the input audio in seconds.
1409
1410 - `type: Literal["duration"]`
1411
1412 The type of the usage object. Always `duration` for this variant.
1413
1414 - `"duration"`
1415
1416 - `words: Optional[List[TranscriptionWord]]`
1417
1418 Extracted words and their corresponding timestamps.
1419
1420 - `end: float`
1421
1422 End time of the word in seconds.
1423
1424 - `start: float`
1425
1426 Start time of the word in seconds.
1427
1428 - `word: str`
1429
1430 The text content of the word.
1431
1432### Transcription Word
1433
1434- `class TranscriptionWord: …`
1435
1436 - `end: float`
1437
1438 End time of the word in seconds.
1439
1440 - `start: float`
1441
1442 Start time of the word in seconds.
1443
1444 - `word: str`
1445
1446 The text content of the word.
1447
1448### Transcription Create Response
1449
1450- `TranscriptionCreateResponse`
1451
1452 Represents a transcription response returned by model, based on the provided input.
1453
1454 - `class Transcription: …`
1455
1456 Represents a transcription response returned by model, based on the provided input.
1457
1458 - `text: str`
1459
1460 The transcribed text.
1461
1462 - `logprobs: Optional[List[Logprob]]`
1463
1464 The log probabilities of the tokens in the transcription. Only returned with the models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` array.
1465
1466 - `token: Optional[str]`
1467
1468 The token in the transcription.
1469
1470 - `bytes: Optional[List[float]]`
1471
1472 The bytes of the token.
1473
1474 - `logprob: Optional[float]`
1475
1476 The log probability of the token.
1477
1478 - `usage: Optional[Usage]`
1479
1480 Token usage statistics for the request.
1481
1482 - `class UsageTokens: …`
1483
1484 Usage statistics for models billed by token usage.
1485
1486 - `input_tokens: int`
1487
1488 Number of input tokens billed for this request.
1489
1490 - `output_tokens: int`
1491
1492 Number of output tokens generated.
1493
1494 - `total_tokens: int`
1495
1496 Total number of tokens used (input + output).
1497
1498 - `type: Literal["tokens"]`
1499
1500 The type of the usage object. Always `tokens` for this variant.
1501
1502 - `"tokens"`
1503
1504 - `input_token_details: Optional[UsageTokensInputTokenDetails]`
1505
1506 Details about the input tokens billed for this request.
1507
1508 - `audio_tokens: Optional[int]`
1509
1510 Number of audio tokens billed for this request.
1511
1512 - `text_tokens: Optional[int]`
1513
1514 Number of text tokens billed for this request.
1515
1516 - `class UsageDuration: …`
1517
1518 Usage statistics for models billed by audio input duration.
1519
1520 - `seconds: float`
1521
1522 Duration of the input audio in seconds.
1523
1524 - `type: Literal["duration"]`
1525
1526 The type of the usage object. Always `duration` for this variant.
1527
1528 - `"duration"`
1529
1530 - `class TranscriptionDiarized: …`
1531
1532 Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations.
1533
1534 - `duration: float`
1535
1536 Duration of the input audio in seconds.
1537
1538 - `segments: List[TranscriptionDiarizedSegment]`
1539
1540 Segments of the transcript annotated with timestamps and speaker labels.
1541
1542 - `id: str`
1543
1544 Unique identifier for the segment.
1545
1546 - `end: float`
1547
1548 End timestamp of the segment in seconds.
1549
1550 - `speaker: str`
1551
1552 Speaker label for this segment. When known speakers are provided, the label matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially using capital letters (`A`, `B`, ...).
1553
1554 - `start: float`
1555
1556 Start timestamp of the segment in seconds.
1557
1558 - `text: str`
1559
1560 Transcript text for this segment.
1561
1562 - `type: Literal["transcript.text.segment"]`
1563
1564 The type of the segment. Always `transcript.text.segment`.
1565
1566 - `"transcript.text.segment"`
1567
1568 - `task: Literal["transcribe"]`
1569
1570 The type of task that was run. Always `transcribe`.
1571
1572 - `"transcribe"`
1573
1574 - `text: str`
1575
1576 The concatenated transcript text for the entire audio input.
1577
1578 - `usage: Optional[Usage]`
1579
1580 Token or duration usage statistics for the request.
1581
1582 - `class UsageTokens: …`
1583
1584 Usage statistics for models billed by token usage.
1585
1586 - `input_tokens: int`
1587
1588 Number of input tokens billed for this request.
1589
1590 - `output_tokens: int`
1591
1592 Number of output tokens generated.
1593
1594 - `total_tokens: int`
1595
1596 Total number of tokens used (input + output).
1597
1598 - `type: Literal["tokens"]`
1599
1600 The type of the usage object. Always `tokens` for this variant.
1601
1602 - `"tokens"`
1603
1604 - `input_token_details: Optional[UsageTokensInputTokenDetails]`
1605
1606 Details about the input tokens billed for this request.
1607
1608 - `audio_tokens: Optional[int]`
1609
1610 Number of audio tokens billed for this request.
1611
1612 - `text_tokens: Optional[int]`
1613
1614 Number of text tokens billed for this request.
1615
1616 - `class UsageDuration: …`
1617
1618 Usage statistics for models billed by audio input duration.
1619
1620 - `seconds: float`
1621
1622 Duration of the input audio in seconds.
1623
1624 - `type: Literal["duration"]`
1625
1626 The type of the usage object. Always `duration` for this variant.
1627
1628 - `"duration"`
1629
1630 - `class TranscriptionVerbose: …`
1631
1632 Represents a verbose json transcription response returned by model, based on the provided input.
1633
1634 - `duration: float`
1635
1636 The duration of the input audio.
1637
1638 - `language: str`
1639
1640 The language of the input audio.
1641
1642 - `text: str`
1643
1644 The transcribed text.
1645
1646 - `segments: Optional[List[TranscriptionSegment]]`
1647
1648 Segments of the transcribed text and their corresponding details.
1649
1650 - `id: int`
1651
1652 Unique identifier of the segment.
1653
1654 - `avg_logprob: float`
1655
1656 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
1657
1658 - `compression_ratio: float`
1659
1660 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
1661
1662 - `end: float`
1663
1664 End time of the segment in seconds.
1665
1666 - `no_speech_prob: float`
1667
1668 Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent.
1669
1670 - `seek: int`
1671
1672 Seek offset of the segment.
1673
1674 - `start: float`
1675
1676 Start time of the segment in seconds.
1677
1678 - `temperature: float`
1679
1680 Temperature parameter used for generating the segment.
1681
1682 - `text: str`
1683
1684 Text content of the segment.
1685
1686 - `tokens: List[int]`
1687
1688 Array of token IDs for the text content.
1689
1690 - `usage: Optional[Usage]`
1691
1692 Usage statistics for models billed by audio input duration.
1693
1694 - `seconds: float`
1695
1696 Duration of the input audio in seconds.
1697
1698 - `type: Literal["duration"]`
1699
1700 The type of the usage object. Always `duration` for this variant.
1701
1702 - `"duration"`
1703
1704 - `words: Optional[List[TranscriptionWord]]`
1705
1706 Extracted words and their corresponding timestamps.
1707
1708 - `end: float`
1709
1710 End time of the word in seconds.
1711
1712 - `start: float`
1713
1714 Start time of the word in seconds.
1715
1716 - `word: str`
1717
1718 The text content of the word.