Audio transcription
POST /v1/audio/transcriptions and /v1/audio/translations — OpenAI's Whisper API on this Mac, with text, JSON, SRT and VTT output and word timestamps.
For developers
Midium serves OpenAI's audio transcription and translation endpoints with a speech model on this Mac. Upload a file, get its text back — plain, as JSON with timestamps, or as subtitles. Install a speech model first: a Whisper model from Settings → Catalog (Audio), or midium models catalog --type speech. There's no text-to-speech endpoint (/v1/audio/speech).
Request#
curl http://127.0.0.1:9100/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@meeting.m4a" \
-F "model=whisper-1" \
-F "response_format=verbose_json" \
-F "timestamp_granularities[]=word"
The request is multipart/form-data.
Parameters#
| Name | Type | Description |
|---|---|---|
file | file | Required. .mp3, .mp4, .mpeg, .mpga, .m4a, .wav or .webm — judged by the file name's extension. Up to 25 MB. |
model | string | Required. Midium: whisper-1 means your installed Whisper model (Whisper Large v3 Turbo when it's installed, else the first speech model you have). You can also name an installed speech model. |
language | string | The spoken language as an ISO-639-1 code (en, de, …). Omit to detect it. Transcriptions only. |
prompt | string | Text to guide spelling and style, such as names and terms. |
temperature | number | Default 0. |
response_format | string | json (default), text, srt, vtt or verbose_json. |
timestamp_granularities[] | array | segment and/or word. Only with verbose_json. word adds per-word times. Transcriptions only. |
POST /v1/audio/translations takes the same form, without language and timestamp_granularities, and returns English text.
Response#
json:
{"text": "Let's start with the quarterly numbers."}
verbose_json with word timestamps:
{
"text": "Let's start with the quarterly numbers.",
"language": "en",
"segments": [
{
"id": 0,
"start": 0.0,
"end": 2.4,
"text": "Let's start with the quarterly numbers.",
"words": [
{"word": " Let's", "start": 0.0, "end": 0.32, "probability": 0.98},
{"word": " start", "start": 0.32, "end": 0.61, "probability": 0.99}
]
}
]
}
Words sit inside their segment. Without word, segments have no words. text, srt and vtt come back as plain text.
Notes#
- Speech models. Whisper models transcribe and translate. Parakeet, a transcription model Recordings can use, answers
/v1/audio/transcriptionstoo; it ignorespromptandtemperature, and it can't translate. If Parakeet is your only speech model,whisper-1resolves to it — install a Whisper model for translations. - Long files. The 25 MB limit is per request. Split longer audio, or compress it (a 25 MB
.m4aholds far more speech than a 25 MB.wav). - Audio in chat. A speech model can also be called on Chat completions with an
input_audiopart ({"type": "input_audio", "input_audio": {"data": "<base64>", "format": "wav"}}), one per message, without streaming or tools.
Errors#
| Status | code | When |
|---|---|---|
400 | invalid_audio | The extension isn't one of the supported ones, or the upload couldn't be read. |
400 | invalid_request_error | The file is over 25 MB; timestamp_granularities without verbose_json; or a granularity other than segment / word. |
400 | invalid_response_format | response_format isn't one of the five. |
404 | model_not_found | No speech model is installed. Add one from Settings → Catalog. |
500 | — | Transcription failed, or translation was asked of a Parakeet model. |
See Errors & limits.
Something here wrong or out of date? Tell us.
