Audio

Learn how to turn audio into text or text into audio.

Related guide: Speech to text

Create speech

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

Generates audio from the input text.

Request body

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

One of the available TTS models: tts-1, tts-1-hd, gpt-4o-mini-tts, or gpt-4o-mini-tts-2025-12-15.

The voice to use when generating the audio. Supported built-in voices are alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse, marin, and cedar. You may also provide a custom voice object with an id, for example { "id": "voice_1234" }. Previews of the voices are available in the Text to speech guide.

Control the voice of your generated audio with additional instructions. Does not work with tts-1 or tts-1-hd.

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

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

The format to stream the audio in. Supported formats are sse and audio. sse is not supported for tts-1 or tts-1-hd.

Returns

The audio file content or a stream of audio events.

Example request
1
2
3
4
5
6
7
8
9
curl https://api.openai.com/v1/audio/speech \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini-tts",
    "input": "The quick brown fox jumped over the lazy dog.",
    "voice": "alloy"
  }' \
  --output speech.mp3

Create voice

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

Create a custom voice you can use for audio output (for example, in Text-to-Speech and the Realtime API). This requires an audio sample and a previously uploaded consent recording.

See the custom voices guide for requirements and best practices. Custom voices are limited to eligible customers.

Request body

The sample audio recording file. Maximum size is 10 MiB.

Supported MIME types: audio/mpeg, audio/wav, audio/x-wav, audio/ogg, audio/aac, audio/flac, audio/webm, audio/mp4.

The name of the new voice.

Returns

The created voice.

Example request
1
2
3
4
5
6
curl https://api.openai.com/v1/audio/voices \
  -X POST \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F "name=My new voice" \
  -F "consent=cons_1234" \
  -F "audio_sample=@$HOME/audio_sample.wav;type=audio/x-wav"

Create voice consent

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

Upload a consent recording that authorizes creation of a custom voice.

See the custom voices guide for requirements and best practices. Custom voices are limited to eligible customers.

Request body

The BCP 47 language tag for the consent phrase (for example, en-US).

The label to use for this consent recording.

The consent audio recording file. Maximum size is 10 MiB.

Supported MIME types: audio/mpeg, audio/wav, audio/x-wav, audio/ogg, audio/aac, audio/flac, audio/webm, audio/mp4.

Returns

The created voice consent recording metadata.

Example request
1
2
3
4
5
6
curl https://api.openai.com/v1/audio/voice_consents \
  -X POST \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F "name=John Doe" \
  -F "language=en-US" \
  -F "recording=@$HOME/consent_recording.wav;type=audio/x-wav"

List voice consents

get https://api.openai.com/v1/audio/voice_consents

List consent recordings available to your organization for creating custom voices.

See the custom voices guide. Custom voices are limited to eligible customers.

Query parameters

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

Returns

A paginated list of voice consent recordings.

Example request
1
2
curl https://api.openai.com/v1/audio/voice_consents?limit=20 \
  -H "Authorization: Bearer $OPENAI_API_KEY"

Retrieve voice consent

get https://api.openai.com/v1/audio/voice_consents/{consent_id}

Retrieve consent recording metadata used for creating custom voices.

See the custom voices guide. Custom voices are limited to eligible customers.

Path parameters

Returns

The voice consent recording metadata.

Example request
1
2
curl https://api.openai.com/v1/audio/voice_consents/cons_1234 \
  -H "Authorization: Bearer $OPENAI_API_KEY"

Update voice consent

post https://api.openai.com/v1/audio/voice_consents/{consent_id}

Update consent recording metadata used for creating custom voices. This endpoint updates metadata only and does not replace the underlying audio.

See the custom voices guide. Custom voices are limited to eligible customers.

Path parameters

Request body

The updated label for this consent recording.

Returns

The updated voice consent recording metadata.

Example request
1
2
3
4
5
6
7
curl https://api.openai.com/v1/audio/voice_consents/cons_1234 \
  -X POST \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe"
  }'

Delete voice consent

