OpenAI API

Audio

Turn audio into text or text into audio.

Generates audio from the input text.

post
https://api.openai.com/v1/audio/speech

Body

application/json

CreateSpeechRequest

* Additional properties are NOT allowed.
modelAny Of
required

One of the available TTS models: tts-1 or tts-1-hd

Variant 1string
inputstringrequired

The text to generate audio for. The maximum length is 4096 characters.

<= 4096 characters

voicestringrequired

The voice to use when generating the audio. Supported voices are alloy, ash, coral, echo, fable, onyx, nova, sage and shimmer. Previews of the voices are available in the Text to speech guide.

Allowed values:alloyashcoralechofableonyxnovasageshimmer

response_formatstring

The format to audio in. Supported formats are mp3, opus, aac, flac, wav, and pcm.

Allowed values:mp3opusaacflacwavpcm

Default:mp3

speednumber

The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default.

Default:1

>= 0.25<= 4

Response

200 application/octet-stream

OK

string
post/audio/speech

Body

{ "model": {}, "input": "input", "voice": "alloy" }
 
200 application/octet-stream

Transcribes audio into the input language.

post
https://api.openai.com/v1/audio/transcriptions

Body

multipart/form-data

CreateTranscriptionRequest

* Additional properties are NOT allowed.
filestringrequired

The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.

modelAny Of
required

ID of the model to use. Only whisper-1 (which is powered by our open source Whisper V2 model) is currently available.

Example:whisper-1

Variant 1string
languagestring

The language of the input audio. Supplying the input language in ISO-639-1 (e.g. en) format will improve accuracy and latency.

promptstring

An optional text to guide the model’s style or continue a previous audio segment. The prompt should match the audio language.

response_formatstring

The format of the output, in one of these options: json, text, srt, verbose_json, or vtt.

Allowed values:jsontextsrtverbose_jsonvtt

Default:json

temperaturenumber

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 to automatically increase the temperature until certain thresholds are hit.

Default:0

timestamp_granularities[]array[string]

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.

Allowed values:wordsegment

Default:segment

Response

200 application/json

OK

One Of
textstringrequired

The transcribed text.

post/audio/transcriptions

Body

{ "file": "file", "model": {} }
 
200 application/json

Translates audio into English.

post
https://api.openai.com/v1/audio/translations

Body

multipart/form-data

CreateTranslationRequest

* Additional properties are NOT allowed.
filestringrequired

The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.

modelAny Of
required

ID of the model to use. Only whisper-1 (which is powered by our open source Whisper V2 model) is currently available.

Example:whisper-1

Variant 1string
promptstring

An optional text to guide the model’s style or continue a previous audio segment. The prompt should be in English.

response_formatstring

The format of the output, in one of these options: json, text, srt, verbose_json, or vtt.

Allowed values:jsontextsrtverbose_jsonvtt

Default:json

temperaturenumber

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 to automatically increase the temperature until certain thresholds are hit.

Default:0

Response

200 application/json

OK

One Of
textstringrequired
post/audio/translations

Body

{ "file": "file", "model": {} }
 
200 application/json

Chat

Given a list of messages comprising a conversation, the model will return a response.