@12errh/antigravity-proxy

中文文档
1.0.12发布于 2026/10/17TypeScriptES Module近 30 天下载 5916

LLM proxy for Antigravity — translate Google Gemini API calls to any provider

原始使用文档
文档目录20 节
  1. Quick Install
  2. Quick Start
  3. Prerequisites
  4. Platform Support
  5. Launch via CLI (recommended)
  6. Launch from source (development)
  7. 🎯 Key Features
  8. 🚀 How It Works
  9. Per Request Pipeline
  10. 📊 Supported Providers
  11. Cloud APIs
  12. Local Inference
  13. 📋 Models Tab — Matrix
  14. 🧠 Model Options — Reasoning Effort
  15. ⚙️ Config Tab — API Keys
  16. 🏗️ Architecture
  17. 💡 Context Mode Explained
  18. 📚 Quick Links
  19. ⚡ Development Quick Start
  20. 📝 License

Antigravity Proxy

Antigravity

Antigravity Proxy

Use any AI provider with Antigravity 2.0 — NVIDIA, OpenRouter, OpenAI, Groq, Anthropic, Google Gemini, OpenCode Zen, OpenCode Go, or 9+ local inference solutions.

npm version npm downloads CI Node >=20 MIT Platform


Quick Install

npm install -g @12errh/antigravity-proxy
antigravity setup    # interactive wizard — picks provider, enters API key, configures port
antigravity start    # starts proxy + dashboard + launches Antigravity desktop

No clone required. The npm package includes everything: CLI, proxy, dashboard, certs, and all providers. Install once, run anywhere.


Quick Start

Prerequisites

  • Antigravity 2.0 Desktop (Windows, macOS, or Linux)
  • Node.js 20+
  • Administrator/root privileges (port 443) — on Linux/macOS run sudo antigravity start; the CLI re-execs under a Node 20+ it finds on your machine (nvm, fnm, volta, or system), so sudo doesn't need Node on root's PATH
  • At least one API key or local model server

Platform Support

PlatformStatusNotes
Windows 10/11✅ TestedCLI handles cert install (UAC), port binding, and launch
macOS✅ SupportedCLI trusts the cert in the System keychain (sudo prompt), port binding, and launch
Linux✅ SupportedCLI trusts the cert in the NSS DB (~/.pki/nssdb, what the Electron app reads) and the system CA store; installs libnss3-tools via apt/dnf/pacman when certutil is missing

Prerequisite differs per platform: port 443 needs Administrator on Windows (the CLI raises UAC automatically) and root/sudo on Linux/macOS. The desktop app always connects on 443 (routed to the proxy via the hosts file), so proxy mode must bind 443 to intercept app traffic — a PROXY_PORT of e.g. 8443 is auto-corrected back to 443 on root starts. --port 8443 runs the proxy without elevation for direct API testing only; the desktop app's sign-in won't be intercepted on other ports.

npm install -g @12errh/antigravity-proxy
antigravity start                    # background mode — runs silently, launches desktop
antigravity start --foreground       # foreground mode — see live logs in terminal
antigravity start --port 8443        # no admin needed (testing only — app sign-in needs 443)
antigravity start --trust-cert       # auto-trust TLS certificate
antigravity stop                     # stop everything cleanly

Launch from source (development)

Get the Repository

git clone https://github.com/12errh/antigravity-proxy.git
cd antigravity-proxy

Windows (PowerShell as Administrator)

.\start.ps1

macOS / Linux

chmod +x start.sh
./start.sh

Without admin (port 8443 — testing only)

./start.sh --port 8443

The desktop app always connects on 443; use --simple to launch the app with no proxy, or run with sudo/Administrator for app interception.

Then open http://localhost:4000 in your browser to configure providers, model mappings, and view live stats.


🎯 Key Features

