Transcribe an audio file
The file field is binary data, so do not send a JSON body. The model returns {"text":"..."} when response_format=json.
curl https://api-models.com/v1/audio/transcriptions \
-H "Authorization: Bearer $API_MODELS_KEY" \
-F "file=@./meeting.mp3" \
-F "model=whisper-1" \
-F "response_format=json" \
-F "language=en"import os
import requests
with open("meeting.mp3", "rb") as audio:
response = requests.post(
"https://api-models.com/v1/audio/transcriptions",
headers={"Authorization": f"Bearer {os.environ['API_MODELS_KEY']}"},
files={"file": ("meeting.mp3", audio, "audio/mpeg")},
data={"model": "whisper-1", "response_format": "json"},
timeout=180,
)
response.raise_for_status()
print(response.json()["text"])import { openAsBlob } from "node:fs";
const form = new FormData();
form.set("file", await openAsBlob("meeting.mp3"), "meeting.mp3");
form.set("model", "whisper-1");
form.set("response_format", "json");
const response = await fetch(
"https://api-models.com/v1/audio/transcriptions",
{ method: "POST", headers: { Authorization: `Bearer ${process.env.API_MODELS_KEY}` }, body: form },
);
if (!response.ok) throw new Error(await response.text());
console.log((await response.json()).text);Request word timestamps
Set response_format=verbose_json and add timestamp_granularities[]=word. Timestamp granularities are not available with the other response formats.
curl https://api-models.com/v1/audio/transcriptions \
-H "Authorization: Bearer $API_MODELS_KEY" \
-F "file=@./meeting.mp3" \
-F "model=whisper-1" \
-F "response_format=verbose_json" \
-F "timestamp_granularities[]=word"Translate audio to English
The translations endpoint transcribes speech and returns English text. It is separate from the transcription endpoint.
curl https://api-models.com/v1/audio/translations \
-H "Authorization: Bearer $API_MODELS_KEY" \
-F "file=@./french.m4a" \
-F "model=whisper-1" \
-F "response_format=json"Supported files, formats and parameters
| Field | Requirement | Notes |
|---|---|---|
file | Required | Up to 25 MB; mp3, mp4, mpeg, mpga, m4a, wav, webm |
model | Required | whisper-1 |
language | Optional | ISO-639-1 input language; improves speed and accuracy |
prompt | Optional | Guides spelling or continuation; first 224 tokens are used |
response_format | Optional | json, text, srt, verbose_json, vtt |
temperature | Optional | 0 to 1; default 0 |
timestamp_granularities[] | Optional | word or segment; requires verbose_json |
whisper-1 does not support streamed transcription. Split files larger than 25 MB and avoid cutting in the middle of a sentence.
Common errors
| Symptom | Fix |
|---|---|
| 415 or invalid JSON | Send multipart fields with -F, not JSON |
| File too large | Compress or split it below 25 MB |
| No timestamps | Use verbose_json and request a timestamp granularity |
| Translation returns English | This is expected for /translations; use /transcriptions to keep the source language |