Files
claude-relay-service/README_EN.md
52227 3cc3219a90 docs: 更新中英文 README,完善模型配额查询与 Claude Code 适配说明
- 新增 Antigravity 账户额度与模型列表查询指南
- 完善 Claude Code 兼容性特性说明 (Thinking Signature, Zombie Stream Watchdog)
- 移除无关广告信息,优化文档结构
- 明确二开维护者信息
2026-01-05 23:07:04 +08:00

119 lines
2.9 KiB
Markdown

# Claude Relay Service (Antigravity Edition)
Maintained fork by **dadongwo**.
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://<host>: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://<host>: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://<host>: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://<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 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).