Files
Badri Narayanan S 2ea9f4ba8e docs: refactor README by moving sections to docs/ folder
Move 11 documentation sections to separate markdown files in docs/:
- models.md, load-balancing.md, web-console.md, configuration.md
- menubar-app.md, api-endpoints.md, testing.md, troubleshooting.md
- safety-notices.md, legal.md, development.md

README now contains a Documentation section with links to each doc.
Also moved donation link to above Star History section.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 21:00:53 +05:30

300 lines
9.3 KiB
Markdown

# Antigravity Claude Proxy
[![npm version](https://img.shields.io/npm/v/antigravity-claude-proxy.svg)](https://www.npmjs.com/package/antigravity-claude-proxy)
[![npm downloads](https://img.shields.io/npm/dm/antigravity-claude-proxy.svg)](https://www.npmjs.com/package/antigravity-claude-proxy)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
A proxy server that exposes an **Anthropic-compatible API** backed by **Antigravity's Cloud Code**, letting you use Claude and Gemini models with **Claude Code CLI**.
![Antigravity Claude Proxy Banner](images/banner.png)
## How It Works
```
┌──────────────────┐ ┌─────────────────────┐ ┌────────────────────────────┐
│ Claude Code │────▶│ This Proxy Server │────▶│ Antigravity Cloud Code │
│ (Anthropic │ │ (Anthropic → Google│ │ (daily-cloudcode-pa. │
│ API format) │ │ Generative AI) │ │ sandbox.googleapis.com) │
└──────────────────┘ └─────────────────────┘ └────────────────────────────┘
```
1. Receives requests in **Anthropic Messages API format**
2. Uses OAuth tokens from added Google accounts (or Antigravity's local database)
3. Transforms to **Google Generative AI format** with Cloud Code wrapping
4. Sends to Antigravity's Cloud Code API
5. Converts responses back to **Anthropic format** with full thinking/streaming support
## Prerequisites
- **Node.js** 18 or later
- **Antigravity** installed (for single-account mode) OR Google account(s) for multi-account mode
---
## Installation
### Option 1: npm (Recommended)
```bash
# Run directly with npx (no install needed)
npx antigravity-claude-proxy@latest start
# Or install globally
npm install -g antigravity-claude-proxy@latest
antigravity-claude-proxy start
```
### Option 2: Clone Repository
```bash
git clone https://github.com/badri-s2001/antigravity-claude-proxy.git
cd antigravity-claude-proxy
npm install
npm start
```
---
## Quick Start
### 1. Start the Proxy Server
```bash
# If installed via npm
antigravity-claude-proxy start
# If using npx
npx antigravity-claude-proxy@latest start
# If cloned locally
npm start
```
The server runs on `http://localhost:8080` by default.
### 2. Link Account(s)
Choose one of the following methods to authorize the proxy:
#### **Method A: Web Dashboard (Recommended)**
1. With the proxy running, open `http://localhost:8080` in your browser.
2. Navigate to the **Accounts** tab and click **Add Account**.
3. Complete the Google OAuth authorization in the popup window.
> **Headless/Remote Servers**: If running on a server without a browser, the WebUI supports a "Manual Authorization" mode. After clicking "Add Account", you can copy the OAuth URL, complete authorization on your local machine, and paste the authorization code back.
#### **Method B: CLI (Desktop or Headless)**
If you prefer the terminal or are on a remote server:
```bash
# Desktop (opens browser)
antigravity-claude-proxy accounts add
# Headless (Docker/SSH)
antigravity-claude-proxy accounts add --no-browser
```
> For full CLI account management options, run `antigravity-claude-proxy accounts --help`.
#### **Method C: Automatic (Antigravity Users)**
If you have the **Antigravity** app installed and logged in, the proxy will automatically detect your local session. No additional setup is required.
To use a custom port:
```bash
PORT=3001 antigravity-claude-proxy start
```
### 3. Verify It's Working
```bash
# Health check
curl http://localhost:8080/health
# Check account status and quota limits
curl "http://localhost:8080/account-limits?format=table"
```
---
## Using with Claude Code CLI
### Configure Claude Code
You can configure these settings in two ways:
#### **Via Web Console (Recommended)**
1. Open the WebUI at `http://localhost:8080`.
2. Go to **Settings****Claude CLI**.
3. Use the **Connection Mode** toggle to switch between:
- **Proxy Mode**: Uses the local proxy server (Antigravity Cloud Code). Configure models, base URL, and presets here.
- **Paid Mode**: Uses the official Anthropic Credits directly (requires your own subscription). This hides proxy settings to prevent accidental misconfiguration.
4. Click **Apply to Claude CLI** to save your changes.
> [!TIP] > **Configuration Precedence**: System environment variables (set in shell profile like `.zshrc`) take precedence over the `settings.json` file. If you use the Web Console to manage settings, ensure you haven't manually exported conflicting variables in your terminal.
#### **Manual Configuration**
Create or edit the Claude Code settings file:
**macOS:** `~/.claude/settings.json`
**Linux:** `~/.claude/settings.json`
**Windows:** `%USERPROFILE%\.claude\settings.json`
Add this configuration:
```json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "test",
"ANTHROPIC_BASE_URL": "http://localhost:8080",
"ANTHROPIC_MODEL": "claude-opus-4-5-thinking",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-5-thinking",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-5-thinking",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-4-5",
"CLAUDE_CODE_SUBAGENT_MODEL": "claude-sonnet-4-5-thinking",
"ENABLE_EXPERIMENTAL_MCP_CLI": "true"
}
}
```
Or to use Gemini models:
```json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "test",
"ANTHROPIC_BASE_URL": "http://localhost:8080",
"ANTHROPIC_MODEL": "gemini-3-pro-high[1m]",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "gemini-3-pro-high[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "gemini-3-flash[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemini-3-flash[1m]",
"CLAUDE_CODE_SUBAGENT_MODEL": "gemini-3-flash[1m]",
"ENABLE_EXPERIMENTAL_MCP_CLI": "true"
}
}
```
### Load Environment Variables
Add the proxy settings to your shell profile:
**macOS / Linux:**
```bash
echo 'export ANTHROPIC_BASE_URL="http://localhost:8080"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="test"' >> ~/.zshrc
source ~/.zshrc
```
> For Bash users, replace `~/.zshrc` with `~/.bashrc`
**Windows (PowerShell):**
```powershell
Add-Content $PROFILE "`n`$env:ANTHROPIC_BASE_URL = 'http://localhost:8080'"
Add-Content $PROFILE "`$env:ANTHROPIC_AUTH_TOKEN = 'test'"
. $PROFILE
```
**Windows (Command Prompt):**
```cmd
setx ANTHROPIC_BASE_URL "http://localhost:8080"
setx ANTHROPIC_AUTH_TOKEN "test"
```
Restart your terminal for changes to take effect.
### Run Claude Code
```bash
# Make sure the proxy is running first
antigravity-claude-proxy start
# In another terminal, run Claude Code
claude
```
> **Note:** If Claude Code asks you to select a login method, add `"hasCompletedOnboarding": true` to `~/.claude.json` (macOS/Linux) or `%USERPROFILE%\.claude.json` (Windows), then restart your terminal and try again.
### Proxy Mode vs. Paid Mode
Toggle in **Settings****Claude CLI**:
| Feature | 🔌 Proxy Mode | 💳 Paid Mode |
| :--- | :--- | :--- |
| **Backend** | Local Server (Antigravity) | Official Anthropic Credits |
| **Cost** | Free (Google Cloud) | Paid (Anthropic Credits) |
| **Models** | Claude + Gemini | Claude Only |
**Paid Mode** automatically clears proxy settings so you can use your official Anthropic account directly.
### Multiple Claude Code Instances (Optional)
To run both the official Claude Code and Antigravity version simultaneously, add this alias:
**macOS / Linux:**
```bash
# Add to ~/.zshrc or ~/.bashrc
alias claude-antigravity='CLAUDE_CONFIG_DIR=~/.claude-account-antigravity ANTHROPIC_BASE_URL="http://localhost:8080" ANTHROPIC_AUTH_TOKEN="test" command claude'
```
**Windows (PowerShell):**
```powershell
# Add to $PROFILE
function claude-antigravity {
$env:CLAUDE_CONFIG_DIR = "$env:USERPROFILE\.claude-account-antigravity"
$env:ANTHROPIC_BASE_URL = "http://localhost:8080"
$env:ANTHROPIC_AUTH_TOKEN = "test"
claude
}
```
Then run `claude` for official API or `claude-antigravity` for this proxy.
---
## Documentation
- [Available Models](docs/models.md)
- [Multi-Account Load Balancing](docs/load-balancing.md)
- [Web Management Console](docs/web-console.md)
- [Advanced Configuration](docs/configuration.md)
- [macOS Menu Bar App](docs/menubar-app.md)
- [API Endpoints](docs/api-endpoints.md)
- [Testing](docs/testing.md)
- [Troubleshooting](docs/troubleshooting.md)
- [Safety, Usage, and Risk Notices](docs/safety-notices.md)
- [Legal](docs/legal.md)
- [Development](docs/development.md)
---
## Credits
This project is based on insights and code from:
- [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) - Antigravity OAuth plugin for OpenCode
- [claude-code-proxy](https://github.com/1rgs/claude-code-proxy) - Anthropic API proxy using LiteLLM
---
## License
MIT
---
<a href="https://buymeacoffee.com/badrinarayanans" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a>
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=badrisnarayanan/antigravity-claude-proxy&type=date&legend=top-left&cache-control=no-cache)](https://www.star-history.com/#badrisnarayanan/antigravity-claude-proxy&type=date&legend=top-left)