Skip to main content

Overview

SwitchAILocal supports multiple authentication methods for different AI providers. Login commands handle OAuth flows, API key configuration, and service account imports.

Gemini / Google

OAuth Login

boolean
Initiates Google OAuth login for Gemini API access. Opens browser for authentication unless --no-browser is specified.
string
Google Cloud Project ID. Not required for standard Gemini API but needed for Vertex AI.
boolean
Don’t automatically open browser. Displays URL for manual authentication.

Vertex AI Import

string
Path to Google Cloud service account JSON key file for Vertex AI authentication.
The service account must have the following roles:
  • roles/aiplatform.user for Vertex AI access
  • roles/ml.developer for model access

Claude / Anthropic

boolean
Authenticate with Claude using OAuth flow. Opens browser for Anthropic account login.
Output:

Codex

boolean
Authenticate with OpenAI Codex using OAuth.

Qwen

boolean
Authenticate with Alibaba Qwen AI using OAuth.

Antigravity

boolean
Authenticate with Antigravity AI platform using OAuth.

Ollama (Local)

boolean
Connect to local Ollama instance. No authentication required, but verifies connectivity.
Expected Output:
Ensure Ollama is running before attempting connection:

Vibe (Local)

boolean
Connect to local Vibe AI instance.

iFlow

OAuth Login

boolean
Authenticate with iFlow using OAuth.
Authenticate with iFlow using browser cookies. Useful when OAuth is not available.
Cookie Login Flow:

Common Flags

All login commands support the following optional flags:
boolean
default:"false"
Disable automatic browser opening. Instead, display the OAuth URL in the terminal for manual authentication.Useful for:
  • Headless servers / SSH sessions
  • CI/CD environments
  • Security policies preventing browser automation

Authentication Storage

Credentials are stored in the auth directory defined in your config:
  • File Permissions: Auth files are automatically created with 0600 permissions (owner read/write only)
  • Token Encryption: Sensitive tokens are encrypted at rest
  • Token Rotation: OAuth tokens are automatically refreshed when expired
  • Centralized Storage: Use PostgreSQL, Git, or Object Store backends for team deployments

Verifying Authentication

After logging in, verify your authentication status:
Expected output:

Troubleshooting

If the OAuth callback fails:
  1. Ensure no other service is using the callback port (usually 8765)
  2. Check firewall settings allow localhost connections
  3. Try --no-browser and manually complete authentication
Check auth directory permissions and storage backend:
OAuth tokens are refreshed automatically, but you can re-authenticate: