Skip to content

ink1ing/anti-api

Repository files navigation

Anti-API

The fastest and best local API proxy service! Convert Antigravity's top AI models to OpenAI/Anthropic compatible API

中文说明 | Features | Quick Start | Architecture

Anti-API Demo


Disclaimer: This project is based on reverse engineering of Antigravity. Future compatibility is not guaranteed. For long-term use, avoid updating Antigravity.

What's New (v3.0.0)

  • Kiro provider support - Added Kiro account import, quota visibility, model routing, and reverse-proxy support alongside existing providers
  • Dashboard i18n - Added global Chinese support, system-language default detection, and a Settings language switch
  • Account diagnostics assistant - Added a localhost-only diagnostics panel for checking missing account files, CLI tools, callback ports, and provider setup
  • Panel updates - Added a localhost-only update checker and source-install updater, with package-manager safeguards for Homebrew, WinGet, and Docker
  • Docker support hardened - Updated Docker defaults, OAuth port ranges, health checks, development compose separation, and Docker-specific update guidance
v2.9.0
  • Stable Homebrew package - Homebrew now installs a prebuilt macOS Apple Silicon bundle, so brew install anti-api no longer depends on local Rust, LLVM, or Bun downloads
  • WinGet distribution pipeline - Added Windows portable packaging, WinGet manifest generation, and release workflow for winget install anti-api
  • Unified launcher behavior - Homebrew and WinGet installs now share the same contract: anti-api starts the service directly in any terminal
  • Portable runtime support - Added a Windows portable entrypoint that starts the Rust proxy, serves the bundled dashboard files, and avoids package-manager self-update conflicts
  • Package-manager safeguards - Homebrew/WinGet installs now redirect updates to brew upgrade anti-api and winget upgrade anti-api instead of self-overwriting
v2.8.0
  • Zed hosted-model support - Anti-API can now import the current Zed.app login state and route requests to Zed-hosted models
  • Per-account dynamic model fetch - Routing fetches live models from each available Codex and Copilot account, and now includes Zed account-level model sync
  • Zed account behavior clarified - Zed accounts can be imported one by one and kept in Anti-API, but they cannot be bulk auto-discovered like Codex/Copilot
  • Zed quota widget updated - The Zed card now shows shared all-model support status and billing-period timing instead of misleading remaining-credit percentages
  • Zed stability hardening - Added request timeouts and success-state recovery for Zed account fetch, model sync, and completion requests
v2.7.1
  • Per-account model fetch (Routing) - Model lists are now fetched from each logged-in Codex/Copilot account instead of relying on static presets
  • Antigravity fetch integration (single account) - Routing now attempts live model fetch from the first available Antigravity account and falls back safely when unavailable
  • Account-level model map in /routing/config - Added accountModels so the UI can render account-specific model lists directly
  • Routing panel model rendering update - Account cards now show models from fetched account-level data first, then fallback models
v2.7.0
  • Antigravity proxy notice - Google has officially prohibited reverse-proxy usage of its AI services. The Antigravity reverse proxy still works for now but is no longer recommended
  • Codex & Copilot unaffected - Reverse-proxy services for Codex and GitHub Copilot remain fully functional and are not subject to the restriction above
  • Log IDE Out - New one-click action to sign out of the Antigravity IDE (closes the IDE, clears auth, ready for a different account)
v2.6.2
  • Per-request log context isolation - Error logs no longer mix model/account under concurrency
  • Copilot TLS hardening - Default TLS verification restored; optional ANTI_API_COPILOT_INSECURE_TLS=1 for restricted networks
  • Codex TLS hardening - Default TLS verification restored; optional ANTI_API_CODEX_INSECURE_TLS=1 for restricted networks
  • Routing config resilience - Soft timeouts and caching for Copilot model sync and quota aggregation
  • Dynamic model sync - Routing now syncs Codex/Copilot model lists from authenticated accounts with static fallback
  • Test baseline fixes - bun test ./test avoids legacy folders; updated mocks and default settings

Features

  • Flow + Account Routing - Custom flows for non-official models, account chains for official models
  • Five Providers - Antigravity, Codex, GitHub Copilot, Zed hosted models, and Kiro
  • Remote Access - ngrok/cloudflared/localtunnel with one-click setup
  • Full Dashboard - Quota monitoring, routing config, settings panel
  • Auto-Rotation - Account switching on 429 errors
  • Dual Format - OpenAI and Anthropic API compatible
  • Tool Calling - Function calling for Claude Code and CLI tools

Zed Account Notes

  • Import model - Anti-API reads the currently signed-in Zed.app account from macOS Keychain when you click Add Account -> Zed
  • Why it differs from Codex/Copilot - Zed does not expose multiple local auth files that can be scanned in bulk; the local desktop state is effectively a single current login
  • What multi-account means for Zed here - You can switch accounts inside Zed and import them one at a time into Anti-API; imported Zed accounts remain stored in Anti-API afterwards
  • What is not supported - Automatic bulk discovery of many Zed accounts from one machine is not available in the same way as Codex/Copilot
  • Quota monitor behavior - Zed hosted models share one monthly spend pool across the account. Anti-API currently shows hosted access status and billing period, not exact remaining dollar credits
  • Credit note - Zed plan credit depends on the plan type. For example, Zed Student is documented by Zed as including $10/month in AI token credits, while standard Pro pages may show different included credit values

Free Gemini Pro Access

Two free methods to get one year of Gemini Pro:

Method 1: Telegram Bot (Quick and stable, one-time free) https://t.me/sheeridverifier_bot

Method 2: @pastking's Public Service (Unlimited, requires learning) https://batch.1key.me

Quick Start

Homebrew (macOS Apple Silicon)

# Add the tap
brew tap ink1ing/anti-api

# Install Anti-API
brew install anti-api

# Start Anti-API directly from any terminal
anti-api

Notes:

  • This formula installs a prebuilt macOS Apple Silicon bundle. It does not download Rust, LLVM, or Bun at install time.
  • Upgrade with brew upgrade anti-api.
  • bun run brew:formula is a maintainer command that refreshes Formula/anti-api.rb for the current tagged release.
  • bun run brew:bundle is a maintainer command that builds the release asset consumed by Homebrew.
  • anti-api --update is intentionally disabled for Homebrew-managed installs so Homebrew remains the source of truth.
  • After installation, anti-api starts the service directly in any terminal.

Linux

# Install dependencies
bun install

# Start server (default port: 8964)
bun run src/main.ts start

Windows

Double-click start.bat to launch.

WinGet packaging is prepared in this repository. After the winget-pkgs submission is merged, the install path will be:

winget install anti-api
anti-api

After installation, anti-api starts the service directly in any terminal.

macOS

Double-click start.command to launch.

Docker

Build:

docker build -t anti-api .

Run:

docker run --rm -it \\
  -p 8964:8964 \\
  -p 1455-1465:1455-1465 \\
  -p 51121-51131:51121-51131 \\
  -e ANTI_API_DATA_DIR=/app/data \\
  -e ANTI_API_NO_OPEN=1 \\
  -e ANTI_API_OAUTH_NO_OPEN=1 \\
  -e ANTI_API_PACKAGE_MANAGER=docker \\
  -e ANTI_API_NO_SELF_UPDATE=1 \\
  -v $HOME/.anti-api:/app/data \\
  anti-api

Compose:

docker compose up --build

Developer override (no rebuild, use local src/ and public/):

docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d --no-build

Notes:

  • OAuth callbacks use ports 51121-51131 for Antigravity and 1455-1465 for Codex browser OAuth. Make sure they are mapped.
  • If running on a remote host, set ANTI_API_OAUTH_REDIRECT_URL to a public URL like http://YOUR_HOST:51121/oauth-callback.
  • The bind mount reuses your local ~/.anti-api data so Docker shares the same accounts and routing config.
  • Local-import providers cannot see host credentials unless you mount them into /app/data (see commented examples in docker-compose.yml for .codex, .cli-proxy-api, .aws, Kiro CLI, and Amazon Q).
  • Set ANTI_API_NO_OPEN=1 to avoid trying to open the browser inside a container.
  • In-panel self-update is disabled in Docker. Rebuild or pull the image with docker compose up -d --build.
  • If Copilot TLS fails in restricted networks, set ANTI_API_COPILOT_INSECURE_TLS=1 (not recommended for general use).
  • If Codex TLS fails in restricted networks, set ANTI_API_CODEX_INSECURE_TLS=1 (not recommended for general use).
  • Set Codex default reasoning effort with ANTI_API_CODEX_REASONING_EFFORT=low|medium|high (default: medium).
  • If Docker Hub is unstable, the default base image uses GHCR. You can override with BUN_IMAGE=oven/bun:1.3.5.
  • ngrok is installed in the image for Linux amd64/arm64.