FeatureStatusDescription
Auto context compaction✅LLM-based summarization when approaching context limits
Model fallback per provider✅Try multiple models within same provider before failover
Multi-provider failover✅Priority chain with exponential backoff
Per-model routing✅One row per model alias, one column per provider
Retry + backoff✅Configurable per-provider and global
Hot-reload config✅No restart needed for changes
Tool normalization✅Alias resolution, type coercion, default filling
Model capability detection✅Auto-detect reasoning, vision, tools
Provider optimizations✅Groq (image stripping), Zen/NVIDIA (reasoning effort)
Real-time dashboard✅Live logs, stats, config editor
Cost tracking✅Per-day, per-model, per-provider
Local discovery✅9+ inference solutions auto-detected
Full-text search✅Search requests, sessions, logs
Blocklist✅Provider, model, content filtering
Session comparison✅Side-by-side session analysis

🚀 How It Works

graph TD
    A[Antigravity 2.0 Desktop] --> B[TLS 443]
    B --> C[Proxy]
    C --> D[Cloud APIs]
    C --> E[Local APIs]
    C --> F[Dashboard]
    
    D --> G[OpenRouter]
    D --> H[NVIDIA]
    D --> I[OpenAI]
    D --> J[Groq]
    D --> K[Anthropic]
    D --> L[Google Gemini]
    D --> M[Zen]
    
    E --> N[Ollama]
    E --> O[vLLM]
    E --> P[LM Studio]
    E --> Q[llama.cpp]
    
    F --> R[Live Logs]
    F --> S[Request History]
    F --> T[Config Editor]
    F --> U[Model Matrix]
    F --> V[Provider Priority]

Per Request Pipeline

  1. TLS Intercept — Receives Gemini API call on port 443
  2. Context Stripping — Removes bulk context, injects compact agent-context.md reference
  3. Tool Normalization — Resolves aliases, coerces types, fills defaults
  4. Model Resolution — Routes through priority order with retry + backoff
  5. Capability Detection — Auto-detects reasoning/vision/tool support
  6. Reasoning Effort — Applies reasoning_effort if configured
  7. Translation — Converts to target provider's API format
  8. Streaming — Returns SSE response wrapped in Gemini format
  9. Logging — Records to SQLite for cost tracking, history, sessions

📊 Supported Providers

Cloud APIs

ProviderTypeEnv VarNotes
OpenRouterCloud APIOPENROUTER_API_KEY300+ models in one key
NVIDIA NIMCloud APINVIDIA_API_KEYFree credits on signup
OpenAICloud APIOPENAI_API_KEYGPT-4o, o-series
GroqCloud APIGROQ_API_KEYUltra-fast LPU inference
AnthropicCloud APIANTHROPIC_API_KEYClaude 3.x / 4.x
Google GeminiCloud APIGOOGLE_API_KEYGemini 2.5 Pro/Flash
OpenCode ZenCloud gatewayOPENCODE_API_KEYClaude, GPT, Gemini, Grok, Kimi, GLM — one key
OpenCode GoCloud gatewayOPENCODE_GO_API_KEYDeepSeek, Qwen, MiniMax, GLM, Kimi, MiMo — $10/mo

Local Inference

ProviderTypeNotes
OllamaLocalAuto-discovered on port 11434
vLLMLocalAuto-discovered on port 8000
LM StudioLocalAuto-discovered on port 1234
llama.cppLocalAuto-discovered on port 8080
text-generation-webuiLocalAuto-discovered on port 5000
TabbyAPILocalAuto-discovered on port 5000
LocalAILocalAuto-discovered on port 8080
LiteLLMLocalAuto-discovered on port 4000
Aphrodite EngineLocalAuto-discovered on port 8000

📋 Models Tab — Matrix

The Models tab shows a matrix: one row per Antigravity model alias, one column per provider.

