resources/audio/subresources/translations/index.md +0 −241 deleted
File Deleted View Diff
1# Translations
2
3## Create translation
4
5**post** `/audio/translations`
6
7Translates audio into English.
8
9### Returns
10
11- `Translation object { text }`
12
13 - `text: string`
14
15- `TranslationVerbose object { duration, language, text, segments }`
16
17 - `duration: number`
18
19 The duration of the input audio.
20
21 - `language: string`
22
23 The language of the output translation (always `english`).
24
25 - `text: string`
26
27 The translated text.
28
29 - `segments: optional array of TranscriptionSegment`
30
31 Segments of the translated text and their corresponding details.
32
33 - `id: number`
34
35 Unique identifier of the segment.
36
37 - `avg_logprob: number`
38
39 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
40
41 - `compression_ratio: number`
42
43 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
44
45 - `end: number`
46
47 End time of the segment in seconds.
48
49 - `no_speech_prob: number`
50
51 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.
52
53 - `seek: number`
54
55 Seek offset of the segment.
56
57 - `start: number`
58
59 Start time of the segment in seconds.
60
61 - `temperature: number`
62
63 Temperature parameter used for generating the segment.
64
65 - `text: string`
66
67 Text content of the segment.
68
69 - `tokens: array of number`
70
71 Array of token IDs for the text content.
72
73### Example
74
75```http
76curl https://api.openai.com/v1/audio/translations \
77 -H 'Content-Type: multipart/form-data' \
78 -H "Authorization: Bearer $OPENAI_API_KEY" \
79 -F 'file=@/path/to/file' \
80 -F model=whisper-1
81```
82
83#### Response
84
85```json
86{
87 "text": "text"
88}
89```
90
91### Example
92
93```http
94curl https://api.openai.com/v1/audio/translations \
95 -H "Authorization: Bearer $OPENAI_API_KEY" \
96 -H "Content-Type: multipart/form-data" \
97 -F file="@/path/to/file/german.m4a" \
98 -F model="whisper-1"
99```
100
101#### Response
102
103```json
104{
105 "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?"
106}
107```
108
109## Domain Types
110
111### Translation
112
113- `Translation object { text }`
114
115 - `text: string`
116
117### Translation Verbose
118
119- `TranslationVerbose object { duration, language, text, segments }`
120
121 - `duration: number`
122
123 The duration of the input audio.
124
125 - `language: string`
126
127 The language of the output translation (always `english`).
128
129 - `text: string`
130
131 The translated text.
132
133 - `segments: optional array of TranscriptionSegment`
134
135 Segments of the translated text and their corresponding details.
136
137 - `id: number`
138
139 Unique identifier of the segment.
140
141 - `avg_logprob: number`
142
143 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
144
145 - `compression_ratio: number`
146
147 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
148
149 - `end: number`
150
151 End time of the segment in seconds.
152
153 - `no_speech_prob: number`
154
155 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.
156
157 - `seek: number`
158
159 Seek offset of the segment.
160
161 - `start: number`
162
163 Start time of the segment in seconds.
164
165 - `temperature: number`
166
167 Temperature parameter used for generating the segment.
168
169 - `text: string`
170
171 Text content of the segment.
172
173 - `tokens: array of number`
174
175 Array of token IDs for the text content.
176
177### Translation Create Response
178
179- `TranslationCreateResponse = Translation or TranslationVerbose`
180
181 - `Translation object { text }`
182
183 - `text: string`
184
185 - `TranslationVerbose object { duration, language, text, segments }`
186
187 - `duration: number`
188
189 The duration of the input audio.
190
191 - `language: string`
192
193 The language of the output translation (always `english`).
194
195 - `text: string`
196
197 The translated text.
198
199 - `segments: optional array of TranscriptionSegment`
200
201 Segments of the translated text and their corresponding details.
202
203 - `id: number`
204
205 Unique identifier of the segment.
206
207 - `avg_logprob: number`
208
209 Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.
210
211 - `compression_ratio: number`
212
213 Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.
214
215 - `end: number`
216
217 End time of the segment in seconds.
218
219 - `no_speech_prob: number`
220
221 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.
222
223 - `seek: number`
224
225 Seek offset of the segment.
226
227 - `start: number`
228
229 Start time of the segment in seconds.
230
231 - `temperature: number`
232
233 Temperature parameter used for generating the segment.
234
235 - `text: string`
236
237 Text content of the segment.
238
239 - `tokens: array of number`
240
241 Array of token IDs for the text content.