SpyBara
Go Premium

go/resources/audio/subresources/transcriptions/index.md 2026-05-02 05:57 UTC to 2026-05-05 23:00 UTC

981 added, 0 removed.

2026
Wed 27 06:42 Fri 22 06:33 Wed 20 06:35 Tue 19 06:34 Mon 18 22:01 Mon 11 18:00 Thu 7 21:57 Tue 5 23:00 Sat 2 05:57
Data Information:
  • After 2026-05-05 06:03 UTC, this monitor no longer uses markdownified HTML/MDX. Comparisons across that boundary can therefore show more extensive diffs.

Transcriptions

Create transcription

client.Audio.Transcriptions.New(ctx, body) (*AudioTranscriptionNewResponseUnion, error)

post /audio/transcriptions

Transcribes audio into the input language.

Returns a transcription object in json, diarized_json, or verbose_json format, or a stream of transcript events.

Parameters

  • body AudioTranscriptionNewParams

    • File param.Field[Reader]

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

    • Model param.Field[AudioModel]

      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.

      • string

      • type AudioModel string

        • const AudioModelWhisper1 AudioModel = "whisper-1"

        • const AudioModelGPT4oTranscribe AudioModel = "gpt-4o-transcribe"

        • const AudioModelGPT4oMiniTranscribe AudioModel = "gpt-4o-mini-transcribe"

        • const AudioModelGPT4oMiniTranscribe2025_12_15 AudioModel = "gpt-4o-mini-transcribe-2025-12-15"

        • const AudioModelGPT4oTranscribeDiarize AudioModel = "gpt-4o-transcribe-diarize"

    • ChunkingStrategy param.Field[AudioTranscriptionNewParamsChunkingStrategyUnion]

      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.

      • Auto

        • const AutoAuto Auto = "auto"
      • AudioTranscriptionNewParamsChunkingStrategyVadConfig

        • Type string

          Must be set to server_vad to enable manual chunking using server side VAD.

          • const AudioTranscriptionNewParamsChunkingStrategyVadConfigTypeServerVad AudioTranscriptionNewParamsChunkingStrategyVadConfigType = "server_vad"
        • PrefixPaddingMs int64

          Amount of audio to include before the VAD detected speech (in milliseconds).

        • SilenceDurationMs int64

          Duration of silence to detect speech stop (in milliseconds). With shorter values the model will respond more quickly, but may jump in on short pauses from the user.

        • Threshold float64

          Sensitivity threshold (0.0 to 1.0) for voice activity detection. A higher threshold will require louder audio to activate the model, and thus might perform better in noisy environments.

    • Include param.Field[[]TranscriptionInclude]

      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.

      • const TranscriptionIncludeLogprobs TranscriptionInclude = "logprobs"
    • KnownSpeakerNames param.Field[[]string]

      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.

    • KnownSpeakerReferences param.Field[[]string]

      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.

    • Language param.Field[string]

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

    • Prompt param.Field[string]

      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.

    • ResponseFormat param.Field[AudioResponseFormat]

      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.

    • ``

    • Temperature param.Field[float64]

      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.

    • TimestampGranularities param.Field[[]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. This option is not available for gpt-4o-transcribe-diarize.

      • const AudioTranscriptionNewParamsTimestampGranularityWord AudioTranscriptionNewParamsTimestampGranularity = "word"

      • const AudioTranscriptionNewParamsTimestampGranularitySegment AudioTranscriptionNewParamsTimestampGranularity = "segment"

Returns

  • type AudioTranscriptionNewResponseUnion interface{…}

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

    • type Transcription struct{…}

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

      • Text string

        The transcribed text.

      • Logprobs []TranscriptionLogprob

        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.

        • Token string

          The token in the transcription.

        • Bytes []float64

          The bytes of the token.

        • Logprob float64

          The log probability of the token.

      • Usage TranscriptionUsageUnion

        Token usage statistics for the request.

        • type TranscriptionUsageTokens struct{…}

          Usage statistics for models billed by token usage.

          • InputTokens int64

            Number of input tokens billed for this request.

          • OutputTokens int64

            Number of output tokens generated.

          • TotalTokens int64

            Total number of tokens used (input + output).

          • Type Tokens

            The type of the usage object. Always tokens for this variant.

            • const TokensTokens Tokens = "tokens"
          • InputTokenDetails TranscriptionUsageTokensInputTokenDetails

            Details about the input tokens billed for this request.

            • AudioTokens int64

              Number of audio tokens billed for this request.

            • TextTokens int64

              Number of text tokens billed for this request.

        • type TranscriptionUsageDuration struct{…}

          Usage statistics for models billed by audio input duration.

          • Seconds float64

            Duration of the input audio in seconds.

          • Type Duration

            The type of the usage object. Always duration for this variant.

            • const DurationDuration Duration = "duration"
    • type TranscriptionVerbose struct{…}

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

      • Duration float64

        The duration of the input audio.

      • Language string

        The language of the input audio.

      • Text string

        The transcribed text.

      • Segments []TranscriptionSegment

        Segments of the transcribed text and their corresponding details.

        • ID int64

          Unique identifier of the segment.

        • AvgLogprob float64

          Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.

        • CompressionRatio float64

          Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.

        • End float64

          End time of the segment in seconds.

        • NoSpeechProb float64

          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.

        • Seek int64

          Seek offset of the segment.

        • Start float64

          Start time of the segment in seconds.

        • Temperature float64

          Temperature parameter used for generating the segment.

        • Text string

          Text content of the segment.

        • Tokens []int64

          Array of token IDs for the text content.

      • Usage TranscriptionVerboseUsage

        Usage statistics for models billed by audio input duration.

        • Seconds float64

          Duration of the input audio in seconds.

        • Type Duration

          The type of the usage object. Always duration for this variant.

          • const DurationDuration Duration = "duration"
      • Words []TranscriptionWord

        Extracted words and their corresponding timestamps.

        • End float64

          End time of the word in seconds.

        • Start float64

          Start time of the word in seconds.

        • Word string

          The text content of the word.

Example

package main

import (
  "bytes"
  "context"
  "fmt"
  "io"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  transcription, err := client.Audio.Transcriptions.New(context.TODO(), openai.AudioTranscriptionNewParams{
    File: io.Reader(bytes.NewBuffer([]byte("Example data"))),
    Model: openai.AudioModelGPT4oTranscribe,
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", transcription)
}

Response

{
  "text": "text",
  "logprobs": [
    {
      "token": "token",
      "bytes": [
        0
      ],
      "logprob": 0
    }
  ],
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "total_tokens": 0,
    "type": "tokens",
    "input_token_details": {
      "audio_tokens": 0,
      "text_tokens": 0
    }
  }
}

Domain Types

Transcription

  • type Transcription struct{…}

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

    • Text string

      The transcribed text.

    • Logprobs []TranscriptionLogprob

      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.

      • Token string

        The token in the transcription.

      • Bytes []float64

        The bytes of the token.

      • Logprob float64

        The log probability of the token.

    • Usage TranscriptionUsageUnion

      Token usage statistics for the request.

      • type TranscriptionUsageTokens struct{…}

        Usage statistics for models billed by token usage.

        • InputTokens int64

          Number of input tokens billed for this request.

        • OutputTokens int64

          Number of output tokens generated.

        • TotalTokens int64

          Total number of tokens used (input + output).

        • Type Tokens

          The type of the usage object. Always tokens for this variant.

          • const TokensTokens Tokens = "tokens"
        • InputTokenDetails TranscriptionUsageTokensInputTokenDetails

          Details about the input tokens billed for this request.

          • AudioTokens int64

            Number of audio tokens billed for this request.

          • TextTokens int64

            Number of text tokens billed for this request.

      • type TranscriptionUsageDuration struct{…}

        Usage statistics for models billed by audio input duration.

        • Seconds float64

          Duration of the input audio in seconds.

        • Type Duration

          The type of the usage object. Always duration for this variant.

          • const DurationDuration Duration = "duration"

Transcription Diarized

  • type TranscriptionDiarized struct{…}

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

    • Duration float64

      Duration of the input audio in seconds.

    • Segments []TranscriptionDiarizedSegment

      Segments of the transcript annotated with timestamps and speaker labels.

      • ID string

        Unique identifier for the segment.

      • End float64

        End timestamp of the segment in seconds.

      • Speaker string

        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, ...).

      • Start float64

        Start timestamp of the segment in seconds.

      • Text string

        Transcript text for this segment.

      • Type TranscriptTextSegment

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

        • const TranscriptTextSegmentTranscriptTextSegment TranscriptTextSegment = "transcript.text.segment"
    • Task Transcribe

      The type of task that was run. Always transcribe.

      • const TranscribeTranscribe Transcribe = "transcribe"
    • Text string

      The concatenated transcript text for the entire audio input.

    • Usage TranscriptionDiarizedUsageUnion

      Token or duration usage statistics for the request.

      • TranscriptionDiarizedUsageTokens

        • InputTokens int64

          Number of input tokens billed for this request.

        • OutputTokens int64

          Number of output tokens generated.

        • TotalTokens int64

          Total number of tokens used (input + output).

        • Type Tokens

          The type of the usage object. Always tokens for this variant.

          • const TokensTokens Tokens = "tokens"
        • InputTokenDetails TranscriptionDiarizedUsageTokensInputTokenDetails

          Details about the input tokens billed for this request.

          • AudioTokens int64

            Number of audio tokens billed for this request.

          • TextTokens int64

            Number of text tokens billed for this request.

      • TranscriptionDiarizedUsageDuration

        • Seconds float64

          Duration of the input audio in seconds.

        • Type Duration

          The type of the usage object. Always duration for this variant.

          • const DurationDuration Duration = "duration"

Transcription Diarized Segment

  • type TranscriptionDiarizedSegment struct{…}

    A segment of diarized transcript text with speaker metadata.

    • ID string

      Unique identifier for the segment.

    • End float64

      End timestamp of the segment in seconds.

    • Speaker string

      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, ...).

    • Start float64

      Start timestamp of the segment in seconds.

    • Text string

      Transcript text for this segment.

    • Type TranscriptTextSegment

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

      • const TranscriptTextSegmentTranscriptTextSegment TranscriptTextSegment = "transcript.text.segment"

Transcription Include

  • type TranscriptionInclude string

    • const TranscriptionIncludeLogprobs TranscriptionInclude = "logprobs"

Transcription Segment

  • type TranscriptionSegment struct{…}

    • ID int64

      Unique identifier of the segment.

    • AvgLogprob float64

      Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.

    • CompressionRatio float64

      Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.

    • End float64

      End time of the segment in seconds.

    • NoSpeechProb float64

      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.

    • Seek int64

      Seek offset of the segment.

    • Start float64

      Start time of the segment in seconds.

    • Temperature float64

      Temperature parameter used for generating the segment.

    • Text string

      Text content of the segment.

    • Tokens []int64

      Array of token IDs for the text content.

Transcription Stream Event

  • type TranscriptionStreamEventUnion interface{…}

    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.

    • type TranscriptionTextSegmentEvent struct{…}

      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.

      • ID string

        Unique identifier for the segment.

      • End float64

        End timestamp of the segment in seconds.

      • Speaker string

        Speaker label for this segment.

      • Start float64

        Start timestamp of the segment in seconds.

      • Text string

        Transcript text for this segment.

      • Type TranscriptTextSegment

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

        • const TranscriptTextSegmentTranscriptTextSegment TranscriptTextSegment = "transcript.text.segment"
    • type TranscriptionTextDeltaEvent struct{…}

      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.

      • Delta string

        The text delta that was additionally transcribed.

      • Type TranscriptTextDelta

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

        • const TranscriptTextDeltaTranscriptTextDelta TranscriptTextDelta = "transcript.text.delta"
      • Logprobs []TranscriptionTextDeltaEventLogprob

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

        • Token string

          The token that was used to generate the log probability.

        • Bytes []int64

          The bytes that were used to generate the log probability.

        • Logprob float64

          The log probability of the token.

      • SegmentID string

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

    • type TranscriptionTextDoneEvent struct{…}

      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.

      • Text string

        The text that was transcribed.

      • Type TranscriptTextDone

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

        • const TranscriptTextDoneTranscriptTextDone TranscriptTextDone = "transcript.text.done"
      • Logprobs []TranscriptionTextDoneEventLogprob

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

        • Token string

          The token that was used to generate the log probability.

        • Bytes []int64

          The bytes that were used to generate the log probability.

        • Logprob float64

          The log probability of the token.

      • Usage TranscriptionTextDoneEventUsage

        Usage statistics for models billed by token usage.

        • InputTokens int64

          Number of input tokens billed for this request.

        • OutputTokens int64

          Number of output tokens generated.

        • TotalTokens int64

          Total number of tokens used (input + output).

        • Type Tokens

          The type of the usage object. Always tokens for this variant.

          • const TokensTokens Tokens = "tokens"
        • InputTokenDetails TranscriptionTextDoneEventUsageInputTokenDetails

          Details about the input tokens billed for this request.

          • AudioTokens int64

            Number of audio tokens billed for this request.

          • TextTokens int64

            Number of text tokens billed for this request.

Transcription Text Delta Event

  • type TranscriptionTextDeltaEvent struct{…}

    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.

    • Delta string

      The text delta that was additionally transcribed.

    • Type TranscriptTextDelta

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

      • const TranscriptTextDeltaTranscriptTextDelta TranscriptTextDelta = "transcript.text.delta"
    • Logprobs []TranscriptionTextDeltaEventLogprob

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

      • Token string

        The token that was used to generate the log probability.

      • Bytes []int64

        The bytes that were used to generate the log probability.

      • Logprob float64

        The log probability of the token.

    • SegmentID string

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

Transcription Text Done Event

  • type TranscriptionTextDoneEvent struct{…}

    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.

    • Text string

      The text that was transcribed.

    • Type TranscriptTextDone

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

      • const TranscriptTextDoneTranscriptTextDone TranscriptTextDone = "transcript.text.done"
    • Logprobs []TranscriptionTextDoneEventLogprob

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

      • Token string

        The token that was used to generate the log probability.

      • Bytes []int64

        The bytes that were used to generate the log probability.

      • Logprob float64

        The log probability of the token.

    • Usage TranscriptionTextDoneEventUsage

      Usage statistics for models billed by token usage.

      • InputTokens int64

        Number of input tokens billed for this request.

      • OutputTokens int64

        Number of output tokens generated.

      • TotalTokens int64

        Total number of tokens used (input + output).

      • Type Tokens

        The type of the usage object. Always tokens for this variant.

        • const TokensTokens Tokens = "tokens"
      • InputTokenDetails TranscriptionTextDoneEventUsageInputTokenDetails

        Details about the input tokens billed for this request.

        • AudioTokens int64

          Number of audio tokens billed for this request.

        • TextTokens int64

          Number of text tokens billed for this request.

