Skip to main content
Customize Antigravity Claude Proxy’s behavior through environment variables, configuration files, or the Web Console.

Configuration Priority

Settings are applied in the following order (highest to lowest priority):
  1. Environment variables (e.g., PORT=3000)
  2. Config file (~/.config/antigravity-proxy/config.json)
  3. Default values (built-in defaults)
Most users can configure everything through the Web Console at http://localhost:8080 without editing files directly.

Environment Variables

Server Configuration

number
default:"8080"
HTTP server port. The proxy listens on this port for API requests.
string
default:"0.0.0.0"
Bind address. Use 127.0.0.1 to restrict to localhost only.

Security

string
default:""
Protect /v1/* API endpoints with a bearer token. When set, clients must include Authorization: Bearer YOUR_API_KEY.
Keep this value secret. Do not commit it to version control.
string
default:""
Password-protect the Web Console. Users will be prompted to enter this password when accessing the dashboard.

Proxy & Network

string
default:""
Route outbound API requests through an HTTP proxy. Useful for corporate firewalls or debugging.
string
default:""
Same as HTTP_PROXY but for HTTPS requests. Both variables are supported (case-insensitive).

Developer Mode

boolean
default:"false"
Enable developer mode with debug logging and advanced features.
When enabled:
  • Debug logs are printed to console
  • /api/strategy/health endpoint is accessible
  • Dev tools panel is visible in WebUI
  • Screenshot mode and placeholder data are available
boolean
default:"false"
Legacy alias for DEV_MODE. Setting DEBUG=true automatically enables developer mode.

Model Fallback

boolean
default:"false"
Enable automatic model fallback when quota is exhausted. See Fallback Strategy for details.

systemd / Service Deployments

string
default:"~/.claude"
Path to the .claude directory containing settings.json. Required when running as a systemd service.Problem: When running as a systemd service, os.homedir() returns the service user’s home (e.g., /root), not the real user’s home.Solution: Set this variable to the real user’s .claude directory.
Example systemd service file:

OAuth Callback Port

number
default:"51121"
Port for OAuth callback server during account authentication. Windows users may need to change this if the default port is reserved by Hyper-V/WSL2.
Fallback ports: 51122, 51123, 51124, 51125, 51126

Config File Structure

The config file is located at ~/.config/antigravity-proxy/config.json. It is created automatically on first run.

Example config.json

Retry & Rate Limiting

number
default:"5"
Maximum number of retry attempts for failed requests.
number
default:"1000"
Base delay in milliseconds for exponential backoff.
number
default:"30000"
Maximum retry delay in milliseconds (30 seconds).
number
default:"10000"
Default cooldown period after rate limit errors (10 seconds).
number
default:"120000"
Maximum time to wait before giving up and returning an error (2 minutes).
number
default:"2000"
Deduplication window to prevent concurrent retry storms (2 seconds).
number
default:"3"
Number of consecutive failures before applying extended cooldown.
number
default:"60000"
Extended cooldown period after repeated failures (1 minute).
number
default:"5000"
Delay before switching accounts after a rate limit (5 seconds).

Capacity & Backoff

number
default:"5"
Maximum retries for model capacity exhaustion errors.
array
default:"[5000, 10000, 20000, 30000, 60000]"
Progressive backoff tiers for capacity exhaustion (in milliseconds).

Account Management

number
default:"10"
Maximum number of Google accounts allowed (1-100). Configurable via WebUI.
number
default:"0"
Global minimum quota fraction before switching accounts.
  • 0 = Disabled (use quota until exhausted)
  • 0.01 to 0.99 = Switch when quota drops below this fraction
  • Example: 0.10 = Switch when quota falls below 10%
This can be overridden per-account and per-model in the Web Console.
boolean
default:"false"
Enable delay before each Google API request (opt-in). Helps prevent rate limits in high-concurrency scenarios.
number
default:"200"
Delay in milliseconds when request throttling is enabled (100-5000ms).

Account Selection Strategy

The accountSelection object configures the load balancing strategy.
string
default:"hybrid"
Account selection algorithm:
  • sticky: Cache-optimized (stays on same account)
  • round-robin: Load-balanced (rotates every request)
  • hybrid: Smart distribution (default)

Hybrid Strategy Tuning

These settings only apply when strategy is set to hybrid.
object
Health scoring configuration:
  • initial (70): Starting score for new accounts
  • successReward (1): Points added on successful request
  • rateLimitPenalty (-10): Points subtracted on rate limit
  • failurePenalty (-20): Points subtracted on other failures
  • recoveryPerHour (10): Passive recovery rate
  • minUsable (50): Minimum score to be selected
  • maxScore (100): Maximum score cap
object
Client-side rate limiting via token bucket:
  • maxTokens (50): Maximum token capacity
  • tokensPerMinute (6): Regeneration rate
  • initialTokens (50): Starting tokens for new accounts
object
Quota awareness thresholds:
  • lowThreshold (0.10): Reduce score when quota falls below 10%
  • criticalThreshold (0.05): Exclude from selection below 5%
  • staleMs (300000): Max age of quota data to trust (5 minutes)
object
Component weights for score calculation:
  • health (2): Weight for health score component
  • tokens (5): Weight for token bucket component
  • quota (3): Weight for quota awareness component
  • lru (0.1): Weight for LRU freshness component
Scoring formula:

Quota Threshold Configuration

Quota thresholds protect accounts from complete exhaustion by switching to another account when quota drops below a configurable level.

Three-Tier Resolution

Thresholds are checked in priority order:
  1. Per-model (account.modelQuotaThresholds[modelId])
  2. Per-account (account.quotaThreshold)
  3. Global (config.globalQuotaThreshold)

Configuring via WebUI

1

Global threshold

Navigate to Settings → Server and adjust the Global Quota Threshold slider (0-99%).
2

Per-account threshold

  1. Go to Accounts
  2. Click the settings icon next to an account
  3. Adjust the Account Quota Threshold slider
3

Per-model threshold

  1. Go to Models
  2. Drag the colored markers on quota bars to set per-account thresholds for each model
  3. Markers are color-coded by account

Server Presets

The proxy includes built-in presets optimized for different scenarios. Access them via Settings → Server in the WebUI.

Default (3-5 Accounts)

Balanced settings for most users:
  • Strategy: Hybrid
  • Max retries: 5
  • Max wait: 2 minutes
  • Account selection: Balanced weights

Many Accounts (10+)

Optimized for high account counts:
  • Strategy: Hybrid
  • Max retries: 3 (faster failures)
  • Max wait: 1 minute
  • Account selection: Prioritizes health over LRU

Conservative

Maximum reliability with longer waits:
  • Strategy: Sticky (best for caching)
  • Max retries: 8
  • Max wait: 4 minutes
  • Account selection: Gentle penalties, slow recovery

Editing the Config File

You can edit the config file manually or through the WebUI.
Manual edits to config.json may be overwritten by WebUI changes. Use the WebUI for real-time configuration updates.

systemd Service Setup

When running the proxy as a systemd service, set the CLAUDE_CONFIG_PATH environment variable to the real user’s .claude directory.

Example Service File

/etc/systemd/system/antigravity-proxy.service

Enable and Start

Troubleshooting

  1. Check that you’re editing the correct config file (~/.config/antigravity-proxy/config.json)
  2. Restart the proxy after manual edits
  3. Environment variables override config file settings
Change the port using the PORT environment variable:
Windows may reserve ports 49152-65535 for Hyper-V/WSL2. Set OAUTH_CALLBACK_PORT to a lower port:
The config file is created automatically on first run. If it’s missing: