Skip to main content

Overview

The main switchAILocal command starts the proxy server that provides OpenAI/Gemini/Claude compatible API interfaces for CLI models.

Usage

Server Flags

string
default:"config.yaml"
Path to the configuration file. The server looks for config.yaml in the current working directory by default.
string
Server password for authentication. For security, prefer using the SERVER_PASSWORD environment variable instead.
Using --password on the command line exposes the password in process listings. Use environment variables for production.
string
Google Cloud Project ID for Gemini API access. Only required when using Vertex AI or project-specific Gemini endpoints.

Environment Variables

The server supports extensive configuration through environment variables, especially for cloud deployments.

Storage Backends

Enable centralized token storage using PostgreSQL:
string
PostgreSQL connection string
string
Database schema name (optional)
string
Local spool directory for cached data
Enable version-controlled token storage using Git:
string
Git repository URL for token storage
string
Git username for authentication
string
Git access token (personal access token or password)
string
Local path for git repository clone
Enable S3-compatible object storage for tokens:
string
S3-compatible endpoint URL (supports http:// or https://)
string
Access key ID
string
Secret access key
string
Bucket name for token storage
string
Local cache directory

Cloud Deployment

string
Set to cloud to enable cloud deployment mode. In this mode, the server waits for configuration before starting.

Examples

Output

When the server starts successfully, you’ll see:

Security Considerations

The server performs security validation on startup:
  • File Permissions: Configuration and auth files should have restrictive permissions (600 or more restrictive)
  • Path Traversal: File paths are validated to prevent directory traversal attacks
  • Sensitive Data: Passwords and tokens in error messages are automatically sanitized
  • Environment Variables: Sensitive environment variables are checked for common security issues

Configuration Precedence

The server loads configuration in the following order:
  1. PostgreSQL Store (if PGSTORE_DSN is set)
  2. Object Store (if OBJECTSTORE_ENDPOINT is set)
  3. Git Store (if GITSTORE_GIT_URL is set)
  4. Local File (specified via --config or default config.yaml)
When multiple storage backends are configured, PostgreSQL takes highest precedence.