waarn (Workflow-Aware Routing Network) is an OpenAI-compatible AI Gateway written in Elixir/OTP. It provides a single endpoint for routing requests across multiple model providers with virtual keys, rate limits, budgets, caching, guardrails, and native BEAM clustering.
Ports
| Port | Service | Endpoints |
|---|---|---|
:4000 |
Gateway API | /v1/chat/completions, /v1/responses, /v1/messages, /v1/models, /v1/embeddings, /v1/images/generations, /v1/audio/speech, /v1/audio/transcriptions, /v1/rerank, /health, /ready |
:4001 |
Operations & Admin | Admin UI (/), Swagger UI (/swaggerui), OpenAPI (/api/openapi), Prometheus (/metrics) |
Providers & Routing
- Providers: OpenAI, GCP Vertex AI, Anthropic, AWS Bedrock, and OpenRouter.
- Virtual model groups: Round-robin, weighted, and least-latency routing with automatic retries, fallback chains, and ETS-backed circuit-breaker cooldowns.
- Jev (
System One): Pre-routing classification for model tiering and parallel guardrail scoring (MaxTokens, Luhn-verifiedPIIRedaction) with fail-open fallback and persistent PostgreSQL route configuration. - BEAM clustering: Native
libcluster+Phoenix.PubSubsynchronization of cooldowns, virtual keys, orgs/teams/users, deployments, encrypted credentials, budgets, and routing settings.
Governance & Operations
- Phoenix LiveView Admin UI: CRUD for organizations, teams, users, virtual keys, model deployments, routing/Jev settings, and
AES-256-GCMencrypted provider credentials, plus a model playground and filtered spend analytics. - Budgets & rate limits: Atomic micro-USD budgets (key, user, team, org) with upstream cost accounting and Valkey-backed RPM/TPM limits and tenant-scoped caching.
- Storage & security: PostgreSQL (
AyeSQLcompiled SQL) with startup hydration, PBKDF2 key derivation, SSRF/secrets-path validation, strict CSP, W3Ctraceparenttracing, and structured audit logs.
Quickstart
Generate a master key for the Admin UI and start either a local BEAM node or the multi-node podman-compose stack:
export WAARN_MASTER_KEY="$(openssl rand -hex 32)"
# Local BEAM node
make run
# Multi-node cluster with Postgres & Valkey
make up
Open http://localhost:4001 and enter the key in the Master Key field. Leaving WAARN_MASTER_KEY unset allows unauthenticated access in local dev mode only; production (MIX_ENV=prod) fails closed unless SECRET_KEY_BASE, WAARN_ENCRYPTION_KEY, and WAARN_MASTER_KEY are set.