For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

File transcription

Convert recorded speech into text.

Use file transcription when you have a completed recording or a bounded audio request. Upload the audio and receive a final transcript, or stream text while the model processes the file.

Start with gpt-transcribe. This is the recommended model for transcribing recorded speech in its original language. Use a specialized model only if you need speaker labels, word timestamps, subtitle formats, or translation into English.

Files can be up to 25 MB. Supported input formats are mp3, mp4, mpeg, mpga, m4a, wav, and webm.

For audio that is still arriving from a microphone, call, or media stream, use Realtime transcription.

Quickstart

Transcriptions

Send the audio file to /v1/audio/transcriptions with gpt-transcribe:

Transcribe audio
1
2
3
4
5
6
7
8
9
10
from openai import OpenAI

client = OpenAI()
audio_file = open("audio.wav", "rb")

transcription = client.audio.transcriptions.create(
    model="gpt-transcribe", file=audio_file
)

print(transcription.text)

The model returns the transcript and the detected languages as JSON:

1
2
3
4
{
  "text": "Bonjour, pouvez-vous m'entendre ?",
  "languages": [{ "code": "fr" }]
}

When the model can’t make a reliable language prediction, it returns "languages": []. See the Audio API reference for the complete request and response fields.

Add transcription context

Use prompt, keywords, and languages with gpt-transcribe to improve transcription of domain terms and multilingual audio:

Add context and language hints
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from openai import OpenAI

client = OpenAI()

with open("meeting.wav", "rb") as audio_file:
    transcription = client.audio.transcriptions.create(
        model="gpt-transcribe",
        file=audio_file,
        prompt="A customer support call about a premium plan and account AC-42.",
        extra_body={
            "keywords": ["premium plan", "AC-42", "billing"],
            "languages": ["en", "fr"],
        },
    )

print(transcription.text)
  • Use prompt for unstructured context about the recording.
  • Use keywords for literal terms you expect to hear.
  • Use languages for the expected input languages.

Keywords are hints, not required output. Include only relevant terms, and evaluate whether they improve accuracy without causing unspoken terms to appear.

For gpt-transcribe, languages replaces the singular language field. Don’t send both fields. Keep each keyword on one line and don’t include <, >, a carriage return, or a line feed. The API rejects the entire request when it encounters one of these characters or when prompt exceeds the model’s length limit.

Speaker diarization

Use gpt-4o-transcribe-diarize only when you need to identify who speaks during different parts of a recording. This specialized speaker-labeling model isn’t the recommended model for ordinary file transcription.

Request the diarized_json response format to receive segments with speaker, start, and end metadata. For audio longer than 30 seconds, set chunking_strategy to "auto" or a voice activity detection configuration.

You can optionally supply up to four short audio references with known_speaker_names[] and known_speaker_references[] to map segments onto known speakers. Provide reference clips between 2–10 seconds in any input format supported by the main audio upload; encode them as data URLs when using multipart form data.

Diarize a meeting recording
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
import base64
from openai import OpenAI

client = OpenAI()


def to_data_url(path: str) -> str:
    with open(path, "rb") as fh:
        return "data:audio/wav;base64," + base64.b64encode(fh.read()).decode("utf-8")


with open("meeting.wav", "rb") as audio_file:
    transcript = client.audio.transcriptions.create(
        model="gpt-4o-transcribe-diarize",
        file=audio_file,
        response_format="diarized_json",
        chunking_strategy="auto",
        extra_body={
            "known_speaker_names": ["agent"],
            "known_speaker_references": [to_data_url("agent.wav")],
        },
    )

for segment in transcript.segments:
    print(segment.speaker, segment.text, segment.start, segment.end)

When stream=true, speaker-labeled responses emit transcript.text.segment events whenever a segment completes. transcript.text.delta events include a segment_id field, but deltas don’t include partial speaker assignments. The model assigns a speaker only when it finalizes the segment.

Speaker labeling is available through /v1/audio/transcriptions. It isn’t supported in Realtime transcription sessions.

Translations

To translate a completed audio recording into English, use /v1/audio/translations with whisper-1. Unlike transcription, which preserves the recording’s original language, this endpoint returns English text.

Translate audio
1
2
3
4
5
6
7
8
9
10
11
from openai import OpenAI

client = OpenAI()
audio_file = open("german.wav", "rb")

translation = client.audio.translations.create(
    model="whisper-1",
    file=audio_file,
)

print(translation.text)

For an audio recording in another language, the response contains the English translation:

