# Claude Relay Service (Antigravity Edition) > [!CAUTION] > **Security Update**: v1.1.248 and below contain a critical admin authentication bypass vulnerability allowing unauthorized access to the admin panel. > > **Please update to v1.1.249+ immediately**, or migrate to the next-generation project **[CRS 2.0 (sub2api)](https://github.com/Wei-Shaw/sub2api)**
This fork focuses on: - Native compatibility for `claude` (Claude Code CLI) - Antigravity OAuth integration + path-based routing - Better stability for streaming (SSE) workloads - Optional request/response dumps for debugging --- ## Highlights - **Claude Code protocol compatibility**: `thoughtSignature` fallback + cache, tool_result passthrough, and message ordering fixes. - **Antigravity OAuth**: account type `gemini-antigravity` with permission checks. - **Path-based routing (Anthropic Messages API)**: - `/api` -> Claude account pool (default) - `/antigravity/api` -> Antigravity OAuth account pool - `/gemini-cli/api` -> Gemini OAuth account pool - **Stability**: - Zombie stream watchdog (disconnect after 45s without valid data) - Auto retry + account switching for Antigravity `429 Resource Exhausted` (streaming and non-streaming) - **Observability**: JSONL dumps for request/response/tools/upstream (with size limit + rotation) --- ## Quick Start ### Requirements - Node.js 18+ (or Docker) - Redis 6+/7+ ### Docker Compose (recommended) ```bash cp .env.example .env cp config/config.example.js config/config.js # Edit .env at least: # JWT_SECRET=... (random string) # ENCRYPTION_KEY=... (32-char random string) docker-compose up -d ``` ### Node (no Docker) ```bash npm install cp .env.example .env cp config/config.example.js config/config.js npm run setup npm run service:start:daemon ``` ### Admin UI - URL: `http://:3000/web` - Initial credentials: generated by `npm run setup` and saved to `data/init.json` (Docker users can also inspect container logs). --- ## Using with Claude Code (CLI) ### Antigravity pool (recommended) ```bash export ANTHROPIC_BASE_URL="http://:3000/antigravity/api/" export ANTHROPIC_AUTH_TOKEN="cr_xxxxxxxxxxxx" export ANTHROPIC_MODEL="claude-opus-4-5" claude ``` ### Gemini pool ```bash export ANTHROPIC_BASE_URL="http://:3000/gemini-cli/api/" export ANTHROPIC_AUTH_TOKEN="cr_xxxxxxxxxxxx" export ANTHROPIC_MODEL="gemini-2.5-pro" claude ``` ### Standard Claude pool ```bash export ANTHROPIC_BASE_URL="http://:3000/api/" export ANTHROPIC_AUTH_TOKEN="cr_xxxxxxxxxxxx" claude ``` --- ## Antigravity Quota & Models - Quota display: in Admin UI -> Accounts -> `gemini-antigravity` -> click **Test/Refresh**. - Dynamic models list: - Anthropic/Claude Code routing: `GET /antigravity/api/v1/models` (proxies Antigravity `fetchAvailableModels`) - OpenAI-compatible routing: `GET /openai/gemini/models` (or `GET /openai/gemini/v1/models`) --- ## Debug Dumps (optional) See `.env.example` for the full list. Common toggles: - `ANTHROPIC_DEBUG_REQUEST_DUMP=true` - `ANTHROPIC_DEBUG_RESPONSE_DUMP=true` - `ANTIGRAVITY_DEBUG_UPSTREAM_REQUEST_DUMP=true` - `ANTIGRAVITY_DEBUG_UPSTREAM_RESPONSE_DUMP=true` - `DUMP_MAX_FILE_SIZE_BYTES=10485760` --- ## License This project is licensed under the [MIT License](LICENSE).