Development

  • Formatting: follow .editorconfig (4-space indent, LF).
  • Tests: bun test
  • Contributing: see docs/CONTRIBUTING.md

Claude Code Configuration

Add to ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "http://localhost:8964",
    "ANTHROPIC_AUTH_TOKEN": "any-value"
  }
}

Remote Access

Access the tunnel control panel at http://localhost:8964/remote-panel

Supported tunnels:

  • ngrok - Requires authtoken from ngrok.com
  • cloudflared - Cloudflare Tunnel, no account required, high network requirements
  • localtunnel - Open source, no account required, less stable

Architecture

┌─────────────────────────────────────────────────────────────┐
│                      Anti-API (Port 8964)                   │
├─────────────────────────────────────────────────────────────┤
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐      │
│  │  Dashboard   │  │   Routing    │  │   Settings   │      │
│  │   /quota     │  │   /routing   │  │   /settings  │      │
│  └──────────────┘  └──────────────┘  └──────────────┘      │
│                                                              │
│  ┌──────────────────────────────────────────────────────┐  │
│  │              Smart Routing System                     │  │
│  │  • Flow Routing (custom model IDs)                    │  │
│  │  • Account Routing (official model IDs)               │  │
│  │  • Auto-rotation on 429 errors                        │  │
│  │  • Multi-provider support                             │  │
│  └──────────────────────────────────────────────────────┘  │
│                           ▼                                  │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐      │
│  │ Antigravity  │  │    Codex     │  │   Copilot    │      │
│  │   Provider   │  │   Provider   │  │   Provider   │      │
│  └──────────────┘  └──────────────┘  └──────────────┘      │
│  ┌──────────────┐                                        │
│  │     Zed      │                                        │
│  │   Provider   │                                        │
│  └──────────────┘                                        │
└─────────────────────────────────────────────────────────────┘
                           ▼
              ┌──────────────────────────┐
              │   Upstream Cloud APIs    │
              │ (Google, OpenAI, GitHub, Zed) │
              └──────────────────────────┘

Smart Routing System (Beta)

Beta Feature: Routing is experimental. Configuration may change in future versions.

The routing system is split into two modes:

  • Flow Routing: Custom model IDs (e.g. route:fast) use your flow entries.
  • Account Routing: Official model IDs (e.g. claude-sonnet-4-5) use per-model account chains.

This enables fine-grained control over model-to-account mapping, allowing you to:

  • Load Balance: Distribute requests across multiple accounts
  • Model Specialization: Route specific models to dedicated accounts
  • Provider Mixing: Combine Antigravity, Codex, GitHub Copilot, and Zed in custom flows
  • Fallback Chains: Automatic failover when primary accounts hit rate limits

How It Works

Request
  ├─ Official model → Account Routing → Account chain → Provider → Upstream API
  └─ Custom model/route:flow → Flow Routing → Flow entries → Provider → Upstream API

No match → 400 error

Configuration

  1. Access Panel: http://localhost:8964/routing
  2. Flow Routing: Create a flow (e.g., "fast", "opus"), add Provider → Account → Model entries
  3. Account Routing: Choose an official model, set account order, optionally enable Smart Switch
  4. Use Flow: Set model to route:<flow-name> or the flow name directly
  5. Use Official Model: Request the official model ID directly (e.g., claude-sonnet-4-5)

Example Request:

{
  "model": "route:fast",
  "messages": [{"role": "user", "content": "Hello"}]
}

Flow Priority: Entries are tried in order. If an account hits 429, the next entry is used. Account Routing: If Smart Switch is on and no explicit entries exist, it expands to all supporting accounts in creation order.


Remote Access

