Build with the API

Transcribe speech to text

POST /v1/audio/transcriptions turns a recording into text, with a model whose capabilities include transcription in the model list. It is the route behind voice input.

curl https://sven.swedishembedded.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $SVEN_API_KEY" \
  -F "file=@recording.wav" \
  -F "model=MODEL_ID" \
  -F "language=en"

Parameters#

  • file is the recording, as a multipart upload. WAV, Ogg with Opus and WebM with Opus are accepted, up to 300 seconds and 8 MiB. Anything else is refused with a 400 that lists what is accepted.
  • model is required.
  • language is the spoken language as an ISO-639-1 code such as en or sv. Leave it out and the language is detected.
  • response_format can only be json.

You can also send JSON instead of a form, with the recording in base64 as input_audio ({"data": "...", "format": "wav"}, where format is wav, ogg or webm). The reference describes both.

The response#

json
{ "text": "Hello and welcome.", "usage": { "type": "duration", "seconds": 3 } }

What it costs#

You are charged by the second of audio transcribed, never more than the model's price per minute. See How calls are charged.

Limits#

Each recording is transcribed on its own: streaming recognition over a single connection is not available. To transcribe longer audio, split it into pieces under five minutes.