graph TD
    A[Model Alias] --> B[Default]
    A --> C[OpenRouter]
    A --> D[Zen]
    
    E[claude-sonnet-4-6] --> F[claude-sonnet-4-5]
    E --> G[anthropic/claude-3-5-sonnet-20241022]
    E --> H[claude-sonnet-4-5]
    
    I[gemini-2.5-flash] --> J[gemini-2.5-flash]
    I --> K[google/gemini-2.0-flash-exp]
    I --> L[deepseek-v4-flash]
    
    M[gpt-4o] --> N[openai/gpt-4o]
    M --> O[openai/gpt-4o]

Features:

  • Double-click any cell to open live model picker
  • Column toggles to hide unused providers
  • Quick-add buttons (+ Claude, + Gemini, + GPT)
  • Empty cells use Default value
  • Provider logos in filled cells

🧠 Model Options — Reasoning Effort

Some models support reasoning_effort to control thinking depth:

Model familyLevels
DeepSeek R-serieslow, medium, high, max
NVIDIA stepfunlow, medium, high, max
OpenAI o-serieslow, medium, high
Qwen Thinking, GLM Thinking, Kimilow, medium, high

Auto-detection: The Model Options tab detects supported models and lets you set levels per model. Settings persist in proxy/reasoning-effort.json without restart.


⚙️ Config Tab — API Keys

KeyProvider
OPENROUTER_API_KEYopenrouter.ai/keys
NVIDIA_API_KEYbuild.nvidia.com — free credits on signup
OPENAI_API_KEYplatform.openai.com/api-keys
GROQ_API_KEYconsole.groq.com/keys
ANTHROPIC_API_KEYconsole.anthropic.com/settings/keys
GOOGLE_API_KEYaistudio.google.com/apikey
OPENCODE_API_KEYopencode.ai/auth — one key for Claude, GPT, Gemini, Grok, Kimi, GLM

All keys are hot-reloaded from .env — no restart needed.


🏗️ Architecture

graph TD
    %% Root level
    A[agent-context.md] --> B[start.ps1]
    B --> C[README.md]
    C --> D[CHANGELOG.md]
    C --> E[docs/]
    C --> F[proxy/]
    
    %% docs/ directory
    E --> G[SETUP.md]
    E --> H[CONFIGURATION.md]
    E --> I[DEVELOPER.md]
    
    %% proxy/ directory
    F --> K[src/]
    
    %% src/ directory - main components
    K --> L[adapters/]
    K --> M[adapter.ts]
    K --> N[provider-plugin.ts]
    K --> O[provider-registry.ts]
    K --> P[plugins/]
    K --> Q[tool-capabilities.ts]
    K --> R[tool-normalizer.ts]
    K --> S[model-capabilities.ts]
    K --> T[router.ts]
    K --> U[models.ts]
    K --> V[index.ts]
    K --> W[engine.ts]
    K --> X[mapper.ts]
    K --> Y[config.ts]
    K --> Z[provider-cache.ts]
    
    %% adapters subdirectory
    L --> A1[openai.ts]
    L --> A2[anthropic.ts]
    L --> A3[google.ts]
    L --> A4[groq.ts]
    L --> A5[zen.ts]
    L --> A6[nvidia.ts]
    L --> A7[types.ts]
    
    %% plugins subdirectory
    P --> B1[builtin-plugins.ts]
    
    %% dashboard subdirectory
    F --> C1[dashboard/]
    C1 --> C2[index.html]
    C1 --> C3[login.html]
    
    %% Other files in proxy/
    F --> D1[models.json]
    F --> D2[pricing.json]
    F --> D3[reasoning-effort.json]
    F --> D4[blocklist.json]
    F --> D5[.env]
    F --> D6[.env.example]
    F --> D7[certs/]
    F --> D8[logs/]
    
    %% Note: actual configuration for certs and logs are nested

---

## 🔧 Environment Variables