Expose your local Anti-API to the internet for cross-device access. Useful for:

  • Mobile Development: Test AI integrations on iOS/Android
  • Team Sharing: Share your quota with teammates
  • External Tools: Connect AI tools that require public URLs

Supported Tunnels

Tunnel Account Required Stability Speed
ngrok Yes (free tier) Best Fast
cloudflared No Good Medium
localtunnel No Fair Slow

Setup

  1. Access Panel: http://localhost:8964/remote-panel
  2. Configure (ngrok only): Enter your authtoken from ngrok.com
  3. Start Tunnel: Click Start, wait for public URL
  4. Use Remote URL: Replace localhost:8964 with the tunnel URL

Security Note: Anyone with your tunnel URL can access your API. Keep it private.

Settings Panel

Configure application behavior at http://localhost:8964/settings:

  • Auto-open Dashboard: Open quota panel on startup
  • Auto-start ngrok: Start tunnel automatically
  • Model Preferences: Set default models for background tasks

Supported Models

Antigravity

Model ID Description
claude-sonnet-4-5 Fast, balanced
claude-sonnet-4-5-thinking Extended reasoning
claude-opus-4-5-thinking Most capable
claude-opus-4-6-thinking Most capable (new generation)
gemini-3-flash Fastest responses
gemini-3-pro-high High quality
gemini-3-pro-low Cost-effective
gpt-oss-120b Open source

GitHub Copilot

Model ID Description
claude-opus-4-5-thinking Opus via Copilot
claude-sonnet-4-5 Sonnet via Copilot
gpt-4o GPT-4o
gpt-4o-mini GPT-4o Mini
gpt-4.1 GPT-4.1
gpt-4.1-mini GPT-4.1 Mini

ChatGPT Codex

Model ID Description
gpt-5.3-max-high 5.3 Max (High)
gpt-5.3-max 5.3 Max
gpt-5.3 5.3
gpt-5.3-codex 5.3 Codex
gpt-5.2-max-high 5.2 Max (High)
gpt-5.2-max 5.2 Max
gpt-5.2 5.2
gpt-5.2-codex 5.2 Codex
gpt-5.1 5.1
gpt-5.1-codex 5.1 Codex
gpt-5 5

Codex reasoning effort support:

  • Global default: ANTI_API_CODEX_REASONING_EFFORT=low|medium|high (default: medium)
  • Per request (/v1/chat/completions): reasoning_effort or reasoning.effort

API Endpoints

Endpoint Description
POST /v1/chat/completions OpenAI Chat API
POST /v1/messages Anthropic Messages API
GET /v1/models List models
GET /quota Quota dashboard
GET /routing Routing config
GET /settings Settings panel
GET /remote-panel Tunnel control
GET /health Health check

Code Quality & Testing

  • Unit Tests - Core logic covered with automated tests
  • Formatting Rules - .editorconfig keeps diffs consistent
  • Input Validation - Request validation for security
  • Response Time Logging - Performance monitoring
  • Centralized Constants - No magic numbers
  • Comprehensive Docs - API reference, architecture, troubleshooting

See docs/ folder for detailed documentation.

License

MIT


中文说明

致力于成为最快最好用的API本地代理服务!将 Antigravity 内模型配额转换为 OpenAI/Anthropic 兼容的 API

免责声明:本项目基于 Antigravity 逆向开发,未来版本兼容性未知,长久使用请尽可能避免更新Antigravity。

更新内容 (v3.0.0)

  • 新增 Kiro Provider 支持 - 加入 Kiro 账号导入、配额展示、模型路由和反向代理能力
  • 控制面板国际化 - 增加全局中文支持、默认跟随系统语言,并在设置页提供语言切换
  • 账号诊断助手 - 新增仅限本机访问的诊断面板,用于检查账号文件、CLI 工具、回调端口和 provider 配置
  • 面板更新能力 - 新增仅限本机访问的检查更新和源码安装一键更新,并对 Homebrew、WinGet、Docker 做保护提示
  • 完善 Docker 支持 - 更新 Docker 默认配置、OAuth 端口范围、健康检查、开发 compose 分离和 Docker 更新说明
