A real-time live event interpreter built on OpenAI's GPT-Realtime-Translate and Backblaze B2. A speaker talks into the browser; attendees pick a target language and receive translated audio plus captions streamed back to them with low latency. Every event archives to B2 as a rich multi-artifact bundle: source audio, source transcript, per-language captions (VTT/SRT), per-language translated transcripts, and (optionally) the translated audio itself.
This is the canonical "fan-out, archive everything" pattern: one source generates many derived artifacts, and object storage is the natural home for the result.
Live translation is implemented end to end. With an OPENAI_API_KEY set, the speaker console captures the mic and the API bridges to one gpt-realtime-translate session per target language, streaming translated audio + captions to attendees; the event archives to B2 (source audio, per-language transcripts/captions) when it ends. Without a key the speaker socket closes with a structured 4001 frame and the rest of the app (events explorer, archive view, glossary, dashboard, full-bucket explorer) still works. A live run requires a real OpenAI key and network access.
Dashboard — events count, total interpretation minutes, live-now, peak attendees, daily activity:
Events — every event archived to B2 with status, language chips, attendee peak, and actions:
Speaker console — set the event title, source and target languages, and the persist-audio toggle, then go live:
Speaker console (live) — running event with a live caption preview, attendee count, and shareable listen link:
Attendee listen view — pick a target language and follow translated captions in real time:
/live— speaker console: mic capture, go-live, live caption preview, attendee count, shareable listen link/live/[id]/listen— attendee listen view: language picker, translated audio playback + live captions/events— Events explorer grid scoped to theevents/prefix in B2/events/[id]— single-event detail view: source-audio playback, per-language transcript / VTT / SRT downloads, artifact listing/glossary— Glossary management surface (reusable JSON glossaries attachable to events)/files— full B2 bucket explorer (tree view, preview, download, delete) — non-negotiable keep/(Dashboard) — total events, total interpretation minutes, live-now count, peak concurrent attendees/design— design-system showcase including theEventCardprimitive- FastAPI backend with strict layered architecture (
types -> config -> repo -> service -> runtime) and structural tests, including newtest_openai_only_in_repo
This repo is optimized for coding agents. Point your agent at it and start building.
The structure follows the principle that repository knowledge is the system of record. Anything an agent can't access in-context doesn't exist — so everything it needs to reason about the codebase is versioned, co-located, and discoverable from the repo itself.
AGENTS.md is the single source of truth for all coding agents. A ~100-line entry point gives agents the repository layout, architectural invariants, commands, conventions, and pointers to deeper docs.
Architecture is enforced mechanically, not by convention. Layering rules, import boundaries, file size limits, and SDK containment (boto3 and openai) are verified by structural tests and lints that run on every change.
AGENTS.md Single source of truth — layout, invariants, commands, conventions
ARCHITECTURE.md System layout, layering rules, data flows
docs/
features/ Feature docs (events, live-interpretation, transcripts, glossary, dashboard, file-browser)
app-workflows.md Speaker, attendee, organizer journeys
dev-workflows.md Engineering workflows and testing
SECURITY.md Security principles
RELIABILITY.md Reliability expectations
exec-plans/ Execution plans and tech debt tracker
| Principle | Implementation |
|---|---|
| Give agents a single source of truth | AGENTS.md ~100 lines — layout, invariants, commands, conventions |
| Enforce invariants mechanically | Structural tests + ruff + ESLint verify boundaries |
| DRY documentation | Each fact lives in one place |
| Strict layered architecture | types -> config -> repo -> service -> runtime, enforced by tests |
| Contain external SDKs | boto3 only in repo/; openai only in repo/openai_realtime.py |
| Prefer boring libraries | stdlib wave + mutagen for audio metadata, no ffmpeg |
| Keep files agent-sized | 300-line limit per file, enforced by test |
| Docs updated with code | Same-PR requirement prevents documentation rot |
| Structured observability | JSON logging, /metrics endpoint, event-aware counters |
You need: Node.js >= 20, pnpm >= 9, Python >= 3.11, a free Backblaze B2 account, and an OpenAI API key (required for live interpretation; not required to browse archived events).
1. Clone and install dependencies
git clone https://github.com/backblaze-b2-samples/gpt-realtime-translate-live-event-interpreter.git
cd gpt-realtime-translate-live-event-interpreter
pnpm install2. Set up the backend
cd services/api
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cd ../..3. Add your credentials
cp .env.example .envOpen .env and fill in:
- Backblaze B2 — four required keys plus an optional public URL base. From the Backblaze B2 dashboard, create a bucket and an application key:
- Bucket Unique Name ->
B2_BUCKET_NAME - Region (path segment of the endpoint, e.g.
us-west-004) ->B2_REGION - keyID ->
B2_APPLICATION_KEY_ID - applicationKey ->
B2_APPLICATION_KEY - Optional public bucket or CDN base URL ->
B2_PUBLIC_URL_BASE
- Bucket Unique Name ->
- OpenAI — required for live interpretation only. Get a key at https://platform.openai.com/api-keys:
OPENAI_API_KEY-> your keyOPENAI_REALTIME_MODEL-> defaults togpt-realtime-translate
- Defaults — adjust
DEFAULT_SOURCE_LANGUAGE,DEFAULT_TARGET_LANGUAGES, andPERSIST_TRANSLATED_AUDIOto taste.
Walkthroughs: creating a bucket and creating app keys.
4. Run it
pnpm devFrontend at localhost:3000, API at localhost:8000. Open /events and you'll see the empty-state until the first event is created.
pnpm dev runs pnpm doctor first — a preflight check that catches the common setup gotchas (wrong Node/Python version, missing venv, missing or placeholder .env, ports already taken) and tells you exactly how to fix each one.
- Event Archive —
/eventsexplorer and/events/[id]detail view; B2 storage layout (events/<id>/...). - Live Interpretation — speaker console, attendee listen view, WebSocket lifecycle, mic permission flow.
- Realtime Translation — OpenAI Realtime integration, session lifecycle, reconnect strategy, language list.
- Transcripts & Captions — VTT/SRT generation, chunk persistence cadence, on-disconnect finalization.
- Glossary — Reusable JSON glossaries; attach-at-create flow; prompt-injection safety.
- Bucket Explorer — Full B2 bucket tree view, kept from the underlying starter.
- Dashboard — Event-aware stats: events, interpretation minutes, peak attendees.
- Audio Metadata Extraction — Post-event source-audio metadata via stdlib
wave+mutagen. - Source-Audio Playback — Presigned-URL flow, inline
<audio controls>, expiry, content disposition. - Design System — Tokens, primitives, AI elements, the
EventCardprimitive.
Plus the cross-cutting essentials inherited from the underlying starter:
- Inline error handling — fetch failures surface what's wrong and offer a Retry
- Single-source config — one
.envat the repo root powers both API and web app, validated at startup - Centralized data layer — every fetch goes through TanStack Query hooks in
apps/web/src/lib/queries.ts - Structural tests — verify layering rules, import boundaries,
boto3containment,openaicontainment, file size limits - Structured JSON logging — every request traced with
request_id, plusevent_id/target_langwhere applicable /healthendpoint — B2 connectivity check/metricsendpoint — Prometheus-format counters (request count, latency, events started/ended, attendees joined, realtime chunks broadcast)
- TypeScript, Next.js 16, React 19, Tailwind v4, shadcn/ui, Recharts
- TanStack Query — caching, dedup, retry, stale-while-revalidate for every fetch
- Python 3.11+, FastAPI, boto3, Pydantic v2,
mutagen - OpenAI Realtime API (containment-wrapped in
services/api/app/repo/openai_realtime.py) - Backblaze B2 (S3-compatible object storage)
- pnpm workspaces (monorepo)
| Command | What it does |
|---|---|
pnpm dev |
Start frontend + backend |
pnpm dev:web |
Frontend only |
pnpm dev:api |
Backend only |
pnpm build |
Build frontend |
pnpm lint |
Lint frontend |
pnpm lint:api |
Lint backend (ruff) |
pnpm test:api |
Run backend tests |
pnpm check:structure |
Verify layering rules and SDK containment (boto3 + openai) |
pnpm test:e2e |
Playwright e2e tests (run pnpm --filter @gpt-realtime-translate-live-event-interpreter/web exec playwright install chromium once first) |
| Doc | Purpose |
|---|---|
| AGENTS.md | Agent table of contents — start here |
| ARCHITECTURE.md | System layout, layering, data flows |
| docs/features/ | Feature docs (event archive, live interpretation, realtime translation, transcripts, glossary, dashboard, file browser, audio metadata, source-audio playback) |
| docs/design-system.md | Design tokens, primitives, AI elements, the EventCard |
| docs/app-workflows.md | Speaker, attendee, organizer journeys |
| docs/dev-workflows.md | Engineering workflows and testing (incl. WebSocket testing notes) |
| docs/SECURITY.md | Security principles |
| docs/RELIABILITY.md | Reliability expectations (incl. Realtime resilience) |
| docs/exec-plans/ | Execution plans and tech debt tracker |
Start with AGENTS.md. It's the map — everything else is discoverable from there.
MIT License — see LICENSE for details.
Manage Backblaze B2 from your terminal using natural language (list/search, audits, stale or large file detection, security checks, safe cleanup).
Repo: https://github.com/backblaze-b2-samples/claude-skill-b2-cloud-storage




