Skip to content

About

OpenAI-compatible, GPU-accelerated Speech-to-Text API server built on faster-whisper

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Talk Server

Your own GPU, answering the OpenAI transcription API.

Python 3.11+ faster-whisper MIT


This is a drop-in replacement for OpenAI's /v1/audio/transcriptions. Anything that already speaks that API points at this server instead, and the inference happens on a card you own, on audio that never leaves your network. The model is faster-whisper, held resident so a request pays for the transcription and not for the loading.

Nothing is kept. The audio is transcribed and dropped, the text is returned and forgotten, and the only row written is one usage log per authenticated request carrying the token, the route, a timestamp and how long it took. History, if you want history, lives on the client.

It pairs with Talk-Client, a Windows desktop app that dictates into whatever window has focus. That client can transcribe on its own machine instead, and does so by default, so this server is the answer to two different problems: a machine with no GPU, and several machines that would rather share one loaded model than each hold their own.

Quick start

You need an NVIDIA GPU with CUDA, or DEVICE=cpu and patience, plus Docker with the NVIDIA Container Toolkit.

cp .env.example .env

ADMIN_TOKEN is the one setting that matters at bootstrap, and make token prints a suitable random string. Leave it empty and the server starts, warns, and answers 401 to every /v1 call, which is the single most confusing failure this project has.

make up
make token-create NAME=laptop

Keep the sk_... that prints. Tokens are stored hashed, so it is shown once and there is no recovery path, only revoke and mint again.

curl -H "Authorization: Bearer sk_..." \
     -F file=@audio.wav \
     http://localhost:8000/v1/audio/transcriptions

The first start pulls the model from HuggingFace, so it is slow rather than hung, and the healthcheck stays red until the model is resident.

Endpoints

Method Path Auth What it does
POST /v1/audio/transcriptions Bearer Full transcription, OpenAI-compatible
POST /v1/audio/transcriptions/stream Bearer The same, streamed over SSE
GET /v1/models Bearer The loaded model, and a way to check a token
GET /health none Model state, device, queue depth
GET /admin/ ADMIN_TOKEN Token management dashboard
* /admin/tokens[...] ADMIN_TOKEN Token CRUD and per-token usage
POST /pairing/request, /pairing/confirm none Get a token with a code, see Pairing

/health deliberately needs no token: it is what lets a client probe reachability before it holds one, and what lets a monitor work without being given a secret.

Configuration

All of it lives in .env.

Variable Default What it does
WHISPER_MODEL Systran/faster-whisper-large-v3 Model to load
DEVICE cuda cuda or cpu
COMPUTE_TYPE int8_float16 faster-whisper compute type
GPU_TIMEOUT 120 Seconds a request waits for the GPU
GPU_CONCURRENCY 1 Concurrent GPU requests
DEFAULT_LANGUAGE fr Used when the request omits one
CORS_ALLOW_ORIGINS ["*"] Allowed origins
LOG_LEVEL INFO DEBUG, INFO, WARNING, ERROR
DATABASE_URL sqlite+aiosqlite:///./data/tokens.db Token store
ADMIN_TOKEN (empty) Admin credential, and empty disables /admin
MDNS_ENABLED true Announce the server on the local network
PAIRING_ENABLED true Let clients pair with a code, needs ADMIN_TOKEN

GPU_CONCURRENCY stays at 1 for a reason: one card serialises the work anyway, and raising it trades latency for an out-of-memory risk you only discover under load. Requests queue instead, and the queue depth is on /health.

Tokens live in SQLite on the token-data volume and survive a rebuild.

Network discovery

Once the model is loaded the server announces itself over mDNS as _talk._tcp.local., named after the machine, so Talk clients on the same network can find it without a typed address. The record carries the port, the model, and auth=token. Set MDNS_ENABLED=false to stay silent. A failed announcement (no network, UDP port 5353 taken) only logs a warning.

Multicast does not leave a Docker bridge network, so under Docker the announcement only reaches the LAN with network_mode: host on the service (and then the ports mapping is no longer needed). Otherwise clients still connect by typing the address.

Pairing

A Talk client can get a token without anyone copying one. It asks the server for a pairing request, and the server generates a 6-digit code that only you, the operator, can see: it is logged at WARNING by the server (make logs under Docker) and listed under "Pairing Requests" in the /admin/ dashboard, which refreshes by itself. Read the code to whoever is at the client and they type it there. The server then mints a token named <client name> (paired), and you can revoke it like any other.

A code lives two minutes, five wrong guesses cancel the request, and at most five requests wait at once, one per machine: asking again replaces that machine's previous request. Ten wrong codes in total, across every request, turn pairing off until the server restarts and log a warning saying so, which is what keeps anyone on the network from guessing their way through requests. Pairing mints tokens without an administrator present, so it stays off while ADMIN_TOKEN is empty. PAIRING_ENABLED=false turns it off for good, and the mDNS record then says pairing=0 (pairing=1 otherwise).

Development

make sync
make dev

make test runs pytest against an 80% coverage floor, make lint runs ruff and mypy, and make help lists everything else.

Documentation

Guide Covers
endpoints.md Route layout, response contracts, error codes, adding an endpoint
debug.md Diagnosing 503s, invalid audio, CUDA OOM, an unreachable server
monitoring.md Health endpoint, log format, GPU monitoring
testing.md Fixtures, coverage, naming conventions

Licence

MIT, see LICENSE.

About

OpenAI-compatible, GPU-accelerated Speech-to-Text API server built on faster-whisper

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages