feat: sync PROVIDER_NAMES with config schema and update README docs

Extract MODEL_PROVIDERS const from config schema as single source of truth
for provider names. PROVIDER_NAMES in TUI commands now imports from schema
instead of maintaining a hardcoded list. Adds tests verifying sync.

Updates README TUI Commands section with /model hot-swap documentation,
supported providers, and runtime model switching examples.
This commit is contained in:
William Valentin
2026-02-10 21:26:18 -08:00
parent 27ee3b2c10
commit 25482b8516
5 changed files with 74 additions and 9 deletions
+31 -4
View File
@@ -185,19 +185,46 @@ pnpm tui:fs
| Command | Description |
|---------|-------------|
| `/help` | Show help |
| `/model` | Show all model tiers and which is active |
| `/model <tier>` | Switch active tier (`local`, `default`, `fast`, `complex`, or aliases `ollama`, `sonnet`, `haiku`, `opus`) |
| `/model <tier> <provider/model>` | Hot-swap a tier's provider and model at runtime |
| `/backend [provider]` | Show or switch local backend (`ollama`, `llamacpp`) |
| `/login [provider]` | Authenticate with GitHub (OAuth device flow) |
| `/reset` | Clear history |
| `/status` | Show session info |
| `/compact` | Compact conversation context |
| `/usage` | Show token usage and cost |
| `/verbose` | Toggle verbose output mode |
| `/local` | Switch to local model |
| `/cloud` | Switch to cloud model |
| `/model` | Show model info and options |
| `/pair` | Generate/list/revoke DM pairing codes |
| `/fullscreen` | Switch to fullscreen mode |
| `/transfer telegram` | Transfer session to Telegram |
| `/transfer <dest>` | Transfer session to another frontend |
| `/quit` | Exit |
#### Runtime Model Switching
Switch providers and models on the fly without editing config or restarting:
```bash
# Show current tiers
/model
# Switch active tier
/model fast
/model complex
# Hot-swap a tier's provider/model
/model default anthropic/claude-sonnet-4
/model default zhipuai/glm-4.7
/model fast github/gpt-4o-mini
/model local ollama/glm-4.7-flash
```
The provider name must match a supported provider (`anthropic`, `openai`, `gemini`, `ollama`, `llamacpp`, `openrouter`, `bedrock`, `github`, `zhipuai`, `xai`). Tab completion is available for both tiers and provider names.
For cloud Zhipu models, ensure `ZHIPUAI_API_KEY` is set or `api_key` is configured in the relevant tier.
**Note:** The `/model` command works in the TUI only. WebChat sessions inherit the active tier from the daemon.
## Running as Service
```bash