A self-hosted auth gateway for Ollama adds keys, quotas and routing

Regular-Forever5876 · reddit · 2026-07-20

The author built **ollama-gateway**, a self-hosted gateway in front of one or more Ollama servers to add **real authentication and access control**. Key features: - **Per-client API keys** with hashing, one-time display, revocation, and IP/CIDR restriction. - **Quotas and limits**: monthly token caps, rate limiting, and cost-capped lifetime trials. - **Multi-upstream routing**: map each key to a local or remote server, with automatic failover. - **Allowlists** for models and APIs across native Ollama, OpenAI-compatible, and Anthropic endpoints. - **Logging and monitoring**: per-request logs, usage charts, model breakdowns, and request-content inspection. - **Deployment/security**: LAN-only admin panel, Caddy TLS, Dockerized setup, encrypted remote tokens, and a pre-deploy security sweep. The project is source-available rather than OSI open source, with a 1B-token/month commercial threshold.

Related event: Self-hosted Gateway Adds Auth and Quotas for Ollama(2 posts)→

Original post →

More from coding & agent

coding & agent channel →