v2.9.0
  • 稳定的 Homebrew 安装包 - Homebrew 现在直接安装预编译的 macOS Apple Silicon 包,brew install anti-api 不再依赖本地下载 Rust、LLVM 或 Bun
  • 新增 WinGet 发布链路 - 补齐了 Windows portable 打包、WinGet manifest 生成和 release workflow,为 winget install anti-api 做准备
  • 统一安装后启动行为 - Homebrew 和 WinGet 安装后的行为统一为:在任意终端输入 anti-api 直接启动服务
  • 新增便携运行时支持 - Windows portable 入口会自动拉起 Rust proxy,加载打包后的 dashboard 静态文件,并规避包管理器安装下的自更新冲突
  • 增强包管理器保护 - Homebrew / WinGet 安装不再自覆盖更新,而是分别提示使用 brew upgrade anti-apiwinget upgrade anti-api
v2.8.0
  • 新增 Zed 托管模型支持 - Anti-API 现在可以导入当前 Zed.app 的登录态,并将请求路由到 Zed 提供的模型
  • 按账号动态拉取模型 - Routing 会从每个可用的 Codex 和 Copilot 账号实时拉取模型,并加入 Zed 的账号级模型同步
  • 明确 Zed 账号边界 - Zed 账号可以逐个导入并保存在 Anti-API 中,但不能像 Codex/Copilot 一样自动批量发现
  • 更新 Zed 配额卡片 - Zed 卡片改为展示共享的 all models 支持状态和订阅周期时间,不再用误导性的剩余额度百分比
  • 增强 Zed 稳定性 - 为 Zed 的账号读取、模型同步和 completion 请求增加了超时控制与成功后状态恢复

特性

  • Flow + Account 路由 - 自定义流控制非官方模型,官方模型使用账号链
  • 五家 Provider - Antigravity、Codex、GitHub Copilot、Zed 托管模型、Kiro
  • 远程访问 - ngrok/cloudflared/localtunnel 一键设置
  • 完整面板 - 配额监控、路由配置、设置面板
  • 自动轮换 - 429 错误时切换账号
  • 双格式支持 - OpenAI 和 Anthropic API 兼容
  • 工具调用 - 支持 function calling,兼容 Claude Code

Zed 账号说明

  • 导入方式 - 点击 Add Account -> Zed 时,Anti-API 会读取当前 Zed.app 在 macOS Keychain 中的登录态
  • 为什么和 Codex/Copilot 不同 - Zed 本地没有像 Codex/Copilot 那样可批量扫描的多账号认证文件,桌面端本质上更接近“当前单登录态”
  • 这里的多账号含义 - 你可以先在 Zed 内切换账号,再逐个导入到 Anti-API;导入后的 Zed 账号会继续保存在 Anti-API 内
  • 当前不支持的能力 - 不能像 Codex/Copilot 一样,直接从一台机器上自动批量发现多个 Zed 本地账号
  • 额度监控说明 - Zed 的 hosted models 共用同一个月度消耗池。Anti-API 当前展示的是 hosted access 状态和订阅周期,不是精确的剩余美元额度
  • Credit 说明 - Zed 的月度 credit 取决于具体计划类型。例如 Zed Student 官方说明为每月 $10 AI token credits,而普通 Pro 页面可能显示不同额度

快速开始

Homebrew(macOS Apple Silicon)

# 添加 tap
brew tap ink1ing/anti-api

# 安装 Anti-API
brew install anti-api

# 在任意终端直接启动 Anti-API
anti-api

说明:

  • 该 formula 直接安装预编译的 macOS Apple Silicon 包,安装时不会再下载 Rust、LLVM 或 Bun。
  • 升级直接使用 brew upgrade anti-api
  • bun run brew:formula 是维护者命令,用于按当前 tag 版本刷新 Formula/anti-api.rb
  • bun run brew:bundle 是维护者命令,用于构建 Homebrew 依赖的发布包。
  • Homebrew 安装会禁用 anti-api --update,避免和 Homebrew 的包管理冲突。
  • 安装完成后,在任意终端输入 anti-api 会直接启动服务。

Windows

双击 start.bat 启动。

仓库内已经补齐 WinGet 打包与 manifest 生成链路。待 winget-pkgs 合并后,可直接使用:

winget install anti-api
anti-api

