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 Configuration
- Timeout Settings
- Auto-Start
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.
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:- Capability Filtering: Only accounts with the requested model
- Subscription Tier Priority: ULTRA → PRO → FREE
- Quota-Based Sorting: Higher remaining quota preferred
- Health Score: Accounts with better success rates
- 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:- 429 Rate Limit
- 401 Expired Token
Integration Examples
Claude Code CLI
OpenCode
Use the built-in sync feature:1
Open API Proxy Page
Navigate to API Proxy → External Providers
2
Click OpenCode Sync
Click the Sync button on the OpenCode card
3
Verify Configuration
Configuration is automatically written to
~/.config/opencode/opencode.jsonCherry Studio
- Open Settings → Models
- Add new provider:
- Base URL:
http://127.0.0.1:8045/v1 - API Key:
sk-antigravity
- Base URL:
- 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
- Model Routing - Configure custom model mappings
- Quota Monitoring - Track usage and limits
- Image Generation - Imagen 3 configuration