{"id":44324569,"url":"https://github.com/ding113/claude-code-hub","last_synced_at":"2026-06-12T07:01:29.637Z","repository":{"id":319962851,"uuid":"1079966361","full_name":"ding113/claude-code-hub","owner":"ding113","description":"一个现代化的 Claude Code \u0026 Codex API 代理服务，提供智能负载均衡、用户管理和使用统计功能。","archived":false,"fork":false,"pushed_at":"2026-06-11T12:24:46.000Z","size":20923,"stargazers_count":3047,"open_issues_count":48,"forks_count":343,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-06-11T14:13:53.930Z","etag":null,"topics":["claude-api","claude-code"],"latest_commit_sha":null,"homepage":"https://claude-code-hub.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"zsio/claude-code-hub","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ding113.png","metadata":{"files":{"readme":"README.en.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security/api-key-admin-access.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":["https://afdian.com/a/ygxz_in"]}},"created_at":"2025-10-20T16:58:17.000Z","updated_at":"2026-06-11T13:33:18.000Z","dependencies_parsed_at":"2026-02-26T06:09:51.545Z","dependency_job_id":null,"html_url":"https://github.com/ding113/claude-code-hub","commit_stats":null,"previous_names":["ding113/claude-code-hub"],"tags_count":155,"template":false,"template_full_name":null,"purl":"pkg:github/ding113/claude-code-hub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ding113%2Fclaude-code-hub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ding113%2Fclaude-code-hub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ding113%2Fclaude-code-hub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ding113%2Fclaude-code-hub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ding113","download_url":"https://codeload.github.com/ding113/claude-code-hub/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ding113%2Fclaude-code-hub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34232790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude-api","claude-code"],"created_at":"2026-02-11T07:16:17.383Z","updated_at":"2026-06-12T07:01:29.630Z","avatar_url":"https://github.com/ding113.png","language":"TypeScript","funding_links":["https://afdian.com/a/ygxz_in"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"right\"\u003e\n  \u003cstrong\u003eEnglish\u003c/strong\u003e | \u003ca href=\"./README.md\" aria-label=\"Switch to Chinese version of this README\"\u003e中文\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n# Claude Code Hub\n\n**🚀 Intelligent AI API relay platform — the control center for multi-provider onboarding, elastic routing, and granular operations**\n\n[![Container Image](https://img.shields.io/badge/ghcr.io-ding113%2Fclaude--code--hub-181717?logo=github)](https://github.com/ding113/claude-code-hub/pkgs/container/claude-code-hub)\n[![License](https://img.shields.io/github/license/ding113/claude-code-hub)](LICENSE)\n[![GitHub Stars](https://img.shields.io/github/stars/ding113/claude-code-hub)](https://github.com/ding113/claude-code-hub/stargazers)\n[![Telegram Group](https://img.shields.io/badge/Telegram-Join%20Group-blue?logo=telegram)](https://t.me/ygxz_group)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/ding113/claude-code-hub)\n\nClaude Code Hub combines Next.js 15, Hono, PostgreSQL, and Redis to deliver a Claude/OpenAI-compatible API gateway with smart load balancing, live observability, price governance, and automated documentation, enabling teams to manage multiple AI vendors safely and transparently.\n\n💬 **Join the discussion**: Questions about deployment, features or technical issues? Join our [Telegram community](https://t.me/ygxz_group)!\n\n\u003c/div\u003e\n\n---\n\n\u003e [!IMPORTANT]\n\u003e **This project is currently under active refactoring**\n\u003e\n\u003e Claude Code Hub Plus, the refactored version of Claude Code Hub, is expected to be open-sourced under the AGPL license in Q3. Claude Code Hub Plus is dedicated to building a high-performance, stable, commercial-grade LLM gateway, offering comprehensive commercial features such as format conversion, privacy filtering, a model marketplace, and top-up billing, while significantly improving the theoretical performance of the forwarding core. During development of the refactored version, progress and community support for the Node.js version may be delayed — thank you for your understanding.\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"200\"\u003e\n\u003ca href=\"https://cubence.com/signup?code=SCE7Y3QR\u0026source=cch\"\u003e\n\u003cimg src=\"public/readme/cubence.jpg\" alt=\"Cubence Logo\" width=\"180\"/\u003e\n\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd\u003e\n\u003cb\u003e💎 Special Offer\u003c/b\u003e: \u003ca href=\"https://cubence.com/signup?code=SCE7Y3QR\u0026source=cch\"\u003eCubence\u003c/a\u003e is a stable and efficient AI service transit platform, providing transit services for AI tools such as Claude Code, Codex, Gemini, with good stability and cost-effectiveness.\u003cbr/\u003e\nCubence offers special discount coupons for users of CCH: when purchasing with the coupon \u003ccode\u003eDING113CCH\u003c/code\u003e, you can enjoy a \u003cb\u003e10% discount\u003c/b\u003e → \u003ca href=\"https://cubence.com/signup?code=SCE7Y3QR\u0026source=cch\"\u003eVisit Now\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"200\"\u003e\n\u003ca href=\"https://www.packyapi.com/register?aff=withcch\"\u003e\n\u003cimg src=\"public/readme/packycode.png\" alt=\"PackyCode Logo\" width=\"180\"/\u003e\n\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd\u003e\n\u003cb\u003e💎 Special Offer\u003c/b\u003e: Thanks to \u003ca href=\"https://www.packyapi.com/register?aff=withcch\"\u003ePackyCode\u003c/a\u003e for sponsoring this project! PackyCode is a stable and efficient API relay service provider, offering relay services for Claude Code, Codex, Gemini and more.\u003cbr/\u003e\nPackyCode offers a special discount for users of this software. Register via this link and enter code \u003ccode\u003eWITHCCH\u003c/code\u003e when recharging to enjoy \u003cb\u003e10% off\u003c/b\u003e → \u003ca href=\"https://www.packyapi.com/register?aff=withcch\"\u003eVisit Now\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"200\"\u003e\n\u003ca href=\"https://co.yes.vg/register?ref=ygxz\"\u003e\n\u003cimg src=\"public/readme/yescode.png\" alt=\"YesCode Logo\" width=\"180\"/\u003e\n\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd\u003e\n\u003cb\u003e💎 Special Offer\u003c/b\u003e: \u003ca href=\"https://co.yes.vg/register?ref=ygxz\"\u003eYesCode\u003c/a\u003e is a low-profile yet highly reliable AI API relay service, dedicated to providing developers with stable access to Claude, Codex, Gemini, and other models. Built on solid technical foundations with consistently dependable service quality.\u003cbr/\u003e\nRegister via this link to get started → \u003ca href=\"https://co.yes.vg/register?ref=ygxz\"\u003eVisit Now\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"200\"\u003e\n\u003ca href=\"https://aigocode.com/invite/QDNEJJAH\"\u003e\n\u003cimg src=\"public/readme/aigocode.jpg\" alt=\"AIGoCode Logo\" width=\"180\"/\u003e\n\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd\u003e\n\u003cb\u003e💎 Special Offer\u003c/b\u003e: \u003ca href=\"https://aigocode.com/invite/QDNEJJAH\"\u003eAIGoCode\u003c/a\u003e is an all-in-one platform integrating the latest models from Claude Code, Codex, and Gemini, delivering stable, efficient, and cost-effective AI coding services. Flexible subscription plans (monthly or bundled), zero ban risk, direct access from China, massive credit pools, and lightning-fast responses.\u003cbr/\u003e\nAIGoCode offers a special bonus for CCH users — register via this link and receive an extra \u003cb\u003e10% bonus credit\u003c/b\u003e on your first top-up → \u003ca href=\"https://aigocode.com/invite/QDNEJJAH\"\u003eVisit Now\u003c/a\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"200\"\u003e\n\u003ca href=\"https://pateway.ai/?ch=1ycdoum\u0026aff=T8FV5H42\"\u003e\n\u003cimg src=\"public/readme/pateway.png\" alt=\"PatewayAI Logo\" width=\"180\"/\u003e\n\u003c/a\u003e\n\u003c/td\u003e\n\u003ctd\u003e\n\u003cb\u003e💎 Special Offer\u003c/b\u003e: \u003ca href=\"https://pateway.ai/?ch=1ycdoum\u0026aff=T8FV5H42\"\u003ePatewayAI\u003c/a\u003e is a premium model API relay provider built for power AI developers, focused on official direct access. It offers the full Claude lineup and Codex series with 100% official upstream channels, no mixed routes, and no watered-down quality. Billing is transparent and every token-level charge can be verified line by line.\u003cbr/\u003e\nIt also supports enterprise-grade high concurrency and provides a professional management platform for business customers. Enterprise clients can sign formal contracts and request invoices; visit the official website for contact details and more information.\u003cbr/\u003e\nRegister now via \u003ca href=\"https://pateway.ai/?ch=1ycdoum\u0026aff=T8FV5H42\"\u003ethis link\u003c/a\u003e to get a \u003cb\u003e$3 trial credit\u003c/b\u003e. Top-ups can be as low as \u003cb\u003e60% of list price\u003c/b\u003e, with two-way referral bonuses, and total referral rewards up to \u003cb\u003e$150\u003c/b\u003e.\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## ✨ Core Highlights\n\n- 🤖 **Intelligent load balancing**: Weight + priority + grouping scheduler with built-in circuit breaker and up to three failover retries to keep requests stable.\n- 🧩 **Multi-provider management**: Connect Claude, Codex, Gemini CLI, and OpenAI-compatible vendors simultaneously with per-provider model redirection and HTTP/HTTPS/SOCKS proxy rules.\n- 🛡️ **Rate limiting \u0026 concurrency control**: Enforce RPM, monetary quotas (5-hour / weekly / monthly), and session concurrency via Redis Lua scripts with atomic counters and fail-open degradation.\n- 📘 **Automated OpenAPI docs**: 39 REST endpoints exported from Server Actions into OpenAPI 3.1.0, instantly browsable in Swagger and Scalar UI.\n- 📊 **Real-time monitoring \u0026 analytics**: Dashboards, active sessions, consumption leaderboards, decision-chain tracing, and proxy health tracking provide second-level visibility.\n- 💰 **Price sheet management**: Paginated SQL queries with debounce search and LiteLLM sync keep thousands of model prices searchable in milliseconds.\n- 🔁 **Session management**: Five-minute context cache preserves decision trails, reduces vendor switches, and maintains full auditability.\n- 🔄 **OpenAI-compatible endpoint**: Supports `/v1/chat/completions` (OpenAI-compatible format), passes through tool calls and reasoning fields, enforces strict same-format routing with no cross-format conversion.\n\n## ⚡️ Quick Start\n\n### Requirements\n\n- Docker and Docker Compose (latest version recommended)\n- Optional (for local development): Node.js ≥ 22.15 (inbound zstd request-body decompression uses native `node:zlib` zstd), Bun ≥ 1.3\n\n### 🚀 One-Click Deployment Script (✨ Recommended - Fully Automated)\n\nThe one-click deployment script **automatically handles** all of the following:\n\n- Check and install Docker and Docker Compose (Linux/macOS support auto-install)\n- Create deployment directory and configuration files\n- Generate secure admin token and database password\n- Start all services and wait for health checks\n- Display access URLs and admin token\n\n**Linux / macOS:**\n\n```bash\n# Download and run the deployment script\ncurl -fsSL https://raw.githubusercontent.com/ding113/claude-code-hub/main/scripts/deploy.sh -o deploy.sh\nchmod +x deploy.sh\n./deploy.sh\n```\n\nOr using wget:\n\n```bash\nwget https://raw.githubusercontent.com/ding113/claude-code-hub/main/scripts/deploy.sh\nchmod +x deploy.sh\n./deploy.sh\n```\n\n**Windows (PowerShell as Administrator):**\n\n```powershell\n# Download and run the deployment script\nInvoke-WebRequest -Uri \"https://raw.githubusercontent.com/ding113/claude-code-hub/main/scripts/deploy.ps1\" -OutFile \"deploy.ps1\"\nSet-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force\n.\\deploy.ps1\n```\n\n**Deployment Directories:**\n\n- Linux: `/www/compose/claude-code-hub`\n- macOS: `~/Applications/claude-code-hub`\n- Windows: `C:\\ProgramData\\claude-code-hub`\n\n**Branch Selection:**\n\nThe script will prompt you to select a deployment branch:\n\n- `main` (default): Stable release, recommended for production\n- `dev`: Development version with latest features, for testing\n\n**Important Notes:**\n\n- ⚠️ Please save the **Admin Token** displayed by the script - it's the only credential to access the admin dashboard!\n- ⚠️ Windows users: If Docker Desktop is not installed, the script will automatically open the download page\n\n### Three-Step Launch (Docker Compose)\n\n1. **Clone and configure**\n\n   ```bash\n   git clone https://github.com/ding113/claude-code-hub.git\n   cd claude-code-hub\n   cp .env.example .env\n   ```\n\n2. **Edit configuration**\n\n   Edit the `.env` file and **update** `ADMIN_TOKEN` (admin login token):\n\n   ```bash\n   # MUST change this!\n   ADMIN_TOKEN=your-secure-token-here\n\n   # Docker Compose defaults (usually no changes needed)\n   DSN=postgres://postgres:postgres@postgres:5432/claude_code_hub\n   REDIS_URL=redis://redis:6379\n   ```\n\n3. **Start services**\n\n   ```bash\n   docker compose up -d\n   ```\n\n   Check status:\n\n   ```bash\n   docker compose ps\n   docker compose logs -f app\n   ```\n\n### Access the application\n\nOnce started:\n\n- **Admin Dashboard**: `http://localhost:23000` (login with `ADMIN_TOKEN` from `.env`)\n- **API Docs (Scalar UI)**: `http://localhost:23000/api/actions/scalar`\n- **API Docs (Swagger UI)**: `http://localhost:23000/api/actions/docs`\n\n\u003e 💡 **Tip**: To change the port, edit the `ports` section in `docker-compose.yml`.\n\n## 🖼️ Screenshots\n\n| Feature             | Screenshot                                           | Description                                                                                                           |\n| ------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |\n| Dashboard           | ![Dashboard](public/readme/首页.png)                 | Aggregates request volume, spending, active sessions, and time-series distribution for instant situational awareness. |\n| Provider management | ![Provider Management](public/readme/供应商管理.png) | Configure weight, cost multiplier, concurrency caps, proxies, and model redirection per vendor for precise routing.   |\n| Logs \u0026 audit        | ![Logs](public/readme/日志.png)                      | Unified request log with filters for time/user/provider/model plus token, cost, and cache-hit details.                |\n| Leaderboard         | ![Leaderboard](public/readme/排行榜.png)             | Ranks users by requests, tokens, and spending to support chargeback and usage governance.                             |\n\n## 🏗️ Architecture\n\n### High-level view\n\n```\nClients / CLI / Integrations\n        │\n        ▼\nNext.js 15 App Router (v1 API routes)\n        │\nHono + Proxy Pipeline (Auth → Session Allocation → Rate Limiting → Provider Selection → Forwarding → Response Handling)\n        │\nMulti-provider pool (Claude / OpenAI / Gemini / others) + PostgreSQL + Redis\n```\n\n- **App layer**: `src/app` hosts dashboards, settings, and API actions for UI and internal APIs.\n- **Proxy core**: `src/app/v1/_lib/proxy-handler.ts` chains `ProxyAuthenticator`, `ProxySessionGuard`, `ProxyRateLimitGuard`, `ProxyProviderResolver`, `ProxyForwarder`, and `ProxyResponseHandler`.\n- **Business logic**: `src/lib` contains rate limiting, session manager, circuit breaker, proxy utilities, and price-sync; `src/repository` encapsulates Drizzle ORM queries.\n- **Documentation system**: `src/app/api/actions/[...route]/route.ts` converts Server Actions into OpenAPI endpoints automatically.\n\n### Data flow \u0026 components\n\n1. **Ingress**: Requests with API keys hit the Next.js route and pass through `ProxyAuthenticator`.\n2. **Context control**: `SessionManager` fetches the five-minute cache from Redis, enforces concurrency, and records the decision chain.\n3. **Rate limiting**: `RateLimitService` applies Lua-driven atomic counters for RPM, spend, and session caps, falling back gracefully if Redis is unavailable.\n4. **Routing**: `ProxyProviderResolver` scores vendors with weights, priorities, breaker states, and session reuse, retrying up to three times.\n5. **Forwarding \u0026 response handling**: `ProxyForwarder` sends requests upstream; `ProxyResponseHandler` processes response streams while preserving endpoint-native formats, with proxy support and model redirects.\n6. **Observability**: Dashboards, leaderboards, and price sheets query PostgreSQL via repositories with hourly aggregations.\n\n## 🚢 Deployment\n\n### 🐳 Docker Compose (✨ Recommended, Production-Ready)\n\nDocker Compose is the **preferred deployment method** — it automatically provisions the database, Redis, and application services without manual dependency installation, ideal for production quick-start.\n\n1. Prepare `.env` (see `.env.example`) and point `DSN`/`REDIS_URL` to the Compose services.\n2. Start the stack:\n   ```bash\n   docker compose up -d\n   ```\n3. Monitor:\n   ```bash\n   docker compose logs -f app\n   docker compose ps\n   ```\n4. Upgrade:\n   ```bash\n   docker compose pull \u0026\u0026 docker compose up -d\n   ```\n   Stop and clean up with `docker compose down` when necessary.\n\n### ☸️ Kubernetes / k3s (Production / HA / Multi-node)\n\nThe repo ships a **dual-compatible** (k3s + standard Kubernetes) one-click deploy script `scripts/deploy-k8s.sh` and a management CLI `scripts/cch`. Out of the box you get HPA autoscaling, PodDisruptionBudget, NetworkPolicy, rolling upgrades with automatic rollback on health check failure, and scheduled backups.\n\nQuick start (auto-installs k3s if no cluster is detected):\n\n```bash\ngit clone https://github.com/ding113/claude-code-hub.git\ncd claude-code-hub\nbash scripts/deploy-k8s.sh --install-k3s -y\n```\n\nStandard Kubernetes with domain:\n\n```bash\nbash scripts/deploy-k8s.sh \\\n  --ingress-host hub.example.com \\\n  --ingress-class nginx \\\n  --storage-class standard \\\n  -y\n```\n\nDay-2 operations with `cch`:\n\n```bash\ncch status            # pods / HPA / resources\ncch update            # rolling upgrade with auto-migrate and rollback on failure\ncch backup            # PostgreSQL backup (gzip, keep 30)\ncch info              # show access URL and admin token\ncch doctor            # diagnose cluster + deployment\n```\n\nSee **[docs/k8s-deployment.md](docs/k8s-deployment.md)** for full options, placeholders, cloud provider StorageClass mapping, and troubleshooting.\n\n### Local development (dev toolchain)\n\n1. Enter the `dev/` folder: `cd dev`.\n2. Run `make dev` to launch PostgreSQL + Redis + `bun dev` in one command.\n3. Helpful targets:\n   - `make db`: start only database and Redis.\n   - `make logs` / `make logs-app`: tail all services or app logs.\n   - `make clean` / `make reset`: clean or fully reset the environment.\n4. Use `make migrate` and `make db-shell` for schema operations.\n\n### Manual deployment (bun build + start)\n\n1. Install dependencies and build:\n   ```bash\n   bun install\n   bun run build      # Copies the VERSION file automatically\n   ```\n2. Export environment variables via your process manager (systemd, PM2, etc.) and ensure PostgreSQL/Redis endpoints are reachable.\n3. Launch production server:\n   ```bash\n   bun run start\n   ```\n4. You may keep `AUTO_MIGRATE=true` for the first run, then disable it and manage migrations explicitly with Drizzle CLI.\n\n## ⚙️ Configuration\n\n| Variable                                   | Default                  | Description                                                                                          |\n| ------------------------------------------ | ------------------------ | ---------------------------------------------------------------------------------------------------- |\n| `ADMIN_TOKEN`                              | `change-me`              | Admin console token — must be updated before deployment.                                             |\n| `DSN`                                      | -                        | PostgreSQL connection string, e.g., `postgres://user:pass@host:5432/db`.                             |\n| `AUTO_MIGRATE`                             | `true`                   | Executes Drizzle migrations on startup; consider disabling in production for manual control.         |\n| `REDIS_URL`                                | `redis://localhost:6379` | Redis endpoint, supports `rediss://` for TLS providers.                                              |\n| `REDIS_TLS_REJECT_UNAUTHORIZED`            | `true`                   | Validate Redis TLS certificates; set `false` to skip (for self-signed/shared certs).                 |\n| `ENABLE_RATE_LIMIT`                        | `true`                   | Toggles multi-dimensional rate limiting; Fail-Open handles Redis outages gracefully.                 |\n| `ENABLE_API_KEY_VACUUM_FILTER`             | `true`                   | Enables API Key Vacuum Filter (negative short-circuit only; set to `false/0` to disable).            |\n| `ENABLE_API_KEY_REDIS_CACHE`               | `true`                   | Enables API Key auth Redis cache (requires Redis; auto-fallback to DB on errors).                    |\n| `API_KEY_AUTH_CACHE_TTL_SECONDS`           | `60`                     | API Key auth cache TTL in seconds (default 60, max 3600).                                             |\n| `SESSION_TTL`                              | `300`                    | Session cache window (seconds) that drives vendor reuse.                                             |\n| `ENABLE_SECURE_COOKIES`                    | `true`                   | Browsers require HTTPS for Secure cookies; set to `false` when serving plain HTTP outside localhost. |\n| `ENABLE_CIRCUIT_BREAKER_ON_NETWORK_ERRORS` | `false`                  | When `true`, network errors also trip the circuit breaker for quicker isolation.                     |\n| `APP_PORT`                                 | `23000`                  | Production port (override via container or process manager).                                         |\n| `APP_URL`                                  | empty                    | Populate to expose correct `servers` entries in OpenAPI docs.                                        |\n| `API_TEST_TIMEOUT_MS`                      | `15000`                  | Timeout (ms) for provider API connectivity tests. Accepts 5000-120000 for regional tuning.           |\n\n\u003e Boolean values support `true/false` or `1/0`. Quoting in `.env` is also fine (dotenv will strip quotes). See `.env.example` for the full list.\n\n## ❓ FAQ\n\n1. **Database connection failures**\n   - Verify the `DSN` format and credentials; use service names (e.g., `postgres:5432`) within Docker.\n   - Inspect `docker compose ps` or local PostgreSQL status, and use `make db-shell` for deeper checks.\n\n2. **What if Redis goes offline?**\n   - The platform uses a fail-open policy: rate limiting and session metrics degrade gracefully while requests continue flowing. Monitor logs for Redis errors and restore the service asap.\n\n3. **Circuit breaker keeps opening**\n   - Inspect `[CircuitBreaker]` logs to see whether repeated 4xx/5xx or network errors triggered it.\n   - Check provider health in the admin console and wait 30 minutes or restart the app to reset state.\n\n4. **“No provider available” errors**\n   - Ensure providers are enabled, have reasonable weights/priorities, and haven’t hit concurrency or spend caps.\n   - Review the decision-chain log to confirm whether breakers or proxy failures removed them.\n\n5. **Proxy configuration issues**\n   - Make sure URLs include a protocol (`http://`, `socks5://`, etc.) and validate via the “Test Connection” button in the UI.\n   - If `proxy_fallback_to_direct` is enabled, confirm via logs that the system retried without the proxy when failures occur.\n\n## 🤝 Contributing\n\nWe welcome issues and PRs! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for the bilingual guidelines, branch strategy, and Conventional Commits requirements before submitting changes.\n\n## 🌐 Acknowledgments\n\nThis project builds on [zsio/claude-code-hub](https://github.com/zsio/claude-code-hub), references [router-for-me/CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) for the OpenAI-compatible layer, and [prehisle/relay-pulse](https://github.com/prehisle/relay-pulse) for provider detection functionality. Huge thanks to the original authors and community contributors!\n\n## ⭐ Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=ding113/claude-code-hub\u0026type=Date)](https://star-history.com/#ding113/claude-code-hub\u0026Date)\n\n## 📜 License\n\nReleased under the [MIT License](LICENSE). You’re welcome to use and extend the project as long as you comply with the license and retain the attribution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fding113%2Fclaude-code-hub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fding113%2Fclaude-code-hub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fding113%2Fclaude-code-hub/lists"}