安装完成后,在任意终端输入 anti-api 会直接启动服务。

Linux

# 安装依赖
bun install

# 启动服务(默认端口:8964)
bun run src/main.ts start

macOS

双击 start.command 启动。

Docker

构建:

docker build -t anti-api .

运行:

docker run --rm -it \\
  -p 8964:8964 \\
  -p 1455-1465:1455-1465 \\
  -p 51121-51131:51121-51131 \\
  -e ANTI_API_DATA_DIR=/app/data \\
  -e ANTI_API_NO_OPEN=1 \\
  -e ANTI_API_OAUTH_NO_OPEN=1 \\
  -e ANTI_API_PACKAGE_MANAGER=docker \\
  -e ANTI_API_NO_SELF_UPDATE=1 \\
  -v $HOME/.anti-api:/app/data \\
  anti-api

Compose:

docker compose up --build

开发覆盖模式(不重建,直接使用本地 src/public/):

docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d --no-build

说明:

  • OAuth 回调使用 51121-51131(Antigravity)和 1455-1465(Codex 浏览器 OAuth),请确保已映射这些端口。
  • 如果运行在远程主机,请将 ANTI_API_OAUTH_REDIRECT_URL 设置为公网地址,例如 http://YOUR_HOST:51121/oauth-callback
  • 挂载 ~/.anti-api 后,Docker 会复用本地账号和路由配置。
  • 本地导入类 provider 默认看不到宿主机凭据;如需导入,请按 docker-compose.yml 里的注释示例挂载 .codex.cli-proxy-api.aws、Kiro CLI 或 Amazon Q 目录。
  • 设置 ANTI_API_NO_OPEN=1 可避免容器内尝试自动打开浏览器。
  • Docker 内禁用面板自更新,请使用 docker compose up -d --build 重建或拉取镜像更新。
  • 如果受限网络下 Copilot TLS 失败,可设置 ANTI_API_COPILOT_INSECURE_TLS=1(不建议常规使用)。
  • 如果受限网络下 Codex TLS 失败,可设置 ANTI_API_CODEX_INSECURE_TLS=1(不建议常规使用)。
  • 可通过 ANTI_API_CODEX_REASONING_EFFORT=low|medium|high 设置 Codex 默认推理强度(默认 medium)。
  • 如果 Docker Hub 不稳定,默认基础镜像已使用 GHCR;可用 BUN_IMAGE=oven/bun:1.3.5 覆盖。
  • 镜像内已为 Linux amd64/arm64 安装 ngrok。

开发规范

  • 格式规范:遵循 .editorconfig(4 空格缩进、LF 行尾)
  • 测试:运行 bun test
  • 贡献指南:参考 docs/CONTRIBUTING.md

系统架构

┌─────────────────────────────────────────────────────────────┐
│                      Anti-API (端口 8964)                   │
├─────────────────────────────────────────────────────────────┤
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐      │
│  │   配额面板   │  │   路由配置   │  │   设置面板   │      │
│  │   /quota     │  │   /routing   │  │   /settings  │      │
│  └──────────────┘  └──────────────┘  └──────────────┘      │
│                                                              │
│  ┌──────────────────────────────────────────────────────┐  │
│  │              智能路由系统                             │  │
│  │  • Flow 路由(自定义模型 ID)                         │  │
│  │  • Account 路由(官方模型 ID)                        │  │
│  │  • 429 错误自动轮换                                   │  │
│  │  • 多提供商支持                                       │  │
│  └──────────────────────────────────────────────────────┘  │
│                           ▼                                  │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐      │
│  │ Antigravity  │  │    Codex     │  │   Copilot    │      │
│  └──────────────┘  └──────────────┘  └──────────────┘      │
│  ┌──────────────┐                                        │
│  │     Zed      │                                        │
│  └──────────────┘                                        │
└─────────────────────────────────────────────────────────────┘

智能路由系统 (Beta)

测试功能:路由系统为实验性功能,配置格式可能在未来版本中变更。

路由系统拆分为两种模式:

  • Flow 路由:自定义模型 ID(如 route:fast)使用流配置
  • Account 路由:官方模型 ID(如 claude-sonnet-4-5)使用账号链

