| page_title | openai_audio_transcription Resource - terraform-provider-openai |
|---|---|
| subcategory | |
| description | Creates an audio transcription. Note: This resource does not support updates - any configuration change will create a new resource. |
Creates an audio transcription. Note: This resource does not support updates - any configuration change will create a new resource.
resource "openai_audio_transcription" "example" {
file = "./speech.mp3"
model = "whisper-1"
# Optional parameters
language = "en"
prompt = "This is a transcription of a meeting"
response_format = "json"
temperature = 0
}
# Example with verbose output
resource "openai_audio_transcription" "verbose_example" {
file = "./speech.mp3"
model = "whisper-1"
response_format = "verbose_json"
temperature = 0.2
# Get word-level timestamps (only works with verbose_json)
timestamp_granularities = ["word", "segment"]
}
output "transcription_text" {
value = openai_audio_transcription.example.text
}file(String) Path to the audio file to transcribe.model(String) ID of the model to use (e.g., 'whisper-1', 'gpt-4o-transcribe').
include(List of String) Additional information to include (e.g. 'logprobs').language(String) The language of the input audio (ISO-639-1 format).prompt(String) An optional text to guide the model's style or continue a previous audio segment.response_format(String) The format of the transcript output (e.g. json, text, srt).temperature(Number) The sampling temperature, between 0 and 1.
duration(Number) Duration of the audio in seconds.id(String) The identifier of the transcription (randomly generated).segments(List of Object) Segments of the transcription. (see below for nested schema)text(String) The transcribed text.
Read-Only:
end(Number)id(Number)start(Number)text(String)
Import is supported using the following syntax:
The terraform import command can be used, for example:
#!/bin/bash
# Audio transcription resources cannot be imported
echo "Audio transcription is a one-time operation, not a persistent resource."
echo "It cannot be imported because there's no state to track in OpenAI."
echo ""
echo "To use audio transcription:"
echo "1. Create a resource configuration (see resource.tf)"
echo "2. Run 'terraform apply' to perform the transcription"