Media Gateway
Real-time media ingestion gateway for audio, screenshots, redaction, storage, and analyzer handoff.
mediagateway
servicemediawebsocketredactionUpdated 2026-11-03
Verified 2026-11-03
Media Gateway is a stateless Go service for real-time media ingestion. Browser clients connect over WebSocket, stream binary audio and screenshot frames, and receive session-level processing through downstream Cosmos services.
Responsibilities
- Accept real-time audio and screenshot frames over WebSocket.
- Stream audio to Deepgram for speech-to-text.
- Upload screenshots to DMS through Cosmos Storage when DMS upload is enabled.
- Optionally redact screenshot and transcript PII through PII Redactor before storage or analysis.
- Optionally post the session to the ADK analyzer when a session ends.
Runtime
| Area | Details |
|---|---|
| Repository | cosmos-mediagateway |
| Language | Go |
| Default bind | :8080 (GATEWAY_BIND) |
| Primary protocol | WebSocket |
| State | Stateless |
API
| Method | Path | Purpose |
|---|---|---|
GET | /ingest | WebSocket endpoint for audio and screenshot ingestion (path set by GATEWAY_PATH). |
GET | /healthz | Liveness probe. |
GET | /readyz | Readiness probe. |
GET | /metrics | Prometheus metrics. |
Configuration
Media Gateway mints audience-bound service tokens from the User Service (USER_SERVICE_URL, COSMOS_SERVICE_CLIENT_ID default cosmos-mediagateway, COSMOS_SERVICE_CLIENT_SECRET) for the analyzer, DMS, and PII Redactor calls.
| Variable | Purpose |
|---|---|
DEEPGRAMAPIKEY | Deepgram streaming transcription credential. DEEPGRAM_MODEL defaults to nova-3 and DEEPGRAM_LANGUAGE to multi. |
ANALYZER_ENABLED | Enables the end-of-session analyzer POST (default false). |
ANALYZER_BASE_URL | ADK base URL (http:// or https://); the gateway posts to /api/v1/adk/analyzer/runs/. Required with ANALYZER_ORG_ID when the analyzer is enabled. |
DMS_ENABLED | Enables screenshot upload to Storage (default false). When disabled, screenshot frames are acknowledged and dropped. |
DMS_URL, DMS_OWNER_ID | Storage URL and owning user; required when DMS upload is enabled. DMS_PARENT_PATH_TEMPLATE defaults to /Analyzer/Sessions/{session_id}/. |
PII_REDACTION_ENABLED | Sends screenshots to /v1/redact-images and transcript lines to /v1/redact-text (default false). On a redactor failure the gateway falls open and uses the original content. |
PII_REDACTOR_URL | PII Redactor service URL; required when redaction is enabled. |
MAX_FRAME_BYTES | Per-frame cap for audio frames (default 8 MiB). |
SCREENSHOT_MAX_BYTES | Per-screenshot cap (default 8 MiB). |
Related Services
cosmos-pii-redactorredacts screenshots and transcripts when enabled.cosmos-storage-v3stores uploaded media artifacts.cosmos-adk-v3receives the end-of-session analyzer run.cosmos-user-v3issues service tokens used for downstream calls.
Changelog
See Media Gateway Changelog for verified documentation and service-surface changes.