Hello, my name is Wolfgang and I come from Germany. Where are you heading today?

This endpoint supports translation into English only.

Supported languages

Use languages with gpt-transcribe when you know which input languages to expect. Supported language-code formats include:

  • ISO 639-1 codes, such as en, es, and fr.
  • Selected ISO 639-3 codes, such as eng, spa, yue, and cmn.
  • Regional zh locale codes, such as zh-cn, zh-tw, and zh-hk.

The API rejects unsupported or incorrectly formatted language codes. The response also identifies any languages that the model can reliably detect.

For whisper-1, consult the Whisper language list. Whisper supports 98 languages, but accuracy varies by language. Existing models that accept one language hint use language instead of languages.

Timestamps

Use whisper-1 when you need word or segment timestamps. The timestamp_granularities[] parameter returns structured timestamp data for captioning and video editing.

Timestamp options
1
2
3
4
5
6
7
8
9
10
11
12
13
from openai import OpenAI

client = OpenAI()
audio_file = open("speech.wav", "rb")

transcription = client.audio.transcriptions.create(
    file=audio_file,
    model="whisper-1",
    response_format="verbose_json",
    timestamp_granularities=["word"],
)

print(transcription.words)

The timestamp_granularities[] parameter is only supported for whisper-1.

Longer inputs

The Transcriptions API accepts files up to 25 MB. For larger recordings, use a compressed audio format or split the file into chunks of 25 MB or less. Avoid splitting in the middle of a sentence, which can remove context and reduce accuracy.

One way to handle this is to use the PyDub open source Python package to split the audio:

1
2
3
4
5
6
7
8
9
10
from pydub import AudioSegment

song = AudioSegment.from_wav("good_morning.wav")

# PyDub handles time in milliseconds
ten_minutes = 10 * 60 * 1000

first_10_minutes = song[:ten_minutes]

first_10_minutes.export("good_morning_10.wav", format="wav")

OpenAI makes no guarantees about the usability or security of third-party software like PyDub.

Prompting

Use a prompt to improve recognition of names, acronyms, formatting, or recording-specific vocabulary. With gpt-transcribe, combine the prompt with the keywords and languages shown in Add transcription context.

Existing gpt-4o-transcribe and gpt-4o-mini-transcribe integrations also support prompting. gpt-4o-transcribe-diarize doesn’t support prompts.

Useful prompting scenarios include:

  • Correctly transcribing product names, technical terms, and acronyms.
  • Carrying context from a previous chunk of a longer recording.
  • Preserving punctuation, capitalization, and filler words.
  • Selecting a preferred writing system for a language.

For whisper-1, prompts have a 224-token limit and provide less control than the recommended transcription model. See Improving reliability if your workflow requires Whisper.

Streaming transcriptions

File transcription can stream partial text while the model processes a completed recording. This doesn’t require a Realtime session.

Streaming the transcription of a completed audio recording

Set stream=true with gpt-transcribe. The Transcriptions API returns transcript events as the model transcribes each part of the recording.

Stream transcriptions
1
2
3
4
5
6
7
8
9
10
11
12
13
from openai import OpenAI

client = OpenAI()
audio_file = open("speech.wav", "rb")

stream = client.audio.transcriptions.create(
    model="gpt-transcribe",
    file=audio_file,
    stream=True,
)

for event in stream:
    print(event)

The model emits transcript.text.delta events as it transcribes the audio, then returns the full transcript in a final transcript.text.done event. For speaker-labeled transcription with response_format="diarized_json", the diarization model also emits a transcript.text.segment event whenever it finalizes a segment.

For gpt-transcribe, the final event also includes detected languages:

1
2
3
4
5
{
  "type": "transcript.text.done",
  "text": "Bonjour, pouvez-vous m'entendre ?",
  "languages": [{ "code": "fr" }]
}

Existing gpt-4o-transcribe, gpt-4o-mini-transcribe, and gpt-4o-transcribe-diarize integrations also support file streaming. whisper-1 doesn’t.

Streaming the transcription of an ongoing audio recording

For live audio from a microphone, call, or media stream, use the Realtime transcription guide instead of the file-oriented streaming path above. It covers the current transcription-session flow and the recommended realtime path with gpt-live-transcribe.

Improving reliability

If you use whisper-1 for timestamps, subtitles, or translation, these techniques can improve recognition of uncommon words and acronyms. For new general-purpose transcription, start with gpt-transcribe and use transcription context instead.