Configuration Priority
Settings are applied in the following order (highest to lowest priority):- Environment variables (e.g.,
PORT=3000) - Config file (
~/.config/antigravity-proxy/config.json) - Default values (built-in defaults)
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.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/healthendpoint 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 Example systemd service file:
.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.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, 51126Config 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.01to0.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
TheaccountSelection 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 whenstrategy is set to hybrid.
object
Health scoring configuration:
initial(70): Starting score for new accountssuccessReward(1): Points added on successful requestrateLimitPenalty(-10): Points subtracted on rate limitfailurePenalty(-20): Points subtracted on other failuresrecoveryPerHour(10): Passive recovery rateminUsable(50): Minimum score to be selectedmaxScore(100): Maximum score cap
object
Client-side rate limiting via token bucket:
maxTokens(50): Maximum token capacitytokensPerMinute(6): Regeneration rateinitialTokens(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 componenttokens(5): Weight for token bucket componentquota(3): Weight for quota awareness componentlru(0.1): Weight for LRU freshness component
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:- Per-model (
account.modelQuotaThresholds[modelId]) - Per-account (
account.quotaThreshold) - 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
- Go to Accounts
- Click the settings icon next to an account
- Adjust the Account Quota Threshold slider
3
Per-model threshold
- Go to Models
- Drag the colored markers on quota bars to set per-account thresholds for each model
- 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.- WebUI (Recommended)
- Manual Editing
- Open
http://localhost:8080 - Navigate to Settings → Server
- Adjust settings using sliders and dropdowns
- Changes are saved automatically
systemd Service Setup
When running the proxy as a systemd service, set theCLAUDE_CONFIG_PATH environment variable to the real user’s .claude directory.
Example Service File
/etc/systemd/system/antigravity-proxy.service
Enable and Start
Troubleshooting
Changes not taking effect
Changes not taking effect
- Check that you’re editing the correct config file (
~/.config/antigravity-proxy/config.json) - Restart the proxy after manual edits
- Environment variables override config file settings
Port already in use
Port already in use
Change the port using the
PORT environment variable:OAuth callback fails on Windows
OAuth callback fails on Windows
Windows may reserve ports 49152-65535 for Hyper-V/WSL2. Set
OAUTH_CALLBACK_PORT to a lower port:Config file not found
Config file not found
The config file is created automatically on first run. If it’s missing: