Skip to content
Primary navigation

Audio

AudioTranscriptions

Turn audio into text or text into audio.

resource openai_audio_transcription

required Expand Collapse
file: String

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: String

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.

optional Expand Collapse
language?: 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?: 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.

stream?: Bool

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.

include?: List[String]

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.

known_speaker_names?: List[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.

known_speaker_references?: List[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.

chunking_strategy?: String

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.

response_format?: String

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?: 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.

timestamp_granularities?: List[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.

computed Expand Collapse
duration: Float64

Duration of the input audio in seconds.

task: String

The type of task that was run. Always transcribe.

text: String

The transcribed text.

logprobs: List[Attributes]

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: List[Float64]

The bytes of the token.

logprob: Float64

The log probability of the token.

segments: List[Attributes]

Segments of the transcript annotated with timestamps and speaker labels.

id: Dynamic String | Int64

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: String

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

avg_logprob: Float64

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

compression_ratio: Float64

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

no_speech_prob: 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.

temperature: Float64

Temperature parameter used for generating the segment.

tokens: List[Int64]

Array of token IDs for the text content.

usage: Attributes

Token usage statistics for the request.

input_tokens: Int64

Number of input tokens billed for this request.

output_tokens: Int64

Number of output tokens generated.

total_tokens: Int64

Total number of tokens used (input + output).

type: String

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

input_token_details: Attributes

Details about the input tokens billed for this request.

audio_tokens: Int64

Number of audio tokens billed for this request.

text_tokens: Int64

Number of text tokens billed for this request.

seconds: Float64

Duration of the input audio in seconds.

words: List[Attributes]

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.

openai_audio_transcription

resource "openai_audio_transcription" "example_audio_transcription" {
  file = "Example data"
  model = "gpt-4o-transcribe"
  chunking_strategy = "auto"
  include = ["logprobs"]
  known_speaker_names = ["string"]
  known_speaker_references = ["string"]
  language = "language"
  prompt = "prompt"
  response_format = "json"
  stream = false
  temperature = 0
  timestamp_granularities = ["word"]
}

AudioTranslations

Turn audio into text or text into audio.

resource openai_audio_translation

required Expand Collapse
file: String

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

model: String

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

optional Expand Collapse
prompt?: String

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

response_format?: String

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

temperature?: 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.

computed Expand Collapse
duration: Float64

The duration of the input audio.

language: String

The language of the output translation (always english).

text: String
segments: List[Attributes]

Segments of the translated text and their corresponding details.

id: Int64

Unique identifier of the segment.

avg_logprob: Float64

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

compression_ratio: 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.

no_speech_prob: 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: List[Int64]

Array of token IDs for the text content.

openai_audio_translation

resource "openai_audio_translation" "example_audio_translation" {
  file = "Example data"
  model = "whisper-1"
  prompt = "prompt"
  response_format = "json"
  temperature = 0
}

AudioSpeech

Turn audio into text or text into audio.

resource openai_audio_speech

required Expand Collapse
input: String

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

model: String

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

voice: String

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.

optional Expand Collapse
instructions?: String

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

response_format?: String

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

speed?: Float64

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

stream_format?: String

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

openai_audio_speech

resource "openai_audio_speech" "example_audio_speech" {
  input = "input"
  model = "string"
  voice = "string"
  instructions = "instructions"
  response_format = "mp3"
  speed = 0.25
  stream_format = "sse"
}

AudioVoices

Turn audio into text or text into audio.

resource openai_audio_voice

required Expand Collapse
audio_sample: String

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.

name: String

The name of the new voice.

computed Expand Collapse
id: String

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

created_at: Int64

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

object: String

The object type, which is always audio.voice.

AudioVoice Consents

Turn audio into text or text into audio.

resource openai_audio_voice_consent

required Expand Collapse
language: String

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

recording: String

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.

name: String

The label to use for this consent recording.

computed Expand Collapse
id: String

The consent recording identifier.

created_at: Int64

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

object: String

The object type, which is always audio.voice_consent.

data openai_audio_voice_consent

required Expand Collapse
computed Expand Collapse
id: String
created_at: Int64

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

language: String

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

name: String

The label provided when the consent recording was uploaded.

object: String

The object type, which is always audio.voice_consent.

data openai_audio_voice_consents

optional Expand Collapse
max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
items: List[Attributes]

The items returned by the data source

id: String

The consent recording identifier.

created_at: Int64

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

language: String

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

name: String

The label provided when the consent recording was uploaded.

object: String

The object type, which is always audio.voice_consent.