by Wei-Shaw
CRS-自建Claude Code镜像,一站式开源中转服务,让 Claude、OpenAI、Gemini、Droid 订阅统一接入,支持拼车共享,更高效分摊成本,原生工具无缝使用。
# Add to your Claude Code skills
git clone https://github.com/Wei-Shaw/claude-relay-serviceGuides for using cli tools skills like claude-relay-service.
Last scanned: 4/17/2026
{
"issues": [
{
"type": "npm-audit",
"message": "@aws-sdk/client-bedrock-runtime: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/client-cognito-identity: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/client-sso: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/core: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/credential-provider-cognito-identity: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/credential-provider-env: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/credential-provider-http: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/credential-provider-ini: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/credential-provider-node: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/credential-provider-process: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/credential-provider-sso: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/credential-provider-web-identity: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/credential-providers: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/middleware-user-agent: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/nested-clients: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/token-providers: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@aws-sdk/util-user-agent-node: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "@smithy/config-resolver: AWS SDK for JavaScript v3 adopted defense in depth enhancement for region parameter value",
"severity": "low"
},
{
"type": "npm-audit",
"message": "ajv: ajv has ReDoS when using `$data` option",
"severity": "medium"
},
{
"type": "npm-audit",
"message": "axios: Axios is vulnerable to DoS attack through lack of data size check",
"severity": "high"
},
{
"type": "npm-audit",
"message": "body-parser: Vulnerability found",
"severity": "low"
},
{
"type": "npm-audit",
"message": "brace-expansion: brace-expansion: Zero-step sequence causes process hang and memory exhaustion",
"severity": "medium"
},
{
"type": "npm-audit",
"message": "express: Vulnerability found",
"severity": "high"
},
{
"type": "npm-audit",
"message": "fast-xml-parser: fast-xml-parser has RangeError DoS Numeric Entities Bug",
"severity": "critical"
},
{
"type": "npm-audit",
"message": "flatted: flatted vulnerable to unbounded recursion DoS in parse() revive phase",
"severity": "high"
},
{
"type": "npm-audit",
"message": "follow-redirects: follow-redirects leaks Custom Authentication Headers to Cross-Domain Redirect Targets",
"severity": "medium"
},
{
"type": "npm-audit",
"message": "js-yaml: js-yaml has prototype pollution in merge (<<)",
"severity": "medium"
},
{
"type": "npm-audit",
"message": "jws: auth0/node-jws Improperly Verifies HMAC Signature",
"severity": "high"
},
{
"type": "npm-audit",
"message": "lodash: Lodash has Prototype Pollution Vulnerability in `_.unset` and `_.omit` functions",
"severity": "high"
},
{
"type": "npm-audit",
"message": "minimatch: minimatch has a ReDoS via repeated wildcards with non-matching literal in pattern",
"severity": "high"
},
{
"type": "npm-audit",
"message": "nodemailer: Nodemailer: Email to an unintended domain can occur due to Interpretation Conflict",
"severity": "high"
},
{
"type": "npm-audit",
"message": "path-to-regexp: path-to-regexp vulnerable to Regular Expression Denial of Service via multiple route parameters",
"severity": "high"
},
{
"type": "npm-audit",
"message": "picomatch: Picomatch: Method Injection in POSIX Character Classes causes incorrect Glob Matching",
"severity": "high"
},
{
"type": "npm-audit",
"message": "qs: qs's arrayLimit bypass in comma parsing allows denial of service",
"severity": "medium"
}
],
"status": "FAILED",
"scannedAt": "2026-04-17T06:06:30.807Z",
"semgrepRan": false,
"npmAuditRan": true,
"pipAuditRan": true
}claude-relay-service is an open-source cli tools skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by Wei-Shaw. CRS-自建Claude Code镜像,一站式开源中转服务,让 Claude、OpenAI、Gemini、Droid 订阅统一接入,支持拼车共享,更高效分摊成本,原生工具无缝使用。. It has 12,341 GitHub stars.
claude-relay-service failed SkillsLLM's automated security scan, which flagged one or more high-severity issues. Review the Security Report section carefully before using it.
Clone the repository with "git clone https://github.com/Wei-Shaw/claude-relay-service" and add it to your Claude Code skills directory (see the Installation section above).
claude-relay-service is primarily written in JavaScript. It is open-source under Wei-Shaw on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other CLI Tools skills you can browse and compare side by side. Open the CLI Tools category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh claude-relay-service against similar tools.
No comments yet. Be the first to share your thoughts!
Top skills in this category by stars
Based on votes and bookmarks from developers who liked this skill
Requires a passing catalog security scan. Resolve the flagged issues and resubmit to enable featuring.
[!CAUTION] 安全更新通知:v1.1.248 及以下版本存在严重的管理员认证绕过漏洞,攻击者可未授权访问管理面板。
请立即更新到 v1.1.249+ 版本,或迁移到新一代项目 CRS 2.0 (sub2api)
🔐 自行搭建Claude API中转服务,支持多账户管理
使用本项目前请仔细阅读:
🚨 服务条款风险: 使用本项目可能违反Anthropic的服务条款。请在使用前仔细阅读Anthropic的用户协议,使用本项目的一切风险由用户自行承担。
📖 免责声明: 本项目仅供技术学习和研究使用,作者不对因使用本项目导致的账户封禁、服务中断或其他损失承担任何责任。
如果有以上困惑,那这个项目可能适合你。
✅ 找朋友拼车: 三五好友一起分摊Claude Code Max订阅
✅ 隐私敏感: 不想让第三方镜像看到你的对话内容
✅ 技术折腾: 有基本的技术基础,愿意自己搭建和维护
✅ 稳定需求: 需要长期稳定的Claude访问,不想受制于镜像站
✅ 地区受限: 无法直接访问Claude官方服务
推荐使用管理脚本进行一键部署,简单快捷,自动处理所有依赖和配置。
curl -fsSL https://pincc.ai/manage.sh -o manage.sh && chmod +x manage.sh && ./manage.sh install
crs 命令随时管理服务状态crs install # 安装服务
crs start # 启动服务
crs stop # 停止服务
crs restart # 重启服务
crs status # 查看状态
crs update # 更新服务
crs uninstall # 卸载服务
$ crs install
# 会依次询问:
安装目录 (默认: ~/claude-relay-service):
服务端口 (默认: 3000): 8080
Redis 地址 (默认: localhost):
Redis 端口 (默认: 6379):
Redis 密码 (默认: 无密码):
# 安装完成后自动启动并显示:
服务已成功安装并启动!
访问地址:
本地 Web: http://localhost:8080/web
公网 Web: http://YOUR_IP:8080/web
管理员账号信息已保存到: data/init.json
Ubuntu/Debian用户:
# 安装Node.js
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# 安装Redis
sudo apt update
sudo apt install redis-server
sudo systemctl start redis-server
CentOS/RHEL用户:
# 安装Node.js
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
sudo yum install -y nodejs
# 安装Redis
sudo yum install redis
sudo systemctl start redis
# 下载项目
git clone https://github.com/Wei-Shaw//claude-relay-service.git
cd claude-relay-service
# 安装依赖
npm install
# 复制配置文件(重要!)
cp config/config.example.js config/config.js
cp .env.example .env
编辑 .env 文件:
# 这两个密钥随便生成,但要记住
JWT_SECRET=你的超级秘密密钥
ENCRYPTION_KEY=32位的加密密钥随便写
# Redis配置
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
编辑 config/config.js 文件:
module.exports = {
server: {
port: 3000, // 服务端口,可以改
host: '0.0.0.0' // 不用改
},
redis: {
host: '127.0.0.1', // Redis地址
port: 6379 // Redis端口
}
// 其他配置保持默认就行
}
# 安装前端依赖
npm run install:web
# 构建前端(生成 dist 目录)
npm run build:web
# 初始化
npm run setup # 会随机生成后台账号密码信息,存储在 data/init.json
# 或者通过环境变量预设管理员凭据:
# export ADMIN_USERNAME=cr_admin_custom
# export ADMIN_PASSWORD=your-secure-password
# 启动服务
npm run service:start:daemon # 后台运行
# 查看状态
npm run service:status
curl -fsSL https://pincc.ai/crs-compose.sh -o crs-compose.sh && chmod +x crs-compose.sh && ./crs-compose.sh
docker-compose up -d
docker-compose.yml 已包含:
JWT_SECRET: JWT密钥,至少32个字符ENCRYPTION_KEY: 加密密钥,必须是32个字符ADMIN_USERNAME: 管理员用户名(不设置则自动生成)ADMIN_PASSWORD: 管理员密码(不设置则自动生成)LOG_LEVEL: 日志级别(默认:info).env.example 文件查看容器日志
docker logs claude-relay-service
查看挂载的文件
cat ./data/init.json
使用环境变量预设
# 在 .env 文件中设置
ADMIN_USERNAME=cr_admin_custom
ADMIN_PASSWORD=your-secure-password
浏览器访问:http://你的服务器IP:3000/web
管理员账号:
docker logs claude-relay-service这一步比较关键,需要OAuth授权:
注意: 如果你在国内,这一步可能需要科学上网。
系统会在上游异常时临时暂停账号路由,默认由全局配置控制(见 .env.example):
UPSTREAM_ERROR_503_TTL_SECONDSUPSTREAM_ERROR_5XX_TTL_SECONDSUPSTREAM_ERROR_OVERLOAD_TTL_SECONDSUPSTREAM_ERROR_AUTH_TTL_SECONDSUPSTREAM_ERROR_TIMEOUT_TTL_SECONDS在管理后台编辑 Claude 官方 OAuth 账号 时,可做账号级覆盖:
禁用该账号临时冷却:该账号不再因 503/5xx 进入临时暂停503 冷却秒数:留空=跟随全局,0=关闭该账号 503 冷却5xx 冷却秒数:留空=跟随全局,0=关闭该账号 5xx 冷却优先级从高到低:
账户列表会显示“不可路由原因”,包含错误类型、HTTP 状态码、内部冷却总时长、剩余时间和预计恢复时间;点击 重置状态 可清除异常状态并恢复参与路由。
给每个使用者分配一个Key:
现在你可以用自己的服务替换官方API了:
Claude Code 设置环境变量:
使用标准 Claude 账号池
默认使用标准 Claude 账号池:
export ANTHROPIC_BASE_URL="http://127.0.0.1:3000/api/" # 根据实际填写你服务器的ip地址或者域名
export ANTHROPIC_AUTH_TOKEN="后台创建的API密钥"
使用 Antigravity 账户池
适用于通过 Antigravity 渠道使用 Claude 模型(如 claude-opus-4-5 等)。
# 1. 设置 Base URL 为 Antigravity 专用路径
export ANTHROPIC_BASE_URL="http://127.0.0.1:3000/antigravity/api/"
# 2. 设置 API Key(在后台创建,权限需包含 'all' 或 'gemini')
export ANTHROPIC_AUTH_TOKEN="后台创建的API密钥"
# 3. 指定模型名称(直接使用短名,无需前缀!)
export ANTHROPIC_MODEL="claude-opus-4-5"
# 4. 启动
claude
VSCode Claude 插件配置:
如果使用 VSCode 的 Claude 插件,需要在 ~/.claude/config.json 文件中配置:
{
"primaryApiKey": "crs"
}
如果该文件不存在,请手动创建。Windows 用户路径为 C:\Users\你的用户名\.claude\config.json。
💡 IntelliJ IDEA 用户推荐:Claude Code Plus - 将 Claude Code 直接集成到 IDE,支持代码理解、文件读写、命令执行。插件市场搜索
Claude Code Plus即可安装。
Gemini CLI 设置环境变量:
方式一(推荐):通过 Gemini Assist API 方式访问
CODE_ASSIST_ENDPOINT="http://127.0.0.1:3000/gemini" # 根据实际填写你服务器的ip地址或者域名
GOOGLE_CLOUD_ACCESS_TOKEN="后台创建的API密钥"
GOOGLE_GENAI_USE_GCA="true"
GEMINI_MODEL="gemini-2.5-pro" # 如果你有gemini3权限可以填: gemini-3-pro-preview
认证:只能选
Login with Google进行认证,如果跳 Google请删除~/.gemini/settings.json后再尝试启动gemini。
注意:gemini-cli 控制台会提示Failed to fetch user info: 401 Unauthorized,但使用不受任何影响。
方式二:通过 Gemini API 方式访问
GOOGLE_GEMINI_BASE_URL="http://127.0.0.1:3000/gemini" # 根据实际填写你服务器的ip地址或者域名
GEMINI_API_KEY="后台创建的API密钥"
GEMINI_MODEL="gemini-2.5-pro" # 如果你有gemini3权限可以填: gemini-3-pro-preview
认证:只能选
Use Gemini API Key进行认证,如果提示Enter Gemini API Key请直接留空按回车。如果一打开就跳 Google请删除~/.gemini/settings.json后再尝试启动gemini。
💡 进阶用法:想在 Claude Code 中直接使用 Gemini 3 模型?请参考 Claude Code 调用 Gemini 3 模型指南
使用 Claude Code:
claude
使用 Gemini CLI:
gemini # 或其他 Gemini CLI 命令
Codex 配置:
在 ~/.codex/config.toml 文件开头添加以下配置:
model_provider = "crs"
model = "gpt-5.5"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.crs]
name = "crs"
base_url = "http://127.0.0.1:3000/openai" # 根据实际填写你服务器的ip地址或者域名
wire_api = "responses"
requires_openai_auth = true
在 ~/.codex/auth.json 文件中配置API密钥为 null:
{
"OPENAI_API_KEY": "后台创建的API密钥"
}
⚠️ 在通过 Nginx 反向代理 CRS 服务并使用 Codex CLI 时,需要在 http 块中添加 underscores_in_headers on;。因为 Nginx 默认会移除带下划线的请求头(如 session_id),一旦该头被丢弃,多账号环境下的粘性会话功能将失效。
Droid CLI 配置:
Droid CLI 读取 ~/.factory/config.json。可以在该文件中添加自定义模型以指向本服务的新端点:
{
"cu