Multi-Model Routing¶
SalmAlm supports 6 AI providers with automatic task-based routing — the right model for each message.
Supported Providers¶
| Provider | Models | Key |
|---|---|---|
| Anthropic | Claude Haiku, Sonnet, Opus | ANTHROPIC_API_KEY |
| OpenAI | GPT-4o, GPT-4o-mini, o1 | OPENAI_API_KEY |
| Gemini 2.5 Flash/Pro | GOOGLE_API_KEY |
|
| xAI | Grok | XAI_API_KEY |
| DeepSeek | DeepSeek Chat/Reasoner | DEEPSEEK_API_KEY |
| Local LLM | Ollama, LM Studio | LOCAL_LLM_URL |
Auto Routing¶
When model is set to auto, SalmAlm classifies each message into complexity tiers:
Classification¶
| Tier | Examples | Default Model |
|---|---|---|
| Simple | Greetings, yes/no, short questions | Claude Haiku (12x cheaper) |
| Moderate | Explanations, summaries, analysis | Claude Sonnet |
| Complex | Multi-step code, architecture, debugging | Claude Sonnet |
Classification uses keyword matching + heuristics (code blocks, question complexity, message length).
Cost Impact¶
Fixed Model¶
Set a specific model via:
- Web UI: Model panel dropdown
- Command:
/model anthropic/claude-sonnet-4-20250514 - API:
POST /api/model/switch
Per-Session Override¶
Each session can have its own model:
Provider Key Fallback¶
SalmAlm tries providers in order:
- Vault-stored API key
- Environment variable
- CLI OAuth token (if
SALMALM_CLI_OAUTH=1)
If a provider key is missing, that provider's models are excluded from routing candidates.
Configuration¶
Web UI¶
Settings → Engine Optimization → Auto Routing panel shows:
- Current tier assignments
- Per-tier model selection
- Cost comparison with OpenClaw
- Classification guide