Transcription Text Segment Event

  • type TranscriptionTextSegmentEvent struct{…}

    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.

    • ID string

      Unique identifier for the segment.

    • End float64

      End timestamp of the segment in seconds.

    • Speaker string

      Speaker label for this segment.

    • Start float64

      Start timestamp of the segment in seconds.

    • Text string

      Transcript text for this segment.

    • Type TranscriptTextSegment

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

      • const TranscriptTextSegmentTranscriptTextSegment TranscriptTextSegment = "transcript.text.segment"

Transcription Verbose

  • type TranscriptionVerbose struct{…}

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

    • Duration float64

      The duration of the input audio.

    • Language string

      The language of the input audio.

    • Text string

      The transcribed text.

    • Segments []TranscriptionSegment

      Segments of the transcribed text and their corresponding details.

      • ID int64

        Unique identifier of the segment.

      • AvgLogprob float64

        Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.

      • CompressionRatio float64

        Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.

      • End float64

        End time of the segment in seconds.

      • NoSpeechProb float64

        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.

      • Seek int64

        Seek offset of the segment.

      • Start float64

        Start time of the segment in seconds.

      • Temperature float64

        Temperature parameter used for generating the segment.

      • Text string

        Text content of the segment.

      • Tokens []int64

        Array of token IDs for the text content.

    • Usage TranscriptionVerboseUsage

      Usage statistics for models billed by audio input duration.

      • Seconds float64

        Duration of the input audio in seconds.

      • Type Duration

        The type of the usage object. Always duration for this variant.

        • const DurationDuration Duration = "duration"
    • Words []TranscriptionWord

      Extracted words and their corresponding timestamps.

      • End float64

        End time of the word in seconds.

      • Start float64

        Start time of the word in seconds.

      • Word string

        The text content of the word.

Transcription Word

  • type TranscriptionWord struct{…}

    • End float64

      End time of the word in seconds.

    • Start float64

      Start time of the word in seconds.

    • Word string

      The text content of the word.