Introduction
switchAILocal uses a YAML configuration file (config.yaml) to control all aspects of server behavior, provider integration, routing, and security. The configuration system is designed to be flexible, supporting everything from simple local setups to complex enterprise deployments.
Configuration File Location
By default, switchAILocal looks forconfig.yaml in the current working directory. You can specify a custom location:
Getting Started
switchAILocal includes a comprehensive example configuration file that documents all available options:config.yaml to customize settings for your environment.
The example configuration includes inline comments explaining each setting. Use it as a reference when building your own configuration.
Configuration Structure
The configuration file is organized into logical sections:Core Sections
Server Settings
Host, port, TLS, authentication, and core server behavior
Provider Configuration
API keys and settings for cloud and local AI providers
Security & Access
API keys, management access, authentication, and TLS
Intelligent Routing
Cortex router with semantic matching and auto-discovery
YAML Basics
switchAILocal configuration uses standard YAML syntax:Environment-Specific Overrides
While switchAILocal doesn’t directly support environment variable overrides, you can:-
Use multiple config files for different environments:
-
Template with environment variables (using external tools):
Hot Reload
switchAILocal automatically detects configuration changes and reloads most settings without requiring a restart:Hot-reloadable settings
Hot-reloadable settings
- Provider API keys and credentials
- Model aliases and mappings
- Routing strategy changes
- Intelligence matrix updates
- Proxy settings
- OAuth excluded models
Validation
switchAILocal validates configuration on startup and during hot reload:- Missing required fields: Logged as warnings, defaults applied
- Invalid values: Configuration loading fails with detailed error
- Deprecated settings: Automatically migrated to new format
Configuration Persistence
When certain settings are updated (like management secret key hashing), switchAILocal automatically persists the changes back toconfig.yaml while preserving:
- Comments and formatting
- Key ordering
- YAML structure