delete https://api.openai.com/v1/audio/voice_consents/{consent_id}

Delete a consent recording that was uploaded for creating custom voices.

See the custom voices guide. Custom voices are limited to eligible customers.

Path parameters

Returns

A deletion confirmation.

Example request
1
2
3
curl https://api.openai.com/v1/audio/voice_consents/cons_1234 \
  -X DELETE \
  -H "Authorization: Bearer $OPENAI_API_KEY"

Create transcription

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

Transcribes audio into the input language.

Request body

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

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.

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.

Additional information to include in the transcription response. logprobs will return the log probabilities of the tokens in the response to understand the model's confidence in the transcription. logprobs only works with response_format set to json and only with 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.

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.

Optional list of audio samples (as 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.

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

An optional text to guide the model's style or continue a previous audio segment. The prompt should match the audio language. This field is not supported when using gpt-4o-transcribe-diarize.

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.

If set to true, the model response data will be streamed to the client as it is generated using server-sent events. See the Streaming section of the Speech-to-Text guide for more information.

Note: Streaming is not supported for the whisper-1 model and will be ignored.

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.

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. This option is not available for gpt-4o-transcribe-diarize.

Example request
1
2
3
4
5
curl https://api.openai.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F file="@/path/to/file/audio.mp3" \
  -F model="gpt-4o-transcribe"
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "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.",
  "usage": {
    "type": "tokens",
    "input_tokens": 14,
    "input_token_details": {
      "text_tokens": 0,
      "audio_tokens": 14
    },
    "output_tokens": 45,
    "total_tokens": 59
  }
}

Create translation

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

Translates audio into English.

Request body

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

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

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

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

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.

Returns

The translated text.

Example request
1
2
3
4
5
curl https://api.openai.com/v1/audio/translations \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F file="@/path/to/file/german.m4a" \
  -F model="whisper-1"
Response
1
2
3
{
  "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?"
}

The voice object

A custom voice that can be used for audio output.

The Unix timestamp (in seconds) for when the voice was created.

The voice identifier, which can be referenced in API endpoints.

The name of the voice.

The object type, which is always audio.voice.

OBJECT The voice object
1
2
3
4
5
6
{
  "object": "audio.voice",
  "id": "voice_123abc",
  "name": "My new voice",
  "created_at": 1734220800
}

A consent recording used to authorize creation of a custom voice.

OBJECT The voice consent object
1
2
3
4
5
6
7
{
  "object": "audio.voice_consent",
  "id": "cons_1234",
  "name": "John Doe",
  "language": "en-US",
  "created_at": 1734220800
}
OBJECT The voice consent list object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
  "object": "list",
  "data": [
    {
      "object": "audio.voice_consent",
      "id": "cons_1234",
      "name": "John Doe",
      "language": "en-US",
      "created_at": 1734220800
    }
  ],
  "first_id": "cons_1234",
  "last_id": "cons_1234",
  "has_more": false
}
OBJECT The voice consent deletion object
1
2
3
4
5
{
  "object": "audio.voice_consent",
  "id": "cons_1234",
  "deleted": true
}

The transcription object (JSON)

Represents a transcription response returned by model, based on the provided input.

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.

The transcribed text.

Token usage statistics for the request.

OBJECT The transcription object (JSON)
1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "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.",
  "usage": {
    "type": "tokens",
    "input_tokens": 14,
    "input_token_details": {
      "text_tokens": 10,
      "audio_tokens": 4
    },
    "output_tokens": 101,
    "total_tokens": 115
  }
}

The transcription object (Diarized JSON)

Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations.

Duration of the input audio in seconds.

Segments of the transcript annotated with timestamps and speaker labels.

The type of task that was run. Always transcribe.

The concatenated transcript text for the entire audio input.

Token or duration usage statistics for the request.

