Go-based transcription API. Drop-in compatible with the existing Python
service (POST /transcription/job, GET /transcription/job/{id}), with
an adapter system that lets you swap the underlying ASR backend
(whisper.cpp, stub, ...) per request via an additive model field.
Two modes:
Development — Go API + Nuxt dev server with hot reload.
make dev # both at once; Ctrl-C stops both
# or in separate terminals:
make dev-api # Go on :8888
make dev-frontend # Nuxt on :3000 (proxies API calls)Single-binary — SPA embedded in the Go binary, both served from :8888.
make build # pnpm generate → internal/web/dist → go build
./transcriberBoth default to the stub adapter so they work without any ASR backend
installed. internal/web/dist/ must be populated before the Go side will
compile (the //go:embed directive needs at least one file) — run
make frontend once after cloning, then go run ./cmd/transcriber works
on its own for API-only iteration.
The real adapters (whisper-cpp-large-v3, nb-whisper-large,
nb-whisper-medium) require
whisper-cli (whisper.cpp), ffmpeg, and ffprobe on $PATH:
the chunked wrapper uses ffprobe to read the input duration and ffmpeg
to extract each chunk to a 16kHz mono wav. Model files are downloaded
from Hugging Face on first use and cached on disk. The stub adapter
has no external dependencies.
On macOS, brew install whisper-cpp ffmpeg covers all three, and brew's
whisper-cli is Metal-accelerated — so a native run is both the fastest
and the only workable local option. Do not use Docker for local
development: the image requires an NVIDIA GPU (whisper-cli there is
linked against libcuda.so.1), so it cannot start on a Mac at all. See
DEPLOY.md.
The set of registered models lives in cmd/transcriber/models.go as typed
Go code. Server settings come from flags; per-machine paths from env vars.
| Flag | Default | Meaning |
|---|---|---|
-port |
8888 |
HTTP listen port |
-workers |
2 |
concurrent jobs on local models (whisper.cpp, GPU-bound) |
-remote-workers |
10 |
concurrent jobs on cloud models (ElevenLabs, OpenRouter), in their own queue: they neither wait behind nor hold up local jobs |
-callback-workers |
2 |
webhook delivery goroutines |
-default-model |
stub |
adapter ID used when the request omits model |
-default-prompt-file |
prompts/whisper.txt |
free-text prompt used when the request omits one, for Whisper-style models; missing file = no default. A non-empty prompt in the request fully overrides it |
-default-keyterms-file |
prompts/keyterms.txt |
keyterm list used instead of the free-text prompt for keyterm models (elevenlabs-*, openrouter/deepgram/*, openrouter/elevenlabs/*, openrouter/assemblyai/*); missing file = those models get the free-text prompt |
-job-timeout |
30m |
wall-clock cap per job; on expiry the worker cancels the subprocess and marks the job FAILED with error: "timeout". Per-request timeout_seconds overrides this. <= 0 disables |
-state-db |
transcriber.db |
SQLite file holding job state (migrated on startup). Queued jobs and finished results survive a restart; jobs that were running start over. Empty = in-memory only |
-retention |
168h |
how long finished jobs (completed/failed/canceled) are kept after they end; pruned hourly. Active jobs are never pruned. <= 0 keeps them forever |
-log-format |
text |
text for human-readable output (dev), json for structured logs (prod). The Dockerfile sets json |
-scratch-dir |
(OS temp) | where per-job scratch dirs are created for adapter intermediates (extracted chunk wavs, raw model output). Keep on local disk — chunking writes ~115 MB per hour of audio |
-keep-work-dirs |
false |
retain per-job scratch dirs after completion, for inspecting a bad transcription. They are large; off by default |
-temporal-host-port |
(empty) | Temporal frontend. When set, the transcriber is a Temporal worker serving bcc-media-flows' Transcribe activity (see Temporal). Empty = off |
-temporal-namespace |
default |
Temporal namespace |
-temporal-task-queue |
transcribe |
task queue the activity is served on; must match flows' QueueTranscribe |
-temporal-identity |
transcriber@<hostname> |
worker identity shown in Temporal |
-temporal-activities |
0 |
cap on Transcribe activities held at once, cloud models included; <= 0 uses -workers + -remote-workers. Local-model tasks are further limited by the slot supplier (see Temporal) |
-s3-endpoint |
(empty) | S3-compatible API (AWS, Garage, MinIO) for s3:// paths, e.g. https://s3.example.com. Credentials from AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY. Required with -temporal-host-port; empty refuses s3:// paths (see S3 paths) |
-s3-region |
(empty) | must match the server's region (Garage: garage); empty asks the server |
-download-dir |
(empty) | where s3:// inputs are kept while their job runs; empty uses the job's scratch dir. With the aligner or qwen-asr sidecars, use a directory they mount at the same path |
| Env var | Default | Meaning |
|---|---|---|
WHISPER_CPP_BIN |
/opt/homebrew/bin/whisper-cli |
whisper.cpp binary |
WHISPER_CPP_MODEL |
(unset → fetched from HF) | local path override for the whisper-cpp-large-v3 adapter. Unset = auto-download ggerganov/whisper.cpp/ggml-large-v3.bin via internal/hfcache. |
NB_WHISPER_MODEL |
(unset → fetched from HF) | local path override for the nb-whisper-large adapter. Unset = auto-download NbAiLab/nb-whisper-large/ggml-model.bin via internal/hfcache. |
WHISPER_VAD_MODEL |
(unset → fetched from HF) | local path override for the Silero VAD model used to skip music/silence. Unset = auto-download ggml-org/whisper-vad/ggml-silero-v5.1.2.bin. |
XDG_CACHE_HOME |
~/.cache |
base for the HF cache (<root>/transcriber/hf/<repo>/<file>). |
ELEVENLABS_API_KEY |
(unset) | enables the ElevenLabs Scribe backends (see below). Unset = not registered. |
ELEVENLABS_DEFAULT_MODEL |
elevenlabs-scribe-v2 |
which Scribe adapter the unversioned elevenlabs-scribe ID points to. |
ALIGNER_URL |
(unset → off; compose sets http://aligner:8000) |
forced-aligner service that re-times the local whisper models' words. See Forced alignment. |
OPENROUTER_KEY |
(unset) | enables the OpenRouter backends (see below). Unset = not registered. |
OPENROUTER_MODELS |
(unset → Norwegian-capable list) | comma-separated OpenRouter model slugs to register instead of the built-in list. |
OPENROUTER_DEFAULT_MODEL |
openai/whisper-large-v3 |
which model the bare openrouter ID points to. |
{
"path": "/mnt/storage/audio/foo.wav",
"language": "no",
"format": "all",
"output_path": "/mnt/storage/out/foo/",
"priority": 5,
"callback": "https://example.com/hook",
"model": "whisper-cpp-large-v3",
"timeout_seconds": 1800
}model is optional — omit to use the default. format: "all" writes
json+srt+vtt+txt; or pass a comma-separated subset like "json,srt".
timeout_seconds is optional — omit to inherit the server's -job-timeout.
Send an Idempotency-Key header to dedupe retries: a repeated POST with the
same key returns the original job (200 OK) instead of creating a new one
(202 Accepted). The mapping lives as long as the job is in the store, so
once a job has been pruned (see -retention) the same key starts fresh.
# Submit a job, then poll until it completes.
JOB=$(curl -sS -X POST http://localhost:8888/transcription/job \
-H 'content-type: application/json' \
-d '{
"path": "/mnt/storage/audio/foo.wav",
"language": "no",
"format": "all",
"output_path": "/mnt/storage/out/foo/",
"model": "whisper-cpp-large-v3"
}' | jq -r .id)
while :; do
curl -sS "http://localhost:8888/transcription/job/$JOB" | jq '{status, progress, result}'
sleep 2
doneWith -s3-endpoint set, path and output_path may be s3://bucket/key
URLs instead of paths on this host. That way a transcriber can work on files it
can't mount:
path: "s3://bucket/in/foo.wav": the worker downloads the file when the job starts, transcribes the copy and deletes it when the job ends. The download counts against the job's timeout.output_path: "s3://bucket/out/foo": the results are written to the job's scratch dir and uploaded under that prefix with the usual names (foo.wav.json, …).resultandresultshold theirs3://URLs.
Local and S3 paths can be mixed in one job. The aligner and qwen-asr sidecars
read the input by path, so with them set -download-dir to a directory they
mount at the same path (docker-compose.yml uses $STORAGE_PATH/.s3-downloads).
Returns the current job state. status is one of PENDING, RUNNING,
COMPLETED, FAILED, CANCELED. progress is 0–100. result is the
path to transcript.json once COMPLETED.
The JSON result includes word-level timestamps. Each segment carries a
words array (text / start / end) in addition to the segment-level
text/start/end. See
internal/formats/testdata/golden/transcript.json for the canonical
shape — this fixture is the source of truth that every adapter must
serialize to.
With -temporal-host-port set, the transcriber registers as a Temporal worker
on -temporal-task-queue and serves the Transcribe activity that
bcc-media-flows' workflows schedule, so no flows worker sits in between polling
the HTTP API.
The activity works on object storage only, so a transcriber needs no access to
flows' storage, and -s3-endpoint is required. Its input and output are
flows' activities.TranscribeParams / TranscribeResponse with s3:// URLs:
{"File": "s3://transcriber-temp/run1/a.wav", "DestinationPath": "s3://transcriber-temp/run1", "Language": "no", "Model": ""}The input is downloaded, and the results are uploaded under DestinationPath
and returned as JSONPath, SRTPath, WordsSRTPath and TXTPath URLs (see
S3 paths). Anything but an s3:// URL, including a local path or
flows' old {Drive, Path} object, fails with the non-retryable
invalid_input.
Each activity submits an ordinary job (it shows up in the UI and
GET /transcription/jobs) with format all, then heartbeats with the job ID
until the job ends:
- Retries resume the previous attempt's job when it is still in this transcriber's store and queued, running or completed. A failed or canceled job is submitted again.
- Job timeout (
error: "timeout") fails the activity with the non-retryable typeTRANSCRIBER_JOB_TIMEOUT; a job canceled on the transcriber (UI orDELETE) fails it withtranscription_canceled. Bad paths and unknown models fail withinvalid_input. - Activity timeout or cancel, and shutdown, cancel the job, so a retry, possibly on another transcriber, is the only run.
Load balancing. A custom slot supplier (internal/temporalworker/slots.go)
only lets the worker poll for a task while the local (GPU) pool has a free
worker, counting every local job queued or running (HTTP ones included), slots
still polling, and activities that have a task but no job yet. Busy
transcribers stop polling, so tasks go to idle ones. A cloud-model job stops
counting against the local pool as soon as it is submitted. One gap: a slot is
reserved before its long poll (up to about a minute), so HTTP jobs arriving
during that poll don't revoke it, and that one task can still land on a busy
transcriber and queue there.
With ELEVENLABS_API_KEY set, the cloud backends elevenlabs-scribe-v3, elevenlabs-scribe-v2 and
elevenlabs-scribe-v1 are registered. Pass any of them as model to choose it
per job. elevenlabs/scribe_v3, elevenlabs/scribe_v2 and elevenlabs/scribe_v1 work as aliases, and
elevenlabs-scribe resolves to ELEVENLABS_DEFAULT_MODEL. The input is
transcoded with ffmpeg to 16 kHz mono Opus and uploaded in a single request,
because Scribe handles long audio itself and no chunking is needed. On v2 and v3 the
prompt is sent as keyterms: comma-, newline- or semicolon-separated entries
of at most 5 words or 50 characters. Anything longer is ignored. Audio for these
jobs leaves the host.
With OPENROUTER_KEY set, OpenRouter speech-to-text models are registered as
openrouter/<slug>, for example openrouter/openai/whisper-large-v3. The
set is a hardcoded list of models whose vendors document Norwegian support
(openRouterNorwegianModels in cmd/transcriber/models.go). At boot it is
checked against OpenRouter's live model list and withdrawn models are skipped.
OPENROUTER_MODELS replaces the list. openrouter alone resolves to
OPENROUTER_DEFAULT_MODEL. Jobs use OpenRouter's /api/v1/audio/transcriptions endpoint with
verbose_json and segment and word timestamps. Input is split into 10-minute
chunks, and up to 4 chunks run at once. Each chunk is transcoded to 16 kHz mono
Opus, which keeps every upload far below the 25 MB limit. language and
prompt are passed through. Segment and word timestamps depend on the
provider. A provider that returns only text produces one segment with no
timing. Audio for these jobs leaves the host.
With ALIGNER_URL set, the local whisper models (whisper-cpp-large-v3,
nb-whisper-large, nb-whisper-medium, and the Nordlyd Qwen model) send their result to the aligner service (aligner/)
after transcription. It keeps whisper's text and moves each word's timestamps
to where a wav2vec2 CTC model finds it in the audio, which fixes words whisper
placed at the wrong side of a pause. Segment bounds follow their words.
Subtitle cues are built from word times, so they follow too.
Models per language (override with ALIGN_MODELS): Norwegian
NbAiLab/nb-wav2vec2-1b-bokmaal-v2 (no/nb), NbAiLab/nb-wav2vec2-300m-nynorsk
(nn), and jonatasgrosman/wav2vec2-large-xlsr-53-* for en, de, nl.
Words with no letters the model knows, such as bare numbers, keep whisper's
time. Alignment is best effort: if the aligner is down, has no model for the
language or errors, the job completes with whisper's timestamps and a warning
is logged. Cloud backends are not aligned.
The aligner reads the job's audio path itself, so it needs the same mounts as the transcriber. It has no authentication; docker-compose keeps it on the internal network.
With QWEN_ASR_URL set, nordlyd-asr-qwen-0.6b (alias
NbAiLab/nordlyd-asr-qwen06B-nov26preview) is registered as a local model.
It is served by the qwen-asr/ service, which runs the model with the
qwen-asr package on the GPU. The model is gated on Hugging Face, so the
service needs an HF_TOKEN from an account that was granted access.
Without one, or if the model fails to load, the service stays up but reports
itself disabled on /healthz, and the transcriber leaves the model
unregistered. It checks once at boot (retrying for up to a minute), so restart
the transcriber after adding the token.
Qwen3-ASR returns text without timestamps. The service splits the audio at
quiet points into pieces of 20 s or less and returns each piece's text with
its span. The adapter spreads the words over the span by length, and the
aligner then places them, so word and subtitle timing depends on the aligner.
Without it, word times are estimates within each piece. The request prompt
is passed as the model's context, as a keyterm list. Norwegian cannot be
forced in qwen-asr, so for no/nb/nn the model detects the language
itself; codes it does support, such as en, are forced.
GET /transcription/jobs— list all jobsDELETE /transcription/job/{id}— cancel a queued or running jobGET /models— list registered adaptersGET /config— server-side defaults (default_prompt,default_keyterms,default_language)GET /modelsalso reports each model'sprompt_style(textorkeyterms) and thedefault_promptit getsGET /healthz,GET /readyz
- Implement
transcriber.Transcriberininternal/transcriber/<name>/. - Add another
r.Register(...)call incmd/transcriber/models.gowith the adapter's typedConfig. Use a distinct ID per variant (e.g.whisper-cpp-large-v3,whisper-cpp-medium) so you can A/B test by passing"model": "..."in the request body. - Wrap the adapter in
chunked.New(inner, chunked.Config{})at registration time if it should handle long-form audio — the wrapper passes short files (≤ChunkLengthSec, default 5 min) through unchanged and chunks longer files transparently. - Add a
testdata/raw.jsonfixture and a parser test in the adapter package that round-trips the parsedTranscriptionthroughformats.Writeand byte-compares each output againstinternal/formats/testdata/golden/transcript.<ext>. This is the contract every adapter is held to.