The System One EventUtahGo To Event Page →

Docs

Set up Midium, use every part of it, run it for your team, and build on it.

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#

NameTypeDescription
filefileRequired. .mp3, .mp4, .mpeg, .mpga, .m4a, .wav or .webm — judged by the file name's extension. Up to 25 MB.
modelstringRequired. 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.
languagestringThe spoken language as an ISO-639-1 code (en, de, …). Omit to detect it. Transcriptions only.
promptstringText to guide spelling and style, such as names and terms.
temperaturenumberDefault 0.
response_formatstringjson (default), text, srt, vtt or verbose_json.
timestamp_granularities[]arraysegment 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:

JSON
{"text": "Let's start with the quarterly numbers."}

verbose_json with word timestamps:

JSON
{
  "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/transcriptions too; it ignores prompt and temperature, and it can't translate. If Parakeet is your only speech model, whisper-1 resolves 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 .m4a holds far more speech than a 25 MB .wav).
  • Audio in chat. A speech model can also be called on Chat completions with an input_audio part ({"type": "input_audio", "input_audio": {"data": "<base64>", "format": "wav"}}), one per message, without streaming or tools.

Errors#

StatuscodeWhen
400invalid_audioThe extension isn't one of the supported ones, or the upload couldn't be read.
400invalid_request_errorThe file is over 25 MB; timestamp_granularities without verbose_json; or a granularity other than segment / word.
400invalid_response_formatresponse_format isn't one of the five.
404model_not_foundNo 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.