```env
# Provider priority (first = primary)
PROVIDER_PRIORITY=openrouter,nvidia,zen

# API keys
OPENROUTER_API_KEY=sk-or-v1-...
NVIDIA_API_KEY=nvapi-...
OPENAI_API_KEY=sk-...
GROQ_API_KEY=gsk_...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=AIza...
OPENCODE_API_KEY=sk-...
OPENCODE_GO_API_KEY=sk-opencode-go-...

# Ports
PROXY_PORT=443          # TLS port the desktop app connects to (root starts auto-correct other values)
API_PORT=4000           # Dashboard + REST API port

# Retry & failover
PROXY_RETRIES=3         # Attempts per provider
PROXY_BACKOFF_MS=100    # Initial backoff (doubles each retry)

# Rate limiting (0 = unlimited)
RATE_LIMIT_GLOBAL=0
RATE_LIMIT_PROVIDER=0
RATE_LIMIT_WINDOW_MS=60000

# Logging
LOG_LEVEL=info          # debug | info | warn | error
LOG_MAX_SIZE_MB=10      # Rotate when reached
LOG_MAX_FILES=5         # Keep N rotated files
LOG_MAX_AGE_DAYS=30     # Delete files older than

# Dashboard auth (optional)
DASHBOARD_USER=admin
DASHBOARD_PASSWORD=your_password

# Failover webhook (optional)
FAILOVER_WEBHOOK_URL=https://hooks.example.com/webhook

# Workspace context hardening
WORKSPACE_CONTEXT_ENVELOPE=strict   # off | loose | strict

# Inline context mode
CONTEXT_STRIP_MODE=lite             # lite (recommended) | strip | passthrough

💡 Context Mode Explained

Lite (recommended): Uses compressed agent-context-lite.md (~3.5K tokens) — same tool coverage as full context, 66% fewer tokens. Strips native Antigravity context, injects compressed version.

Strip: Uses full agent-context.md (~10K tokens) — removes bulk context (skills/plugins/identity), injects complete operating manual.

Passthrough: Forwards native Antigravity context unchanged (~28K tokens) — simplest approach, no injection overhead.



⚡ Development Quick Start

cd proxy
npm install            # Install dependencies
npm run build          # Compile TypeScript → dist/
npm run typecheck      # Type-check only
npm test               # Run tests
npm run dev            # Watch mode

New Providers: See docs/DEVELOPER.md for plugin architecture guide.

Run tests:

# All tests
npm test

# Filter by component
npx tsx test/run.ts plugin-architecture
npx tsx test/run.ts tool-translation
npx tsx test/run.ts model-discovery
npx tsx test/run.ts provider-adapters

📝 License

MIT — see LICENSE.

版本与发布记录

@12errh/antigravity-proxy 共发布 12 个版本,首次发布于 2026/06/24;过去 12 个月发布了 12 个版本。

版本发布日期距今
1.0.12latest2026/10/1721 天前
1.0.112026/07/064 个月前
1.0.102026/07/054 个月前
1.0.82026/07/054 个月前
1.0.72026/07/054 个月前
1.0.62026/07/014 个月前

关于 @12errh/antigravity-proxy 的常见问题

@12errh/antigravity-proxy 是什么?

LLM proxy for Antigravity — translate Google Gemini API calls to any provider

如何安装 @12errh/antigravity-proxy?

在项目目录运行 npm install @12errh/antigravity-proxy,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 antigravity,可以用 npx antigravity 直接运行。

@12errh/antigravity-proxy 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@12errh/antigravity-proxy 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@12errh/antigravity-proxy 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@12errh/antigravity-proxy 可以商用吗?

@12errh/antigravity-proxy 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@12errh/antigravity-proxy 的下载量有多少?

根据 npm 官方下载统计,@12errh/antigravity-proxy 在 2026/10/05 – 2026/11/03 这 30 天内被下载 5,916 次,日均约 197 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@12errh/antigravity-proxy 还在维护吗?

最新版本 1.0.12 发布于 2026/10/17(21 天前);至今共发布 12 个版本,其中过去 12 个月发布了 12 个;首次发布于 2026/06/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。