OpenAI Whisper Guide 2025: Speech-to-Text Setup & API
A practical guide for developers wanting audio transcription — Whisper model sizes, local Python setup, the cloud API, WhisperX for diarization, faster-whisper for production, and how Whisper compares to paid alternatives.
What Is Whisper?
OpenAI Whisper is an open-source automatic speech recognition (ASR) model released in September 2022. It was trained on 680,000 hours of multilingual and multitask supervised data collected from the web, giving it remarkable robustness to accents, background noise, and technical language.
Key capabilities: transcription (speech to text), translation (non-English audio directly to English text), and language identification. It supports 99 languages out of the box. The model is Apache 2.0 licensed — you can run it locally for free, deploy it commercially, and modify it.
Model Sizes: Speed vs Accuracy
| Model | Size | VRAM | Speed (GPU) | Best for |
|---|---|---|---|---|
| tiny | 75 MB | ~1 GB | ~32x realtime | Edge, short clips, fast demos |
| base | 145 MB | ~1 GB | ~16x realtime | Good default for English |
| small | 465 MB | ~2 GB | ~6x realtime | Recommended starting point |
| medium | 1.5 GB | ~5 GB | ~2x realtime | Strong accuracy, multilingual |
| large-v3 | 3 GB | ~10 GB | ~1x realtime | Best accuracy, production |
On CPU (no GPU), multiply GPU times by approximately 4-8x. For MacBook M-series, Whisper uses Metal acceleration and performs roughly at GPU tier speeds. large-v3 is consistently the most accurate — use smaller models only when speed or memory is constrained.
Local Setup: Python & CLI
# Install (requires Python 3.8+)
pip install openai-whisper # Also install ffmpeg for audio format support: # macOS: brew install ffmpeg # Ubuntu: sudo apt install ffmpeg # Windows: download from ffmpeg.org
# CLI usage
# Transcribe an audio file (downloads model on first run) whisper audio.mp3 --model base # Transcribe to specific formats whisper audio.mp3 --model small --output_format srt --output_dir ./subtitles # Translate non-English audio to English whisper french_audio.mp3 --model medium --task translate # Force language (skip detection, faster) whisper audio.mp3 --model small --language en
# Python API
import whisper
# Load model (cached to ~/.cache/whisper after first download)
model = whisper.load_model("base")
# Transcribe
result = model.transcribe("audio.mp3")
print(result["text"])
# With segments (word-level timing via large model)
result = model.transcribe("audio.mp3", word_timestamps=True)
for segment in result["segments"]:
print(f"[{segment['start']:.1f}s - {segment['end']:.1f}s] {segment['text']}")
# Detect language first
audio = whisper.load_audio("audio.mp3")
audio = whisper.pad_or_trim(audio)
mel = whisper.log_mel_spectrogram(audio).to(model.device)
_, probs = model.detect_language(mel)
print(f"Detected language: {max(probs, key=probs.get)}") Whisper API (Cloud Endpoint)
Don't want to run Whisper locally? OpenAI provides a managed API endpoint at $0.006/minute (~$0.36/hour). No GPU required — you just send the audio file:
# Python (openai SDK)
from openai import OpenAI
client = OpenAI() # uses OPENAI_API_KEY env var
# Transcription
with open("audio.mp3", "rb") as audio_file:
transcription = client.audio.transcriptions.create(
model="whisper-1",
file=audio_file,
response_format="verbose_json", # includes timestamps
language="en" # optional, skip for auto-detection
)
print(transcription.text)
# Translation (any language → English)
with open("japanese_meeting.mp3", "rb") as audio_file:
translation = client.audio.translations.create(
model="whisper-1",
file=audio_file
)
print(translation.text) # curl
curl https://api.openai.com/v1/audio/transcriptions \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -F model="whisper-1" \ -F file="@audio.mp3" \ -F response_format="json"
File size limit: 25MB. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm. For longer recordings, split audio into chunks under 25MB.
WhisperX: Word Timestamps & Speaker Diarization
WhisperX extends Whisper with precise word-level timestamps and speaker diarization (who said what):
pip install whisperx
import whisperx
# Transcribe with word-level alignment
model = whisperx.load_model("large-v3", device="cuda", compute_type="float16")
audio = whisperx.load_audio("meeting.mp3")
result = model.transcribe(audio, batch_size=16)
# Align to get word timestamps
model_a, metadata = whisperx.load_align_model(language_code="en", device="cuda")
result = whisperx.align(result["segments"], model_a, metadata, audio, device="cuda")
# Diarize (requires HuggingFace token for pyannote)
diarize_model = whisperx.DiarizationPipeline(use_auth_token="hf_...", device="cuda")
diarize_segments = diarize_model(audio)
result = whisperx.assign_word_speakers(diarize_segments, result)
for segment in result["segments"]:
speaker = segment.get("speaker", "UNKNOWN")
print(f"[{speaker}] {segment['text']}") faster-whisper: Production-Grade Local Inference
faster-whisper uses CTranslate2 to run Whisper 2-4x faster with less memory — the best choice for production deployments:
pip install faster-whisper
from faster_whisper import WhisperModel
# Load with int8 quantization (less memory, similar accuracy)
model = WhisperModel("large-v3", device="cuda", compute_type="int8_float16")
# Transcribe
segments, info = model.transcribe("audio.mp3", beam_size=5)
print(f"Detected language: {info.language} (probability: {info.language_probability:.2f})")
for segment in segments:
print(f"[{segment.start:.2f}s - {segment.end:.2f}s] {segment.text}")
For CPU-only deployment, use device="cpu", compute_type="int8" — this reduces large-v3 RAM to ~3GB and gives ~2x speedup over original Whisper on CPU.
Whisper vs Paid STT Services
| Service | Price | Accuracy | Real-time | Best for |
|---|---|---|---|---|
| Whisper (local) | Free | ⭐⭐⭐⭐⭐ | Via streaming workaround | Cost savings, privacy, offline |
| Whisper API | $0.006/min | ⭐⭐⭐⭐⭐ | ❌ Batch only | Easiest setup, no GPU |
| AssemblyAI | $0.0045-$0.011/min | ⭐⭐⭐⭐⭐ | ✅ Yes | LeMUR AI summarization |
| Deepgram Nova-3 | $0.0043/min | ⭐⭐⭐⭐⭐ | ✅ Yes, ultra-low latency | Real-time voice apps |
| Google STT | $0.006/min | ⭐⭐⭐⭐ | ✅ Yes | GCP ecosystem integration |
Choose Whisper (local) if you need free unlimited transcription, data privacy, or offline use. Choose Deepgram or AssemblyAI if you need real-time streaming transcription — Whisper's batch-only design makes true real-time difficult without chunking hacks.
Hardware Requirements
- tiny / base — any modern CPU or GPU with 1GB+ VRAM. Runs on a Raspberry Pi (slowly).
- small — 2GB+ VRAM. Works well on GTX 1060 / RTX 3050. MacBook M1 with Metal.
- medium — 5GB+ VRAM. GTX 1080 / RTX 3060 12GB. Fast on M2 Pro.
- large-v3 — 10GB+ VRAM. RTX 3080/3090, A10G, A100. Required for best accuracy.
For CPU-only servers: faster-whisper with int8 quantization reduces large-v3 memory to ~3GB RAM. Transcription speed will be 4-8x slower than realtime on modern CPUs (1 minute of audio = 4-8 minutes processing).
Monitor OpenAI API Status
If you're using the Whisper API endpoint, you depend on OpenAI's uptime. Prismix tracks OpenAI API availability in real-time and sends instant alerts when transcription endpoints go down.
Monitor OpenAI & AssemblyAI Free →