Self-hosted traffic cop for AI coding tools
CliRelay turns a zoo of AI CLI subscriptions into one managed, metered, multi-tenant API endpoint.

What it does
CliRelay is a Go-based self-hosted proxy that sits between AI coding CLIs—Claude Code, Gemini CLI, OpenAI Codex, and anything else speaking an OpenAI-compatible protocol—and their upstream providers. It exposes a single local endpoint and wraps it with a web console for routing, request logging, spend quotas, and tenant isolation. Essentially, it is an API gateway and accounting department purpose-built for generative coding tools.
The interesting bit
The project treats CLI tools as first-class citizens in need of enterprise governance: it ships fine-grained RBAC with permissions like governance.tenants and models.write, audit logs for sensitive changes, and a public self-service portal where end users can check their own usage without bothering an admin. That level of multi-tenant bureaucracy is unusual for a developer-side proxy.
Key highlights
- Fronts Gemini, Claude, Codex, Qwen, Ollama, Bedrock, Vertex, and others through one OpenAI-compatible endpoint, with round-robin or fill-first load balancing and automatic failover across API keys.
- Logs every request to PostgreSQL with full metadata, token counts, latency, and compressed message bodies; pre-computed analytics and a real-time health score engine are included.
- Multi-tenant from the ground up: tenant-scoped data, role-based permissions, menu management, and audit trails for security-sensitive changes.
- Portal accounts let end users group multiple API keys under one identity, view masked keys (
sk-***xxx), and query their own usage stats via a public lookup page. - Supports OAuth flows for major providers, content moderation profiles, request cloaking to strip identifying headers, and scoped CORS including
chrome-extension://origins.
Verdict
Teams running multiple AI coding tools who need spend control, failover, and delegated access should look here; solo developers with a single API key will find it overkill.
Frequently asked
- What is kittors/CliRelay?
- CliRelay turns a zoo of AI CLI subscriptions into one managed, metered, multi-tenant API endpoint.
- Is CliRelay open source?
- Yes — kittors/CliRelay is open source, released under the MIT license.
- What language is CliRelay written in?
- kittors/CliRelay is primarily written in Go.
- How popular is CliRelay?
- kittors/CliRelay has 883 stars on GitHub.
- Where can I find CliRelay?
- kittors/CliRelay is on GitHub at https://github.com/kittors/CliRelay.