Models & routing Docs menu
Docs
Models and routing: Claude, Codex, Grok and Ollama
Bots run on the CLIs you already use, on API keys or on your own server. The Laya router picks who answers in a channel, and which model and effort a bot set to auto uses.
Engines
- Host CLIs:
claude,codexandgrok, supervised by kwant, with their own file and shell tools. - Provider APIs: Anthropic, OpenAI and xAI keys.
- Ollama: models you've pulled into a local Ollama server, with no account or key.
- Custom API: any server that speaks the OpenAI chat API (OpenRouter, LM Studio and others; the NVIDIA preset fills in build.nvidia.com, whose models are free with an NVIDIA API key) or the Anthropic Messages API. Requests to OpenRouter name kwant as the app (https://kwant.si), so they count on OpenRouter's app page. Nothing about you or your space is sent.
Each bot has a preferred model. Set it to auto and kwant picks the model and effort for every message.
Ollama (local models)
kwant talks to Ollama at http://localhost:11434. To use another address, change Ollama Base URL under Settings → This space → Accounts, or set OLLAMA_URL. The engine shows as ready once the server answers and has at least one model pulled, for example with ollama pull llama3.2.
Pick Ollama in a bot's model setting to use your default model, the one in OLLAMA_MODEL or else the first one pulled, or pick a pulled model by name. Ollama bots can use MCP tools. When a bot is set to auto and a message asks to keep things on this machine, for example "keep this private" or "offline", the router can keep it on Ollama, if Ollama is ready.
Accounts
Each engine can have several accounts, with a default, a priority order and automatic failover when one runs out of usage. See Accounts & profiles.
The Laya router
Laya helps pick which bot answers in a channel (see how kwant picks), and picks which model and effort a bot set to auto uses. It's a small Python service, and kwnt serve manages it for you:
- On first run it installs
laya[serve]into~/.kwnt/laya/venv, withuvwhen present orpython3 -m venvotherwise. - It starts
laya-serveand downloads the English checkpoint (about 420 MB) on first start. - It restarts Laya if it exits, and stops it when kwant shuts down.
The header shows the router's status: green online, amber installing or loading, red offline. While Laya is unavailable, kwant routes by keyword and says so on the routing card.
| Setting | config.toml | Environment | Default |
|---|---|---|---|
| Laya URL | laya_url | LAYA_URL | http://127.0.0.1:8000 |
| Manage a local Laya | laya_managed | KWNT_LAYA_MANAGED=0 or --no-laya to disable | on |
| Checkpoints to preload | laya_models | KWNT_LAYA_MODELS | english |
Existing laya-serve | KWNT_LAYA_SERVE_BIN |
kwant only starts Laya for loopback URLs. If Laya already answers, for example from Docker, kwant uses it as is.
~/.kwnt/laya/hf from another machine. After that, Laya starts offline.