Overview
Antigravity Manager supports flexible authentication modes to balance security and convenience. You can configure authentication behavior based on whether you’re running locally or exposing the API to your network.Authentication Modes
The API supports four authentication modes:Auto Mode (Recommended)
Automatically selects the appropriate authentication strategy:- Local only (
allow_lan_access: false): No authentication required - LAN access (
allow_lan_access: true): Authentication required for all endpoints except health checks
Off Mode
Disables all authentication. Suitable for local development only.Strict Mode
Requires authentication for all endpoints, including health checks.All Except Health Mode
Requires authentication for all endpoints except/health and /healthz.
API Key Authentication
Setting Your API Key
You can set the API key in three ways: 1. Configuration File (~/.antigravity_tools/gui_config.json):
Using API Keys in Requests
Include your API key in one of these headers:Authorization Header (Recommended)
X-API-Key Header
X-Goog-API-Key Header (Gemini Protocol)
Admin Password
For enhanced security, you can set a separate password for the Web UI management interface:Password Configuration
Configuration File:Password Priority
- Environment Variable (
WEB_PASSWORDorABV_WEB_PASSWORD) - Highest priority - Configuration File (
admin_passwordingui_config.json) - Fallback - Uses
api_keyif no admin password is set
Authentication Logic
| Scenario | Web Login | API Requests |
|---|---|---|
Only API_KEY set | Use API_KEY | Use API_KEY |
Both API_KEY and WEB_PASSWORD set | Use WEB_PASSWORD only | Use API_KEY |
User Tokens
User tokens provide granular access control for multi-user environments. They allow you to:- Create separate access tokens for different users or applications
- Track usage per token
- Set expiration dates and rate limits
- Revoke access without changing the main API key
Creating User Tokens
User tokens can be created via the Web UI or API:Using User Tokens
Use user tokens the same way as API keys:Token Validation
Whenauth_mode is enabled, user tokens are validated against:
- Expiration date - Token must not be expired
- IP restrictions - Optional IP whitelist/blacklist
- Rate limits - Per-token request limits
- Revocation status - Token must be active
IP Filtering
Enhance security with IP-based access control:IP Whitelist
Allow only specific IP addresses:IP Blacklist
Block specific IP addresses:Security Best Practices
Use Auto mode for automatic security
Use Auto mode for automatic security
The
auto authentication mode automatically enables security when you expose the API to your network while keeping local development convenient.Set a strong admin password
Set a strong admin password
Use a separate, strong password for admin access. This allows you to share API keys with team members while protecting administrative functions.
Use user tokens for team access
Use user tokens for team access
Create individual user tokens for team members instead of sharing the main API key. This enables better access control and usage tracking.
Enable IP filtering for public exposure
Enable IP filtering for public exposure
If exposing the API to the internet, use IP whitelisting to restrict access to known addresses.
Rotate credentials regularly
Rotate credentials regularly
Periodically generate new API keys and user tokens, especially after team member changes.
Monitor access logs
Monitor access logs
Regularly review access logs and security events in the Web UI to detect unauthorized access attempts.
Examples
OpenAI SDK with Authentication
Claude Code CLI
cURL with All Headers
Troubleshooting
401 Unauthorized
Cause: Missing or invalid API key Solution:- Verify the API key is set correctly
- Check that you’re using the correct header (
Authorization,x-api-key, orx-goog-api-key) - Ensure the auth mode allows your request
403 Forbidden
Cause: IP blocked or user token rejected Solution:- Check IP whitelist/blacklist settings
- Verify user token hasn’t expired
- Ensure the user token hasn’t been revoked
Admin Interface Not Accessible
Cause: Wrong password when separate admin password is set Solution:- Use
WEB_PASSWORDfor admin login, notAPI_KEY - Check
gui_config.jsonfor the correctadmin_password - Review environment variables (they take priority)
Next Steps
Model Routing
Configure model mappings and routing rules
User Management
Set up user tokens and access control