跳至主要內容

/audio/transcriptions

Overview

FeatureSupportedNotes
Cost TrackingWorks with all supported models
LoggingWorks across all integrations
End-user Tracking
FallbacksWorks between supported models
LoadbalancingWorks between supported models
GuardrailsApplies to output transcribed text (non-streaming only)
Supported Providersopenai, azure, vertex_ai, gemini, deepgram, groq, fireworks_ai, ovhcloud, mistral

Quick Start

LiteLLM Python SDK

Python SDK Example
from litellm import transcription
import os

# set api keys
os.environ["OPENAI_API_KEY"] = ""
audio_file = open("/path/to/audio.mp3", "rb")

response = transcription(model="whisper", file=audio_file)

print(f"response: {response}")

LiteLLM Proxy

Add model to config

OpenAI Configuration
model_list:
- model_name: whisper
litellm_params:
model: whisper-1
api_key: os.environ/OPENAI_API_KEY
model_info:
mode: audio_transcription

general_settings:
master_key: sk-1234

Start proxy

Start Proxy Server
litellm --config /path/to/config.yaml 

# RUNNING on http://0.0.0.0:8000

Test

Test with cURL
curl --location 'http://0.0.0.0:8000/v1/audio/transcriptions' \
--header 'Authorization: Bearer sk-1234' \
--form 'file=@"/Users/krrishdholakia/Downloads/gettysburg.wav"' \
--form 'model="whisper"'

Supported Providers


Fallbacks

You can configure fallbacks for audio transcription to automatically retry with different models if the primary model fails.

Test with cURL and Fallbacks
curl --location 'http://0.0.0.0:4000/v1/audio/transcriptions' \
--header 'Authorization: Bearer sk-1234' \
--form 'file=@"gettysburg.wav"' \
--form 'model="groq/whisper-large-v3"' \
--form 'fallbacks[]="openai/whisper-1"'

Testing Fallbacks

You can test your fallback configuration using mock_testing_fallbacks=true to simulate failures:

Test Fallbacks with Mock Testing
curl --location 'http://0.0.0.0:4000/v1/audio/transcriptions' \
--header 'Authorization: Bearer sk-1234' \
--form 'file=@"gettysburg.wav"' \
--form 'model="groq/whisper-large-v3"' \
--form 'fallbacks[]="openai/whisper-1"' \
--form 'mock_testing_fallbacks=true'
🚅
LiteLLM Enterprise
SSO/SAML, audit logs, spend tracking, multi-team management, and guardrails — built for production.
Learn more →