mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 08:32:17 +00:00
v1.1.253
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)
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:
thoughtSignaturefallback + cache, tool_result passthrough, and message ordering fixes. - Antigravity OAuth: account type
gemini-antigravitywith 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)
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)
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://<host>:3000/web - Initial credentials: generated by
npm run setupand saved todata/init.json(Docker users can also inspect container logs).
Using with Claude Code (CLI)
Antigravity pool (recommended)
export ANTHROPIC_BASE_URL="http://<host>:3000/antigravity/api/"
export ANTHROPIC_AUTH_TOKEN="cr_xxxxxxxxxxxx"
export ANTHROPIC_MODEL="claude-opus-4-5"
claude
Gemini pool
export ANTHROPIC_BASE_URL="http://<host>:3000/gemini-cli/api/"
export ANTHROPIC_AUTH_TOKEN="cr_xxxxxxxxxxxx"
export ANTHROPIC_MODEL="gemini-2.5-pro"
claude
Standard Claude pool
export ANTHROPIC_BASE_URL="http://<host>: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 AntigravityfetchAvailableModels) - OpenAI-compatible routing:
GET /openai/gemini/models(orGET /openai/gemini/v1/models)
- Anthropic/Claude Code routing:
Debug Dumps (optional)
See .env.example for the full list. Common toggles:
ANTHROPIC_DEBUG_REQUEST_DUMP=trueANTHROPIC_DEBUG_RESPONSE_DUMP=trueANTIGRAVITY_DEBUG_UPSTREAM_REQUEST_DUMP=trueANTIGRAVITY_DEBUG_UPSTREAM_RESPONSE_DUMP=trueDUMP_MAX_FILE_SIZE_BYTES=10485760
License
This project is licensed under the MIT License.
Languages
JavaScript
61.8%
Vue
35.7%
Shell
1.7%
CSS
0.6%
Makefile
0.1%