Skip to main content

Overview

The API Proxy is a high-performance local server that converts Google AI accounts into standard API endpoints. It supports multiple protocols including OpenAI, Anthropic (Claude), and native Gemini formats.

Supported Protocols

OpenAI Compatible

Provides /v1/chat/completions endpoint compatible with 99% of existing AI applications:

Anthropic (Claude) Protocol

Native /v1/messages interface with full Claude Code CLI support:

Gemini Native Protocol

Direct Google SDK compatibility:

Server Configuration

Basic Settings

Port must be between 8000-65535. Requires restart if proxy is running.

Authentication

The proxy uses API key authentication for security:

Generating API Keys

1

Navigate to API Proxy Settings

Open the API Proxy page in the application.
2

Generate New Key

Click Regenerate API Key to create a new authentication key.
3

Copy and Use

Copy the generated key and use it in your API clients.
Regenerating the API key will invalidate all existing client connections.

Token Management

The proxy automatically manages account tokens and handles rotation:

Smart Token Selection

The token manager uses sophisticated algorithms to select the best account:
  1. Capability Filtering: Only accounts with the requested model
  2. Subscription Tier Priority: ULTRA → PRO → FREE
  3. Quota-Based Sorting: Higher remaining quota preferred
  4. Health Score: Accounts with better success rates
  5. Reset Time: Recently refreshed quotas prioritized

Automatic Token Refresh

Tokens are automatically refreshed before expiration:

Request Routing

The proxy routes requests through multiple handlers:

Error Handling

Automatic retry on rate limits and token expiration:

Integration Examples

Claude Code CLI

OpenCode

Use the built-in sync feature:
1

Open API Proxy Page

Navigate to API ProxyExternal Providers
2

Click OpenCode Sync

Click the Sync button on the OpenCode card
3

Verify Configuration

Configuration is automatically written to ~/.config/opencode/opencode.json

Cherry Studio

  1. Open SettingsModels
  2. Add new provider:
    • Base URL: http://127.0.0.1:8045/v1
    • API Key: sk-antigravity
  3. Select available models from the list

Monitoring

Proxy Status

Check current proxy status:

Session Bindings

Clear sticky session bindings:
Session bindings are automatically cleared when switching accounts.

Advanced Configuration