Skip to main content

Overview

Antigravity Claude Proxy supports optional API key authentication for the /v1/* endpoints. By default, authentication is disabled and the proxy uses its own configured Google accounts.

Default Behavior (No Auth)

When API key authentication is not configured:
  • All /v1/* endpoints are publicly accessible
  • The proxy uses its own pool of Google accounts
  • No Authorization header is required

Enabling API Key Authentication

To secure your proxy, set the API_KEY environment variable or configure it in config.json:

Environment Variable

Config File

Edit ~/.config/antigravity-proxy/config.json:
Store your API key securely. Do not commit it to version control.

Using the API Key

Once authentication is enabled, include the API key in every request using the Authorization header:

X-API-Key Header

Alternatively, use the X-API-Key header:

Claude Code Integration

When using Claude Code CLI, set the ANTHROPIC_AUTH_TOKEN environment variable:
Or configure via ~/.claude/settings.json:
If authentication is disabled on the proxy, you can use any value for ANTHROPIC_AUTH_TOKEN (e.g., "test").

Error Responses

401 Unauthorized - Missing API Key

Returned when API key is required but not provided:

401 Unauthorized - Invalid API Key

Returned when the provided API key does not match:

Security Best Practices

1. Use Strong API Keys

Generate a random API key using:

2. Rotate Keys Regularly

Update your API key periodically:

3. Use HTTPS in Production

For production deployments, run the proxy behind a reverse proxy with HTTPS:

4. Web UI Password Protection

The Web UI supports optional password protection via the WEBUI_PASSWORD environment variable:
Clients must include the password via:
  • Header: X-WebUI-Password: admin-password
  • Query param: ?password=admin-password
WebUI password protection is separate from API key authentication. You can enable one or both.

Account Authentication

The proxy uses Google OAuth to authenticate with Google accounts:
  • Accounts are added via the Web UI or CLI (npm run accounts:add)
  • OAuth tokens are stored in ~/.config/antigravity-proxy/accounts.json
  • Tokens are automatically refreshed when expired
See the Account Management guide for details.