Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
title: Models & routing: Claude, Codex, Grok, Ollama
description: Run bots on the Claude, Codex or Grok CLIs, API keys, local Ollama or any OpenAI-compatible server. The Laya router picks who answers, and which model.
path: docs/models.html
nav: models
card: The engines kwant runs on, and the router that picks the bot and the model.
card_art: avatar:research
---
<p class="kicker">Docs</p>
<h1>Models and routing: Claude, Codex, Grok and Ollama</h1>
<p class="intro">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.</p>
<h2 id="engines">Engines</h2>
<ul>
<li><strong>Host CLIs:</strong> <code>claude</code>, <code>codex</code> and <code>grok</code>, supervised by kwant, with their own file and shell tools.</li>
<li><strong>Provider APIs:</strong> Anthropic, OpenAI and xAI keys.</li>
<li><strong>Ollama:</strong> models you've pulled into a local <a href="#ollama">Ollama</a> server, with no account or key.</li>
<li><strong>Custom API:</strong> 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.</li>
</ul>
<p>Each bot has a preferred model. Set it to <strong>auto</strong> and kwant picks the model and effort for every message.</p>
<h2 id="ollama">Ollama (local models)</h2>
<p>kwant talks to Ollama at <code>http://localhost:11434</code>. To use another address, change <strong>Ollama Base URL</strong> under <strong>Settings → This space → Accounts</strong>, or set <code>OLLAMA_URL</code>. The engine shows as ready once the server answers and has at least one model pulled, for example with <code>ollama pull llama3.2</code>.</p>
<p>Pick Ollama in a bot's model setting to use your default model, the one in <code>OLLAMA_MODEL</code> or else the first one pulled, or pick a pulled model by name. Ollama bots can use <a href="mcp.html">MCP tools</a>. 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.</p>
<h2 id="accounts">Accounts</h2>
<p>Each engine can have several accounts, with a default, a priority order and automatic failover when one runs out of usage. See <a href="accounts.html">Accounts & profiles</a>.</p>
<h2 id="laya">The Laya router</h2>
<p><a href="https://huggingface.co/convaiinnovations/laya" rel="noopener">Laya</a> helps pick which bot answers in a channel (see <a href="bots-and-teams.html#how-routing-picks">how kwant picks</a>), and picks which model and effort a bot set to auto uses. It's a small Python service, and <code>kwnt serve</code> manages it for you:</p>
<ol>
<li>On first run it installs <code>laya[serve]</code> into <code>~/.kwnt/laya/venv</code>, with <code>uv</code> when present or <code>python3 -m venv</code> otherwise.</li>
<li>It starts <code>laya-serve</code> and downloads the English checkpoint (about 420 MB) on first start.</li>
<li>It restarts Laya if it exits, and stops it when kwant shuts down.</li>
</ol>
<p>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.</p>
<div class="table-wrap"><table>
<thead><tr><th>Setting</th><th><code>config.toml</code></th><th>Environment</th><th>Default</th></tr></thead>
<tbody>
<tr><td>Laya URL</td><td><code>laya_url</code></td><td><code>LAYA_URL</code></td><td><code>http://127.0.0.1:8000</code></td></tr>
<tr><td>Manage a local Laya</td><td><code>laya_managed</code></td><td><code>KWNT_LAYA_MANAGED=0</code> or <code>--no-laya</code> to disable</td><td>on</td></tr>
<tr><td>Checkpoints to preload</td><td><code>laya_models</code></td><td><code>KWNT_LAYA_MODELS</code></td><td><code>english</code></td></tr>
<tr><td>Existing <code>laya-serve</code></td><td></td><td><code>KWNT_LAYA_SERVE_BIN</code></td><td></td></tr>
</tbody>
</table></div>
<p>kwant only starts Laya for loopback URLs. If Laya already answers, for example from Docker, kwant uses it as is.</p>
<div class="note"><strong>Behind a proxy that blocks Hugging Face?</strong> Start kwant once on an open network, or copy an existing <code>~/.kwnt/laya/hf</code> from another machine. After that, Laya starts offline.</div>