kittors/CliRelay

Self-hosted AI gateway for coding CLIs — one OpenAI/Claude/Gemini/Codex-compatible endpoint, with a multi-tenant web console, request logs, and spend quotas.

What it solves

CliRelay is a unified proxy server designed to consolidate multiple AI CLI subscriptions, API keys, and OAuth credentials into a single, managed API layer. It allows users to use their existing subscriptions with any OpenAI, Gemini, Claude, or Codex compatible client, eliminating the need to manage multiple disparate endpoints and authentication methods across different AI coding tools.

How it works

It acts as a gateway (defaulting to port 8317) that fronts various upstream providers like Google Gemini, Anthropic Claude, OpenAI Codex, and others. The system proxies requests from AI coding tools to these providers, adding a management layer that includes:

  • Routing & Load Balancing: Uses round-robin or fill-first scheduling across API keys and supports auto-failover to backup channels.
  • Governance: Implements a multi-tenant model with roles, permissions, and audit logs to manage access for different users and teams.
  • Observability: Logs every request to a PostgreSQL database, tracking tokens, latency, and status, while using Redis for real-time state and caching.
  • Management: Provides a web-based control panel (/manage) and a terminal TUI for configuring providers, managing API keys, and monitoring usage.

Who it’s for

  • Developers and Teams: Those using multiple AI coding tools and subscriptions who want a centralized way to manage and route traffic.
  • Self-hosters: Users who want a production-grade, self-hosted proxy to manage AI API access for a group of people.
  • AI Tool Power Users: Individuals who want detailed request logging, quota control, and multimodal support across various providers.

Highlights

  • Unified Endpoint: A single entry point for a vast array of providers including Gemini, Claude, Codex, Qwen, xAI/Grok, and Bedrock.
  • Multi-Tenancy: Full support for tenants, users, and fine-grained permission models.
  • Detailed Monitoring: Comprehensive request capture with compressed storage in PostgreSQL and live system stats via WebSockets.
  • Quota & Rate Limiting: Per-key token and request quotas with automatic enforcement and periodic resets.
  • OpenAI Compatibility: Works with any upstream that speaks the OpenAI Chat Completions protocol.
  • Security Features: Native OAuth flows, content moderation profiles, and request cloaking to strip client-identifying headers.

Related

  • Project
  • Project
  • Project
  • Project
  • Project