由此实现模型到账号的精细控制:

  • 负载均衡 - 将请求分发到多个账号
  • 模型专用 - 指定模型使用专用账号
  • 混合提供商 - 组合 Antigravity、Codex、Copilot、Zed
  • 自动降级 - 账号触发 429 时自动切换下一个

工作流程

请求
  ├─ 官方模型 → Account 路由 → 账号链 → 提供商 → 上游 API
  └─ 自定义模型/route:flow → Flow 路由 → 流条目 → 提供商 → 上游 API

无匹配 → 400 错误

配置方法

  1. 访问面板: http://localhost:8964/routing
  2. Flow 路由: 创建流(如 "fast", "opus"),添加 提供商 → 账号 → 模型 条目
  3. Account 路由: 选择官方模型,配置账号顺序,按需开启 Smart Switch
  4. 使用流: 设置 "model": "route:<流名称>" 或直接使用流名
  5. 使用官方模型: 直接请求官方模型 ID(如 claude-sonnet-4-5

Flow 顺序:按配置顺序尝试,429 时切换下一个。 Account 路由:Smart Switch 开启且未配置条目时,按账号创建顺序自动展开。


远程访问

将本地 Anti-API 暴露到公网,支持跨设备访问:

  • 移动开发 - iOS/Android 测试 AI 集成
  • 团队共享 - 与队友共享配额
  • 外部工具 - 连接需要公网 URL 的 AI 工具

隧道对比

隧道 需要账号 稳定性 速度
ngrok 是(免费层) 最佳
cloudflared 良好
localtunnel 一般

设置方法

  1. 访问面板: http://localhost:8964/remote-panel
  2. 配置 (ngrok): 输入 ngrok.com 的 authtoken
  3. 启动隧道: 点击启动,等待公网 URL
  4. 使用远程 URL: 用隧道 URL 替换 localhost:8964

安全提示: 任何人拥有隧道 URL 即可访问您的 API,请妥善保管。

设置面板

访问 http://localhost:8964/settings 配置:

  • 自动打开面板: 启动时打开配额面板
  • 自动启动 ngrok: 自动启动隧道
  • 模型偏好: 设置后台任务默认模型

支持的模型

Antigravity

模型 ID 说明
claude-sonnet-4-5 快速均衡
claude-sonnet-4-5-thinking 扩展推理
claude-opus-4-5-thinking 最强能力
claude-opus-4-6-thinking 最强能力(新一代)
gemini-3-flash 最快响应
gemini-3-pro-high 高质量

GitHub Copilot

模型 ID 说明
claude-opus-4-5-thinking Opus
claude-sonnet-4-5 Sonnet
gpt-4o GPT-4o
gpt-4o-mini GPT-4o Mini
gpt-4.1 GPT-4.1

ChatGPT Codex

模型 ID 说明
gpt-5.3-max-high 5.3 Max (High)
gpt-5.3-max 5.3 Max
gpt-5.3 5.3
gpt-5.3-codex 5.3 Codex
gpt-5.2-max-high 5.2 Max (High)
gpt-5.2-max 5.2 Max
gpt-5.2 5.2
gpt-5.1 5.1
gpt-5 5

Codex 推理强度支持:

  • 全局默认:ANTI_API_CODEX_REASONING_EFFORT=low|medium|high(默认 medium
  • 单次请求(OpenAI /v1/chat/completions):reasoning_effortreasoning.effort

Zed Hosted Models

模型 ID 说明
动态拉取 按账号从 Zed 实时同步模型列表
共享 hosted access 所有托管模型共用同一 hosted 状态/周期

API 端点

端点 说明
POST /v1/chat/completions OpenAI Chat API
POST /v1/messages Anthropic Messages API
GET /quota 配额面板
GET /routing 路由配置
GET /settings 设置面板
GET /remote-panel 隧道控制

代码质量

  • 单元测试 - 核心逻辑完整测试
  • 输入验证 - 请求验证保障安全
  • 响应时间日志 - 性能监控
  • 常量集中管理 - 无魔法数字

详细文档见 docs/ 文件夹。

开源协议

MIT

About

Turn Antigravity / codex / github copilot into Anthropic & Openai API compatible server. Usable with Claude Code / Xcode etc.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors