Speech-to-text toolkit
AI Transcription Platform
Three input pipelines (upload, YouTube URL, live mic), one Deepgram-backed transcription surface with an optional LLM reprocessing pass.
Demo limits
- ·Budget reserved before the provider call, reconciled against real duration after
- ·Daily ceiling per cost category, on UTC day boundaries
- ·Provider key never reaches the browser: ephemeral, 5 second TTL, narrowest scope
A public AI demo is a spending endpoint. Cost control is part of what I ship.

Problem
Anything that puts an AI provider behind a public URL is a spending endpoint. The failure is never the model, it is the accounting: a rate limit that resets when the visitor clears localStorage, a budget counted after the call instead of before it, a session that dies mid-request and leaks its reservation forever, a provider key handed to the browser because that was easier. This is the same problem a client has in production, with my own invoice as the test.
Approach
- →Spend is reserved before the provider is called and reconciled against the real duration when the session ends, so a request can never start against a budget that is already gone. Reservations that are never finalized expire on a sweep instead of being lost.
- →A daily ceiling per cost category on UTC day boundaries, plus a kill-switch environment variable that refuses new work immediately, with no redeploy.
- →The browser never sees the account key. Live transcription mints an ephemeral Deepgram key with a 5-second TTL and the narrowest scope that still opens the socket.
- →Rate limiting keys on the real TCP peer that Traefik sets, not on a client-controllable header. Callers arriving without it are pooled into a single hostile bucket rather than each getting a fresh allowance.
- →Provider errors are sanitized before they reach the logs, so a failed call never writes a key or a token to disk.
- →On top of that, three input pipelines: file upload sniffed by magic bytes, YouTube via yt-dlp with IPv4-pinned clients to survive datacenter-IP blocking, and live microphone. An optional LLM pass reuses the cached transcript instead of paying to transcribe twice.
Stack
By the numbers
reserve, then reconcile
Budget model
ephemeral, 5s TTL
Provider key exposure
env var, no redeploy
Kill switch