AUDIO INPUT

Whisper speech to text API

Upload audio as multipart/form-data to transcribe it in the original language, translate it to English, or request word timestamps.

$0.006 / audio minute25 MB maximumNo streaming

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 · JSON transcription
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"
Python · multipart upload
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"])
Node.js · FormData
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 · word timestamps
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 · translate to English
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

FieldRequirementNotes
fileRequiredUp to 25 MB; mp3, mp4, mpeg, mpga, m4a, wav, webm
modelRequiredwhisper-1
languageOptionalISO-639-1 input language; improves speed and accuracy
promptOptionalGuides spelling or continuation; first 224 tokens are used
response_formatOptionaljson, text, srt, verbose_json, vtt
temperatureOptional0 to 1; default 0
timestamp_granularities[]Optionalword 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

SymptomFix
415 or invalid JSONSend multipart fields with -F, not JSON
File too largeCompress or split it below 25 MB
No timestampsUse verbose_json and request a timestamp granularity
Translation returns EnglishThis is expected for /translations; use /transcriptions to keep the source language