ruby/resources/audio/subresources/transcriptions/index.md +0 −1358 deleted
File Deleted View Diff
1# Transcriptions
2
3## Create transcription
4
5`audio.transcriptions.create(**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: String`
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: String | 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 - `String = String`
25
26 - `AudioModel = :"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: :auto | VadConfig{ type, prefix_padding_ms, silence_duration_ms, threshold}`
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 - `ChunkingStrategy = :auto`
43
44 Automatically set chunking parameters based on the audio. Must be set to `"auto"`.
45
46 - `:auto`
47
48 - `class VadConfig`
49
50 - `type: :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: Integer`
57
58 Amount of audio to include before the VAD detected speech (in
59 milliseconds).
60
61 - `silence_duration_ms: Integer`
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: 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: Array[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: Array[String]`
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: Array[String]`
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: String`
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: String`
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: 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: bool`
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- `temperature: Float`
125
126 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.
127
128- `timestamp_granularities: Array[:word | :segment]`
129
130 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.
131 This option is not available for `gpt-4o-transcribe-diarize`.
132
133 - `:word`
134
135 - `:segment`
136
137### Returns
138
139- `TranscriptionCreateResponse = Transcription | TranscriptionDiarized | TranscriptionVerbose`
140
141 Represents a transcription response returned by model, based on the provided input.
142
143 - `class Transcription`
144
145 Represents a transcription response returned by model, based on the provided input.
146
147 - `text: String`
148
149 The transcribed text.
150
151 - `logprobs: Array[Logprob{ token, bytes, logprob}]`
152
153 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.
154
155 - `token: String`
156
157 The token in the transcription.
158
159 - `bytes: Array[Float]`
160
161 The bytes of the token.
162
163 - `logprob: Float`
164
165 The log probability of the token.
166
167 - `usage: Tokens{ input_tokens, output_tokens, total_tokens, 2 more} | Duration{ seconds, type}`
168
169 Token usage statistics for the request.
170
171 - `class Tokens`
172
173 Usage statistics for models billed by token usage.
174
175 - `input_tokens: Integer`
176
177 Number of input tokens billed for this request.
178
179 - `output_tokens: Integer`
180
181 Number of output tokens generated.
182
183 - `total_tokens: Integer`
184
185 Total number of tokens used (input + output).
186
187 - `type: :tokens`
188
189 The type of the usage object. Always `tokens` for this variant.
190
191 - `:tokens`
192
193 - `input_token_details: InputTokenDetails{ audio_tokens, text_tokens}`
194
195 Details about the input tokens billed for this request.
196
197 - `audio_tokens: Integer`
198
199 Number of audio tokens billed for this request.
200
201 - `text_tokens: Integer`
202
203 Number of text tokens billed for this request.
204
205 - `class Duration`
206
207 Usage statistics for models billed by audio input duration.
208
209 - `seconds: Float`
210
211 Duration of the input audio in seconds.
212
213 - `type: :duration`
214
215 The type of the usage object. Always `duration` for this variant.
216
217 - `:duration`
218
219 - `class TranscriptionDiarized`
220
221 Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations.
222
223 - `duration: Float`
224
225 Duration of the input audio in seconds.
226
227 - `segments: Array[TranscriptionDiarizedSegment]`
228
229 Segments of the transcript annotated with timestamps and speaker labels.
230
231 - `id: String`
232
233 Unique identifier for the segment.
234
235 - `end_: Float`
236
237 End timestamp of the segment in seconds.
238
239 - `speaker: String`
240
241 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`, ...).
242
243 - `start: Float`
244
245 Start timestamp of the segment in seconds.
246
247 - `text: String`
248
249 Transcript text for this segment.
250
251 - `type: :"transcript.text.segment"`
252
253 The type of the segment. Always `transcript.text.segment`.
254
255 - `:"transcript.text.segment"`
256
257 - `task: :transcribe`
258
259 The type of task that was run. Always `transcribe`.
260
261 - `:transcribe`
262
263 - `text: String`
264
265 The concatenated transcript text for the entire audio input.
266
267 - `usage: Tokens{ input_tokens, output_tokens, total_tokens, 2 more} | Duration{ seconds, type}`
268
269 Token or duration usage statistics for the request.
270
271 - `class Tokens`
272
273 Usage statistics for models billed by token usage.
274
275 - `input_tokens: Integer`
276
277 Number of input tokens billed for this request.
278
279 - `output_tokens: Integer`
280
281 Number of output tokens generated.
282
283 - `total_tokens: Integer`
284
285 Total number of tokens used (input + output).
286
287 - `type: :tokens`
288
289 The type of the usage object. Always `tokens` for this variant.
290
291 - `:tokens`
292
293 - `input_token_details: InputTokenDetails{ audio_tokens, text_tokens}`
294
295 Details about the input tokens billed for this request.
296
297 - `audio_tokens: Integer`
298
299 Number of audio tokens billed for this request.
300
301 - `text_tokens: Integer`
302
303 Number of text tokens billed for this request.
304
305 - `class Duration`
306
307 Usage statistics for models billed by audio input duration.
308
309 - `seconds: Float`
310
311 Duration of the input audio in seconds.
312
313 - `type: :duration`
314
315 The type of the usage object. Always `duration` for this variant.
316
317 - `:duration`
318
319 - `class TranscriptionVerbose`
320
321 Represents a verbose json transcription response returned by model, based on the provided input.
322
323 - `duration: Float`
324
325 The duration of the input audio.
326
327 - `language: String`
328
329 The language of the input audio.
330
331 - `text: String`
332
333 The transcribed text.
334
335 - `segments: Array[TranscriptionSegment]`
336
337 Segments of the transcribed text and their corresponding details.
338
339 - `id: Integer`
340
341 Unique identifier of the segment.
342
343 - `avg_logprob: Float`
344
345 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
346
347 - `compression_ratio: Float`
348
349 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
350
351 - `end_: Float`
352
353 End time of the segment in seconds.
354
355 - `no_speech_prob: Float`
356
357 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.
358
359 - `seek: Integer`
360
361 Seek offset of the segment.
362
363 - `start: Float`
364
365 Start time of the segment in seconds.
366
367 - `temperature: Float`
368
369 Temperature parameter used for generating the segment.
370
371 - `text: String`
372
373 Text content of the segment.
374
375 - `tokens: Array[Integer]`
376
377 Array of token IDs for the text content.
378
379 - `usage: Usage{ seconds, type}`
380
381 Usage statistics for models billed by audio input duration.
382
383 - `seconds: Float`
384
385 Duration of the input audio in seconds.
386
387 - `type: :duration`
388
389 The type of the usage object. Always `duration` for this variant.
390
391 - `:duration`
392
393 - `words: Array[TranscriptionWord]`
394
395 Extracted words and their corresponding timestamps.
396
397 - `end_: Float`
398
399 End time of the word in seconds.
400
401 - `start: Float`
402
403 Start time of the word in seconds.
404
405 - `word: String`
406
407 The text content of the word.
408
409### Example
410
411```ruby
412require "openai"
413
414openai = OpenAI::Client.new(api_key: "My API Key")
415
416transcription = openai.audio.transcriptions.create(file: StringIO.new("Example data"), model: :"gpt-4o-transcribe")
417
418puts(transcription)
419```
420
421#### Response
422
423```json
424{
425 "text": "text",
426 "logprobs": [
427 {
428 "token": "token",
429 "bytes": [
430 0
431 ],
432 "logprob": 0
433 }
434 ],
435 "usage": {
436 "input_tokens": 0,
437 "output_tokens": 0,
438 "total_tokens": 0,
439 "type": "tokens",
440 "input_token_details": {
441 "audio_tokens": 0,
442 "text_tokens": 0
443 }
444 }
445}
446```
447
448## Domain Types
449
450### Transcription
451
452- `class Transcription`
453
454 Represents a transcription response returned by model, based on the provided input.
455
456 - `text: String`
457
458 The transcribed text.
459
460 - `logprobs: Array[Logprob{ token, bytes, logprob}]`
461
462 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.
463
464 - `token: String`
465
466 The token in the transcription.
467
468 - `bytes: Array[Float]`
469
470 The bytes of the token.
471
472 - `logprob: Float`
473
474 The log probability of the token.
475
476 - `usage: Tokens{ input_tokens, output_tokens, total_tokens, 2 more} | Duration{ seconds, type}`
477
478 Token usage statistics for the request.
479
480 - `class Tokens`
481
482 Usage statistics for models billed by token usage.
483
484 - `input_tokens: Integer`
485
486 Number of input tokens billed for this request.
487
488 - `output_tokens: Integer`
489
490 Number of output tokens generated.
491
492 - `total_tokens: Integer`
493
494 Total number of tokens used (input + output).
495
496 - `type: :tokens`
497
498 The type of the usage object. Always `tokens` for this variant.
499
500 - `:tokens`
501
502 - `input_token_details: InputTokenDetails{ audio_tokens, text_tokens}`
503
504 Details about the input tokens billed for this request.
505
506 - `audio_tokens: Integer`
507
508 Number of audio tokens billed for this request.
509
510 - `text_tokens: Integer`
511
512 Number of text tokens billed for this request.
513
514 - `class Duration`
515
516 Usage statistics for models billed by audio input duration.
517
518 - `seconds: Float`
519
520 Duration of the input audio in seconds.
521
522 - `type: :duration`
523
524 The type of the usage object. Always `duration` for this variant.
525
526 - `:duration`
527
528### Transcription Diarized
529
530- `class TranscriptionDiarized`
531
532 Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations.
533
534 - `duration: Float`
535
536 Duration of the input audio in seconds.
537
538 - `segments: Array[TranscriptionDiarizedSegment]`
539
540 Segments of the transcript annotated with timestamps and speaker labels.
541
542 - `id: String`
543
544 Unique identifier for the segment.
545
546 - `end_: Float`
547
548 End timestamp of the segment in seconds.
549
550 - `speaker: String`
551
552 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`, ...).
553
554 - `start: Float`
555
556 Start timestamp of the segment in seconds.
557
558 - `text: String`
559
560 Transcript text for this segment.
561
562 - `type: :"transcript.text.segment"`
563
564 The type of the segment. Always `transcript.text.segment`.
565
566 - `:"transcript.text.segment"`
567
568 - `task: :transcribe`
569
570 The type of task that was run. Always `transcribe`.
571
572 - `:transcribe`
573
574 - `text: String`
575
576 The concatenated transcript text for the entire audio input.
577
578 - `usage: Tokens{ input_tokens, output_tokens, total_tokens, 2 more} | Duration{ seconds, type}`
579
580 Token or duration usage statistics for the request.
581
582 - `class Tokens`
583
584 Usage statistics for models billed by token usage.
585
586 - `input_tokens: Integer`
587
588 Number of input tokens billed for this request.
589
590 - `output_tokens: Integer`
591
592 Number of output tokens generated.
593
594 - `total_tokens: Integer`
595
596 Total number of tokens used (input + output).
597
598 - `type: :tokens`
599
600 The type of the usage object. Always `tokens` for this variant.
601
602 - `:tokens`
603
604 - `input_token_details: InputTokenDetails{ audio_tokens, text_tokens}`
605
606 Details about the input tokens billed for this request.
607
608 - `audio_tokens: Integer`
609
610 Number of audio tokens billed for this request.
611
612 - `text_tokens: Integer`
613
614 Number of text tokens billed for this request.
615
616 - `class Duration`
617
618 Usage statistics for models billed by audio input duration.
619
620 - `seconds: Float`
621
622 Duration of the input audio in seconds.
623
624 - `type: :duration`
625
626 The type of the usage object. Always `duration` for this variant.
627
628 - `:duration`
629
630### Transcription Diarized Segment
631
632- `class TranscriptionDiarizedSegment`
633
634 A segment of diarized transcript text with speaker metadata.
635
636 - `id: String`
637
638 Unique identifier for the segment.
639
640 - `end_: Float`
641
642 End timestamp of the segment in seconds.
643
644 - `speaker: String`
645
646 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`, ...).
647
648 - `start: Float`
649
650 Start timestamp of the segment in seconds.
651
652 - `text: String`
653
654 Transcript text for this segment.
655
656 - `type: :"transcript.text.segment"`
657
658 The type of the segment. Always `transcript.text.segment`.
659
660 - `:"transcript.text.segment"`
661
662### Transcription Include
663
664- `TranscriptionInclude = :logprobs`
665
666 - `:logprobs`
667
668### Transcription Segment
669
670- `class TranscriptionSegment`
671
672 - `id: Integer`
673
674 Unique identifier of the segment.
675
676 - `avg_logprob: Float`
677
678 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
679
680 - `compression_ratio: Float`
681
682 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
683
684 - `end_: Float`
685
686 End time of the segment in seconds.
687
688 - `no_speech_prob: Float`
689
690 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.
691
692 - `seek: Integer`
693
694 Seek offset of the segment.
695
696 - `start: Float`
697
698 Start time of the segment in seconds.
699
700 - `temperature: Float`
701
702 Temperature parameter used for generating the segment.
703
704 - `text: String`
705
706 Text content of the segment.
707
708 - `tokens: Array[Integer]`
709
710 Array of token IDs for the text content.
711
712### Transcription Stream Event
713
714- `TranscriptionStreamEvent = TranscriptionTextSegmentEvent | TranscriptionTextDeltaEvent | TranscriptionTextDoneEvent`
715
716 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`.
717
718 - `class TranscriptionTextSegmentEvent`
719
720 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`.
721
722 - `id: String`
723
724 Unique identifier for the segment.
725
726 - `end_: Float`
727
728 End timestamp of the segment in seconds.
729
730 - `speaker: String`
731
732 Speaker label for this segment.
733
734 - `start: Float`
735
736 Start timestamp of the segment in seconds.
737
738 - `text: String`
739
740 Transcript text for this segment.
741
742 - `type: :"transcript.text.segment"`
743
744 The type of the event. Always `transcript.text.segment`.
745
746 - `:"transcript.text.segment"`
747
748 - `class TranscriptionTextDeltaEvent`
749
750 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`.
751
752 - `delta: String`
753
754 The text delta that was additionally transcribed.
755
756 - `type: :"transcript.text.delta"`
757
758 The type of the event. Always `transcript.text.delta`.
759
760 - `:"transcript.text.delta"`
761
762 - `logprobs: Array[Logprob{ token, bytes, logprob}]`
763
764 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`.
765
766 - `token: String`
767
768 The token that was used to generate the log probability.
769
770 - `bytes: Array[Integer]`
771
772 The bytes that were used to generate the log probability.
773
774 - `logprob: Float`
775
776 The log probability of the token.
777
778 - `segment_id: String`
779
780 Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`.
781
782 - `class TranscriptionTextDoneEvent`
783
784 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`.
785
786 - `text: String`
787
788 The text that was transcribed.
789
790 - `type: :"transcript.text.done"`
791
792 The type of the event. Always `transcript.text.done`.
793
794 - `:"transcript.text.done"`
795
796 - `logprobs: Array[Logprob{ token, bytes, logprob}]`
797
798 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`.
799
800 - `token: String`
801
802 The token that was used to generate the log probability.
803
804 - `bytes: Array[Integer]`
805
806 The bytes that were used to generate the log probability.
807
808 - `logprob: Float`
809
810 The log probability of the token.
811
812 - `usage: Usage{ input_tokens, output_tokens, total_tokens, 2 more}`
813
814 Usage statistics for models billed by token usage.
815
816 - `input_tokens: Integer`
817
818 Number of input tokens billed for this request.
819
820 - `output_tokens: Integer`
821
822 Number of output tokens generated.
823
824 - `total_tokens: Integer`
825
826 Total number of tokens used (input + output).
827
828 - `type: :tokens`
829
830 The type of the usage object. Always `tokens` for this variant.
831
832 - `:tokens`
833
834 - `input_token_details: InputTokenDetails{ audio_tokens, text_tokens}`
835
836 Details about the input tokens billed for this request.
837
838 - `audio_tokens: Integer`
839
840 Number of audio tokens billed for this request.
841
842 - `text_tokens: Integer`
843
844 Number of text tokens billed for this request.
845
846### Transcription Text Delta Event
847
848- `class TranscriptionTextDeltaEvent`
849
850 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`.
851
852 - `delta: String`
853
854 The text delta that was additionally transcribed.
855
856 - `type: :"transcript.text.delta"`
857
858 The type of the event. Always `transcript.text.delta`.
859
860 - `:"transcript.text.delta"`
861
862 - `logprobs: Array[Logprob{ token, bytes, logprob}]`
863
864 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`.
865
866 - `token: String`
867
868 The token that was used to generate the log probability.
869
870 - `bytes: Array[Integer]`
871
872 The bytes that were used to generate the log probability.
873
874 - `logprob: Float`
875
876 The log probability of the token.
877
878 - `segment_id: String`
879
880 Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`.
881
882### Transcription Text Done Event
883
884- `class TranscriptionTextDoneEvent`
885
886 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`.
887
888 - `text: String`
889
890 The text that was transcribed.
891
892 - `type: :"transcript.text.done"`
893
894 The type of the event. Always `transcript.text.done`.
895
896 - `:"transcript.text.done"`
897
898 - `logprobs: Array[Logprob{ token, bytes, logprob}]`
899
900 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`.
901
902 - `token: String`
903
904 The token that was used to generate the log probability.
905
906 - `bytes: Array[Integer]`
907
908 The bytes that were used to generate the log probability.
909
910 - `logprob: Float`
911
912 The log probability of the token.
913
914 - `usage: Usage{ input_tokens, output_tokens, total_tokens, 2 more}`
915
916 Usage statistics for models billed by token usage.
917
918 - `input_tokens: Integer`
919
920 Number of input tokens billed for this request.
921
922 - `output_tokens: Integer`
923
924 Number of output tokens generated.
925
926 - `total_tokens: Integer`
927
928 Total number of tokens used (input + output).
929
930 - `type: :tokens`
931
932 The type of the usage object. Always `tokens` for this variant.
933
934 - `:tokens`
935
936 - `input_token_details: InputTokenDetails{ audio_tokens, text_tokens}`
937
938 Details about the input tokens billed for this request.
939
940 - `audio_tokens: Integer`
941
942 Number of audio tokens billed for this request.
943
944 - `text_tokens: Integer`
945
946 Number of text tokens billed for this request.
947
948### Transcription Text Segment Event
949
950- `class TranscriptionTextSegmentEvent`
951
952 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`.
953
954 - `id: String`
955
956 Unique identifier for the segment.
957
958 - `end_: Float`
959
960 End timestamp of the segment in seconds.
961
962 - `speaker: String`
963
964 Speaker label for this segment.
965
966 - `start: Float`
967
968 Start timestamp of the segment in seconds.
969
970 - `text: String`
971
972 Transcript text for this segment.
973
974 - `type: :"transcript.text.segment"`
975
976 The type of the event. Always `transcript.text.segment`.
977
978 - `:"transcript.text.segment"`
979
980### Transcription Verbose
981
982- `class TranscriptionVerbose`
983
984 Represents a verbose json transcription response returned by model, based on the provided input.
985
986 - `duration: Float`
987
988 The duration of the input audio.
989
990 - `language: String`
991
992 The language of the input audio.
993
994 - `text: String`
995
996 The transcribed text.
997
998 - `segments: Array[TranscriptionSegment]`
999
1000 Segments of the transcribed text and their corresponding details.
1001
1002 - `id: Integer`
1003
1004 Unique identifier of the segment.
1005
1006 - `avg_logprob: Float`
1007
1008 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
1009
1010 - `compression_ratio: Float`
1011
1012 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
1013
1014 - `end_: Float`
1015
1016 End time of the segment in seconds.
1017
1018 - `no_speech_prob: Float`
1019
1020 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.
1021
1022 - `seek: Integer`
1023
1024 Seek offset of the segment.
1025
1026 - `start: Float`
1027
1028 Start time of the segment in seconds.
1029
1030 - `temperature: Float`
1031
1032 Temperature parameter used for generating the segment.
1033
1034 - `text: String`
1035
1036 Text content of the segment.
1037
1038 - `tokens: Array[Integer]`
1039
1040 Array of token IDs for the text content.
1041
1042 - `usage: Usage{ seconds, type}`
1043
1044 Usage statistics for models billed by audio input duration.
1045
1046 - `seconds: Float`
1047
1048 Duration of the input audio in seconds.
1049
1050 - `type: :duration`
1051
1052 The type of the usage object. Always `duration` for this variant.
1053
1054 - `:duration`
1055
1056 - `words: Array[TranscriptionWord]`
1057
1058 Extracted words and their corresponding timestamps.
1059
1060 - `end_: Float`
1061
1062 End time of the word in seconds.
1063
1064 - `start: Float`
1065
1066 Start time of the word in seconds.
1067
1068 - `word: String`
1069
1070 The text content of the word.
1071
1072### Transcription Word
1073
1074- `class TranscriptionWord`
1075
1076 - `end_: Float`
1077
1078 End time of the word in seconds.
1079
1080 - `start: Float`
1081
1082 Start time of the word in seconds.
1083
1084 - `word: String`
1085
1086 The text content of the word.
1087
1088### Transcription Create Response
1089
1090- `TranscriptionCreateResponse = Transcription | TranscriptionDiarized | TranscriptionVerbose`
1091
1092 Represents a transcription response returned by model, based on the provided input.
1093
1094 - `class Transcription`
1095
1096 Represents a transcription response returned by model, based on the provided input.
1097
1098 - `text: String`
1099
1100 The transcribed text.
1101
1102 - `logprobs: Array[Logprob{ token, bytes, logprob}]`
1103
1104 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.
1105
1106 - `token: String`
1107
1108 The token in the transcription.
1109
1110 - `bytes: Array[Float]`
1111
1112 The bytes of the token.
1113
1114 - `logprob: Float`
1115
1116 The log probability of the token.
1117
1118 - `usage: Tokens{ input_tokens, output_tokens, total_tokens, 2 more} | Duration{ seconds, type}`
1119
1120 Token usage statistics for the request.
1121
1122 - `class Tokens`
1123
1124 Usage statistics for models billed by token usage.
1125
1126 - `input_tokens: Integer`
1127
1128 Number of input tokens billed for this request.
1129
1130 - `output_tokens: Integer`
1131
1132 Number of output tokens generated.
1133
1134 - `total_tokens: Integer`
1135
1136 Total number of tokens used (input + output).
1137
1138 - `type: :tokens`
1139
1140 The type of the usage object. Always `tokens` for this variant.
1141
1142 - `:tokens`
1143
1144 - `input_token_details: InputTokenDetails{ audio_tokens, text_tokens}`
1145
1146 Details about the input tokens billed for this request.
1147
1148 - `audio_tokens: Integer`
1149
1150 Number of audio tokens billed for this request.
1151
1152 - `text_tokens: Integer`
1153
1154 Number of text tokens billed for this request.
1155
1156 - `class Duration`
1157
1158 Usage statistics for models billed by audio input duration.
1159
1160 - `seconds: Float`
1161
1162 Duration of the input audio in seconds.
1163
1164 - `type: :duration`
1165
1166 The type of the usage object. Always `duration` for this variant.
1167
1168 - `:duration`
1169
1170 - `class TranscriptionDiarized`
1171
1172 Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations.
1173
1174 - `duration: Float`
1175
1176 Duration of the input audio in seconds.
1177
1178 - `segments: Array[TranscriptionDiarizedSegment]`
1179
1180 Segments of the transcript annotated with timestamps and speaker labels.
1181
1182 - `id: String`
1183
1184 Unique identifier for the segment.
1185
1186 - `end_: Float`
1187
1188 End timestamp of the segment in seconds.
1189
1190 - `speaker: String`
1191
1192 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`, ...).
1193
1194 - `start: Float`
1195
1196 Start timestamp of the segment in seconds.
1197
1198 - `text: String`
1199
1200 Transcript text for this segment.
1201
1202 - `type: :"transcript.text.segment"`
1203
1204 The type of the segment. Always `transcript.text.segment`.
1205
1206 - `:"transcript.text.segment"`
1207
1208 - `task: :transcribe`
1209
1210 The type of task that was run. Always `transcribe`.
1211
1212 - `:transcribe`
1213
1214 - `text: String`
1215
1216 The concatenated transcript text for the entire audio input.
1217
1218 - `usage: Tokens{ input_tokens, output_tokens, total_tokens, 2 more} | Duration{ seconds, type}`
1219
1220 Token or duration usage statistics for the request.
1221
1222 - `class Tokens`
1223
1224 Usage statistics for models billed by token usage.
1225
1226 - `input_tokens: Integer`
1227
1228 Number of input tokens billed for this request.
1229
1230 - `output_tokens: Integer`
1231
1232 Number of output tokens generated.
1233
1234 - `total_tokens: Integer`
1235
1236 Total number of tokens used (input + output).
1237
1238 - `type: :tokens`
1239
1240 The type of the usage object. Always `tokens` for this variant.
1241
1242 - `:tokens`
1243
1244 - `input_token_details: InputTokenDetails{ audio_tokens, text_tokens}`
1245
1246 Details about the input tokens billed for this request.
1247
1248 - `audio_tokens: Integer`
1249
1250 Number of audio tokens billed for this request.
1251
1252 - `text_tokens: Integer`
1253
1254 Number of text tokens billed for this request.
1255
1256 - `class Duration`
1257
1258 Usage statistics for models billed by audio input duration.
1259
1260 - `seconds: Float`
1261
1262 Duration of the input audio in seconds.
1263
1264 - `type: :duration`
1265
1266 The type of the usage object. Always `duration` for this variant.
1267
1268 - `:duration`
1269
1270 - `class TranscriptionVerbose`
1271
1272 Represents a verbose json transcription response returned by model, based on the provided input.
1273
1274 - `duration: Float`
1275
1276 The duration of the input audio.
1277
1278 - `language: String`
1279
1280 The language of the input audio.
1281
1282 - `text: String`
1283
1284 The transcribed text.
1285
1286 - `segments: Array[TranscriptionSegment]`
1287
1288 Segments of the transcribed text and their corresponding details.
1289
1290 - `id: Integer`
1291
1292 Unique identifier of the segment.
1293
1294 - `avg_logprob: Float`
1295
1296 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
1297
1298 - `compression_ratio: Float`
1299
1300 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
1301
1302 - `end_: Float`
1303
1304 End time of the segment in seconds.
1305
1306 - `no_speech_prob: Float`
1307
1308 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.
1309
1310 - `seek: Integer`
1311
1312 Seek offset of the segment.
1313
1314 - `start: Float`
1315
1316 Start time of the segment in seconds.
1317
1318 - `temperature: Float`
1319
1320 Temperature parameter used for generating the segment.
1321
1322 - `text: String`
1323
1324 Text content of the segment.
1325
1326 - `tokens: Array[Integer]`
1327
1328 Array of token IDs for the text content.
1329
1330 - `usage: Usage{ seconds, type}`
1331
1332 Usage statistics for models billed by audio input duration.
1333
1334 - `seconds: Float`
1335
1336 Duration of the input audio in seconds.
1337
1338 - `type: :duration`
1339
1340 The type of the usage object. Always `duration` for this variant.
1341
1342 - `:duration`
1343
1344 - `words: Array[TranscriptionWord]`
1345
1346 Extracted words and their corresponding timestamps.
1347
1348 - `end_: Float`
1349
1350 End time of the word in seconds.
1351
1352 - `start: Float`
1353
1354 Start time of the word in seconds.
1355
1356 - `word: String`
1357
1358 The text content of the word.