ding113/claude-code-hub

一个现代化的 Claude Code & Codex API 代理服务,提供智能负载均衡、用户管理和使用统计功能。

What it solves

CC Hub is an AI API proxy and management platform designed for teams to unify access to multiple AI providers (such as Claude, OpenAI, and Gemini). It eliminates the need to manage separate API keys and endpoints for different services, providing a centralized hub for elastic scheduling, cost management, and observability.

How it works

Built with Next.js 16, Hono, PostgreSQL, and Redis, the system acts as a gateway between clients and AI providers. It processes requests through a pipeline that includes authentication, session management, rate limiting, and provider selection. It uses a weighted load balancer with circuit breaker protection to route requests to the most stable provider, with up to three failover attempts. The platform also maintains a 5-minute context cache to ensure session consistency and avoid frequent provider switching.

Who it’s for

It is primarily intended for teams and developers who use multiple AI model providers and need a professional-grade gateway to manage concurrency, track costs, and ensure high availability of their AI services.

Highlights

  • Intelligent Load Balancing: Uses weights, priorities, and grouping with built-in circuit breaker protection and automatic failover.
  • Multi-Provider Support: Integrates Claude, Codex, Gemini CLI, and OpenAI-compatible APIs with custom model redirection.
  • Granular Control: Implements multi-dimensional rate limiting (RPM, budget, concurrent sessions) using Redis Lua scripts for atomicity.
  • Real-time Monitoring: Features a dashboard for tracking usage, costs, active sessions, and decision-chain logs.
  • OpenAI Compatibility: Provides /v1/chat/completions endpoints that pass through tool calls and reasoning fields without format conversion.
  • Automated Documentation: Automatically generates OpenAPI 3.1.0 specifications with Swagger and Scalar UI for testing.

Related

  • Project
  • Project
  • Project
  • Project
  • Project