OBJECT The transcription object (Diarized JSON)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
  "task": "transcribe",
  "duration": 42.7,
  "text": "Agent: Thanks for calling OpenAI support.\nCustomer: Hi, I need help with diarization.",
  "segments": [
    {
      "type": "transcript.text.segment",
      "id": "seg_001",
      "start": 0.0,
      "end": 5.2,
      "text": "Thanks for calling OpenAI support.",
      "speaker": "agent"
    },
    {
      "type": "transcript.text.segment",
      "id": "seg_002",
      "start": 5.2,
      "end": 12.8,
      "text": "Hi, I need help with diarization.",
      "speaker": "A"
    }
  ],
  "usage": {
    "type": "duration",
    "seconds": 43
  }
}

The transcription object (Verbose JSON)

Represents a verbose json transcription response returned by model, based on the provided input.

The duration of the input audio.

The language of the input audio.

Segments of the transcribed text and their corresponding details.

The transcribed text.

Usage statistics for models billed by audio input duration.

Extracted words and their corresponding timestamps.

OBJECT The transcription object (Verbose JSON)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
  "task": "transcribe",
  "language": "english",
  "duration": 8.470000267028809,
  "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.",
  "segments": [
    {
      "id": 0,
      "seek": 0,
      "start": 0.0,
      "end": 3.319999933242798,
      "text": " The beach was a popular spot on a hot summer day.",
      "tokens": [
        50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530
      ],
      "temperature": 0.0,
      "avg_logprob": -0.2860786020755768,
      "compression_ratio": 1.2363636493682861,
      "no_speech_prob": 0.00985979475080967
    },
    ...
  ],
  "usage": {
    "type": "duration",
    "seconds": 9
  }
}

Stream Event (speech.audio.delta)

Emitted for each chunk of audio data generated during speech synthesis.

A chunk of Base64-encoded audio data.

The type of the event. Always speech.audio.delta.

OBJECT Stream Event (speech.audio.delta)
1
2
3
4
{
  "type": "speech.audio.delta",
  "audio": "base64-encoded-audio-data"
}

Stream Event (speech.audio.done)

Emitted when the speech synthesis is complete and all audio has been streamed.

The type of the event. Always speech.audio.done.

Token usage statistics for the request.

OBJECT Stream Event (speech.audio.done)
1
2
3
4
5
6
7
8
{
  "type": "speech.audio.done",
  "usage": {
    "input_tokens": 14,
    "output_tokens": 101,
    "total_tokens": 115
  }
}

Stream Event (transcript.text.delta)

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 with the Stream parameter set to true.

The text delta that was additionally transcribed.

The log probabilities of the delta. Only included if you create a transcription with the include[] parameter set to logprobs.

Identifier of the diarized segment that this delta belongs to. Only present when using gpt-4o-transcribe-diarize.

The type of the event. Always transcript.text.delta.

OBJECT Stream Event (transcript.text.delta)
1
2
3
4
{
  "type": "transcript.text.delta",
  "delta": " wonderful"
}

Stream Event (transcript.text.segment)

Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you create a transcription with stream set to true and response_format set to diarized_json.

End timestamp of the segment in seconds.

Unique identifier for the segment.

Speaker label for this segment.

Start timestamp of the segment in seconds.

Transcript text for this segment.

The type of the event. Always transcript.text.segment.

OBJECT Stream Event (transcript.text.segment)
1
2
3
4
5
6
7
8
{
  "type": "transcript.text.segment",
  "id": "seg_002",
  "start": 5.2,
  "end": 12.8,
  "text": "Hi, I need help with diarization.",
  "speaker": "A"
}

Stream Event (transcript.text.done)

Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you create a transcription with the Stream parameter set to true.

The log probabilities of the individual tokens in the transcription. Only included if you create a transcription with the include[] parameter set to logprobs.

The text that was transcribed.

The type of the event. Always transcript.text.done.

Usage statistics for models billed by token usage.

OBJECT Stream Event (transcript.text.done)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
  "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.",
  "usage": {
    "type": "tokens",
    "input_tokens": 14,
    "input_token_details": {
      "text_tokens": 10,
      "audio_tokens": 4
    },
    "output_tokens": 31,
    "total_tokens": 45
  }
}