Skip to main content

Documentation Index

Fetch the complete documentation index at: https://ail.traylinx.com/llms.txt

Use this file to discover all available pages before exploring further.

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

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

Vertex AI Import

switchAILocal --vertex-import /path/to/service-account.json
--vertex-import
string
Path to Google Cloud service account JSON key file for Vertex AI authentication.
# Import Vertex AI service account
switchAILocal --vertex-import ~/gcp-keys/vertex-service-account.json
The service account must have the following roles:
  • roles/aiplatform.user for Vertex AI access
  • roles/ml.developer for model access

Claude / Anthropic

switchAILocal --claude-login [--no-browser]
--claude-login
boolean
Authenticate with Claude using OAuth flow. Opens browser for Anthropic account login.
switchAILocal --claude-login
Output:
Claude OAuth Login
==================
Opening browser for authentication...
Callback URL: http://localhost:8765/callback
Waiting for authentication...
✓ Successfully authenticated with Claude
Credentials saved to: ~/.switchailocal/auths/claude.json

Codex

switchAILocal --codex-login [--no-browser]
--codex-login
boolean
Authenticate with OpenAI Codex using OAuth.

Qwen

switchAILocal --qwen-login [--no-browser]
--qwen-login
boolean
Authenticate with Alibaba Qwen AI using OAuth.

Antigravity

switchAILocal --antigravity-login [--no-browser]
--antigravity-login
boolean
Authenticate with Antigravity AI platform using OAuth.

Ollama (Local)

switchAILocal --ollama-login
--ollama-login
boolean
Connect to local Ollama instance. No authentication required, but verifies connectivity.
Expected Output:
Connecting to Ollama...
Ollama endpoint: http://localhost:11434
✓ Successfully connected to Ollama
Models available: 3
  - llama2:latest
  - codellama:7b
  - mistral:latest
Ensure Ollama is running before attempting connection:
ollama serve

Vibe (Local)

switchAILocal --vibe-login
--vibe-login
boolean
Connect to local Vibe AI instance.

iFlow

OAuth Login

switchAILocal --iflow-login [--no-browser]
--iflow-login
boolean
Authenticate with iFlow using OAuth.
switchAILocal --iflow-cookie
Authenticate with iFlow using browser cookies. Useful when OAuth is not available.
Cookie Login Flow:
iFlow Cookie Authentication
============================
1. Log in to iFlow in your browser
2. Open browser DevTools (F12)
3. Go to Application > Cookies
4. Copy the session cookie value
5. Paste below:

Session Cookie: ************************
✓ Cookie authenticated successfully

Common Flags

All login commands support the following optional flags:
--no-browser
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:
~/.switchailocal/auths/
├── gemini.json
├── claude.json
├── codex.json
└── ...
  • 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:
# Check provider health (includes auth validation)
switchAILocal heartbeat status
Expected output:
PROVIDER    STATUS     LATENCY    MODELS    MESSAGE
gemini      healthy    142ms      15        
claude      healthy    98ms       8         
ollama      healthy    12ms       3         

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
# Manual OAuth
switchAILocal --claude-login --no-browser
# Copy URL to browser, complete auth, return to terminal
Check auth directory permissions and storage backend:
# Check auth directory
ls -la ~/.switchailocal/auths/

# Verify storage backend
echo $PGSTORE_DSN    # PostgreSQL
echo $GITSTORE_GIT_URL  # Git
OAuth tokens are refreshed automatically, but you can re-authenticate:
# Re-run login to refresh credentials
switchAILocal --claude-login