Audio (speech-to-text)
AI Foundation Services provides Whisper-based audio models for transcription and translation, compatible with the OpenAI Audio API.
What you’ll learn:
- How to transcribe audio to text in the original language
- How to translate audio from any language to English
- Available audio models and parameters
List audio models
Section titled “List audio models”The audio models are whisper- and whisper-. To see which of them your key can use, list the models and look for whisper in the ID:
from openai import OpenAI
client = OpenAI()
models = client.models.list() for model in models.data: if "whisper" in model.id: print(model.id) curl "$OPENAI_BASE_URL /models" \ -H "Authorization: Bearer $OPENAI_API_KEY "# Audio models have "whisper" in their ID:# whisper-large-v3, whisper-large-v3-turbo Audio transcription
Section titled “Audio transcription”The transcription API converts audio into text in the same language as the input. It auto-detects the language from the first 30 seconds if language is not specified.
from openai import OpenAI
client = OpenAI()
with open( "/path/to/audio_file.mp3" , "rb") as audio_file: transcription = client.audio.transcriptions.create( model="whisper-large-v3" , file=audio_file, # language="en" # Optional: specify language )
print( f"Transcription: {transcription.text }" )curl -X POST "$OPENAI_BASE_URL /audio/transcriptions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -F "model=whisper-large-v3" \ -F "language=en" \ -F "temperature=0.0" \ -F "file=@/path/to/audio_file.mp3" Example output:
Transcription: The stale smell of old beer lingers. It takes heat to bring out the odor.A cold dip restores health and zest. A salt pickle tastes fine with ham.Audio translation
Section titled “Audio translation”The translation API translates audio from any language into English.
from openai import OpenAI
client = OpenAI()
with open( "/path/to/audio_file.mp3" , "rb") as audio_file: translation = client.audio.translations.create( model="whisper-large-v3" , file=audio_file, temperature=1.0 , )
print( f"Translation: {translation.text }" )curl -X POST "$OPENAI_BASE_URL /audio/translations" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -F "model=whisper-large-v3" \ -F "temperature=1.0" \ -F "file=@/path/to/audio_file.mp3" Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
model | string | Audio model ID (e.g., whisper-) |
file | file | The audio file to process |
language | string | Optional. ISO language code. Auto-detected if omitted. |
temperature | float | 0. for deterministic, higher for more varied output |
Key features
Section titled “Key features”- Auto Language Detection — Identifies input language from the first 30 seconds
- Customizable Output — Adjust behavior with
languageandtemperatureparameters - Efficient Processing — Low latency for both transcription and translation
Limitations and troubleshooting
Section titled “Limitations and troubleshooting”The endpoint takes model, file, language, and temperature. Language detection uses the first 30 seconds of the audio.
Next steps
Section titled “Next steps”- Chat completions — Process transcribed text with LLMs
- Queued requests — Wait for rate-limit budget instead of getting a 429
- API endpoints — Full endpoint reference