Audio transcription

Last updated:

On this page
text
POST https://api.staik.se/v1/audio/transcriptions

Transcribe audio to text with KB-Whisper large — the Swedish National Library's Swedish-trained Whisper model (50,000 hours of Swedish speech). OpenAI-compatible: point the openai SDK at api.staik.se and it just works. The model name whisper-1 also routes here.

python
from openai import OpenAI

client = OpenAI(api_key="sk-st-your-key", base_url="https://api.staik.se/v1")

with open("meeting.mp3", "rb") as f:
    result = client.audio.transcriptions.create(
        model="kb-whisper-large",
        file=f,
        language="sv",
    )
print(result.text)

Supported formats: mp3, wav, m4a, ogg, webm, mp4. Max file size: 100 MB. response_format: json (default), text, srt, vtt, or verbose_json (with segments).

Long files — async job

The synchronous call suits files up to ~20 minutes. For longer recordings, use the job API: upload, get a job_id immediately, poll until done. The gateway chunks the audio, transcribes, and stitches the result — no timeouts, and speakers stay consistent across the whole file.

bash
# 1. Upload → responds immediately with a job_id (status "queued")
curl https://api.staik.se/v1/audio/transcriptions/jobs \
  -H "Authorization: Bearer sk-st-your-key" \
  -F file=@long-meeting.m4a \
  -F model=kb-whisper-large \
  -F language=sv \
  -F diarize=true

# → {"id":"390cc2dc-...","status":"queued","progress":0, ...}

# 2. Poll until status = "completed" (progress 0–100 in the meantime)
curl https://api.staik.se/v1/audio/transcriptions/jobs/390cc2dc-... \
  -H "Authorization: Bearer sk-st-your-key"

# → {"status":"completed","progress":100,"audio_duration_seconds":4769,
#    "tokens_charged":79483,"result":{"text":"...","segments":[...]}}

Status flows queued → processing → completed (or failed/cancelled). result is included only once the job completes, formatted per response_format. List jobs with GET /v1/audio/transcriptions/jobs, cancel with DELETE /v1/audio/transcriptions/jobs/{id}. Billing happens on completion, by actual audio length.

Speaker diarization

diarize=true adds speaker labels to the segments. Speakers stay consistent even when long files are chunked internally.

Token consumption

Transcription is billed at 2,500 tokens per minute of audio (≈42/second) from the same token pool as the chat models — 1 hour of audio costs 150,000 tokens. See what your plan translates to under Plans and quotas.

Every synchronous response includes the headers X-Audio-Duration-Seconds and X-Audio-Tokens-Charged; for async jobs the same info is in the job's audio_duration_seconds/tokens_charged.