Skip to content

Local models

A local model runs on a computer you control instead of a cloud provider: your laptop, or a shared machine such as a Mac mini or a GPU box. Use one to keep model traffic on your own hardware, to try open models, or to avoid per-token charges.

Only the model calls go to that machine. The rest of the agent stays on VirtuAI: its system prompt, tools, knowledge bases, skills, memory and conversation history. The machine connects to VirtuAI through the VirtuAI CLI, so it needs no inbound ports or public address.

A local agent answers on every channel: web chat, Slack, Telegram, Google Chat, A2A, the CLI and OpenCode.

  • A machine with the VirtuAI CLI 1.0.4 or newer (current: 1.0.27), installed with local support, and Python 3.11 or newer. The CLI inside VirtuAI Desktop has no local support, so a computer that serves local models runs virtuai run from a CLI installed with [local] instead.
  • One of these model servers on the same machine:
    • Ollama 0.40 or newer, on macOS, Linux or Windows.
    • oMLX, on a Mac with Apple Silicon.
  • Enough memory for the model. The validated models below need 5 to 10 GB, so a 16 GB Mac runs them.
  • An agent you can edit, and a cloud model the agent can fall back to. The workspace needs that cloud provider’s API key in Workspace settings.
  1. Install the CLI with local support.

    Terminal window
    pipx install 'virtuai-cli[local]'

    If you already have the CLI, reinstall it with the extra: pipx install --force 'virtuai-cli[local]'. With pip, run pip install -U 'virtuai-cli[local]'.

  2. Install the model server and get a model. For Ollama:

    Terminal window
    ollama pull qwen3:8b

    For oMLX, download the model in oMLX and note its ID, for example Qwen3-8B-4bit. The runner finds oMLX’s address and API key in oMLX’s own settings, and the key never leaves your machine.

  3. Pair the machine with your workspace. In VirtuAI, open Settings, find Local CLI and select Pair local CLI. Run the command it shows:

    Terminal window
    virtuai pair <CODE> --server https://<your-virtuai-host>

    The pairing belongs to you. Each person who wants their own machine to answer pairs it themselves.

    After pairing, the CLI offers to set up the command check for virtuai chat. It uses a small model, tev1:0.8b, in the same Ollama. It isn’t a model for your agents, and it doesn’t answer their turns. You can decline it.

  4. Start the runner and leave it running.

    Terminal window
    virtuai run

    virtuai chat and virtuai ask start a runner of their own, so you don’t need virtuai run while you use those. To answer on other channels, keep virtuai run open.

  5. Point the agent at the model. In the agent’s Model tab:

    • Set Provider to Local (Ollama) or Local (oMLX).
    • Type the model in Model: the Ollama tag you pulled, such as qwen3:8b, or the oMLX model ID, such as Qwen3-8B-4bit.
    • Choose a Fallback provider (cloud) and a Fallback model. Both are required.

    Changes save as you make them; publish the agent if it uses drafts.

  6. Try it. Send the agent a message from web chat or any channel it’s on. The answer comes from your machine. If you see a notice that the local model is unavailable, see When the cloud answers.

These models were measured on a 16 GB Mac with Ollama 0.40 and got all 10 tool-calling tasks right:

Model Memory Typical answer
qwen3:8b 6.6 GB 2.2 s
qwen2.5:7b 5.0 GB 3.5 s
qwen2.5-coder:7b about 5 GB 4.4 s
qwen2.5:14b 10.3 GB 6.0 s

On oMLX, Qwen3-8B-4bit gave the same results at about 2.5 s per answer.

Start with qwen3:8b. Other models run, but VirtuAI doesn’t vouch for them:

  • qwen3:4b is accurate but slow, because it reasons before every tool call.
  • Gemma 3 is never used, because Ollama can’t call tools with it. The cloud fallback answers instead.
  • Older Ollama versions hold the same model in two to three times the memory. virtuai run warns you when it finds one older than 0.40.

Each model call goes to the first of these that has the model:

  1. The runner of the person the turn is for. VirtuAI knows who that is when they’re signed in to web chat, the CLI or OpenCode, on Slack and Google Chat by their email, and on Telegram once they link their account.
  2. A workspace inference host. A runner started with --serve-models workspace answers anyone’s turns in the workspace.
  3. The agent’s cloud fallback, when no runner can serve the model.

Choose what a runner serves when you start it:

Terminal window
virtuai run # your own turns only (the default)
virtuai run --serve-models workspace # anyone's turns: a shared host for the team
virtuai run --serve-models none # run commands and files only, no model turns

Your laptop never answers a colleague’s turns unless you start it with workspace. Turns from people VirtuAI can’t match to a workspace member, such as people on Telegram or A2A callers, are answered by a workspace inference host or by the cloud fallback.

The runner tells VirtuAI which models it has every minute, so a model you pull while it runs is used without restarting. With local support installed, it also estimates which of your models fit the machine’s memory, and VirtuAI doesn’t send a model to a machine that can’t hold it.

If no runner can serve the model, or the runner fails before it starts answering, for example because Ollama stopped, the cloud fallback answers that call instead of returning an error. The person is told once per turn:

  • In web chat, a notice reads Local model unavailable — using followed by the fallback model.
  • On other channels, the reply includes a line that reads Modelo local no disponible: responde followed by the fallback model.

Check that the runner is running (virtuai status), that the model server is running, and that the model is pulled on that machine.

A model that fits on a laptop has a small context window and makes more mistakes with tools than a cloud model. VirtuAI adjusts the agent for it:

  • A lighter deep harness. A deep agent on a local model keeps its files, commands, tools, skills, memory and sub-agents, but drops the to-do list and the general-purpose helper sub-agent, and sends shorter instructions. That cuts the fixed text sent with every call by about 90%, so answers start much sooner.
  • Compact tool descriptions. Tools are described in a sentence. When an agent has so many tools that even that wouldn’t fit, the model sees each tool’s name first and gets its full description the first time it calls it.
  • Tool calls written as text are recovered. Small models sometimes write a tool call as text instead of making it. VirtuAI turns those into real calls, so raw JSON never reaches the person, and it hides the model’s internal reasoning.
  • Mistakes get a second chance. A call with wrong arguments gets a one-line explanation so the model can fix it. A reply that only announces an action (“I’ll look for the file…”) without taking it gets one more try.
  • Runaway loops stop. The same call repeated in a row reuses the first result. After 3 failed tool calls in a turn, the model explains what is missing. After 12 rounds of tool calls in a turn, it answers with what it has.

VirtuAI asks the model server for a 16,384-token (16K) context window on each machine. When the conversation gets close to that, VirtuAI summarizes the older part and keeps the most recent part, so the model always gets the agent’s instructions in full.

  • To use a smaller window on a machine with little memory, set OLLAMA_NUM_CTX on that machine before starting the runner.
  • If a model doesn’t fit fully on the machine’s GPU at that size, the runner halves its window on that machine, down to 4,096 tokens, and tells VirtuAI in the same reply. Later calls are sized to fit.
  • Ollama keeps the model loaded for 30 minutes after its last call. The first answer after that takes longer while the model loads.

A local model costs nothing in VirtuAI’s usage and cost figures. Usage by a cloud model in the same turn is recorded under that cloud model and counts toward its budgets: the cloud fallback when it answers, and any sub-agent that uses a cloud model.

Variable Default What it does
VIRTUAI_SERVE_MODELS own Whose turns this runner answers: own, workspace or none. Same as --serve-models.
OLLAMA_BASE_URL http://localhost:11434 Where the runner reaches Ollama.
OLLAMA_NUM_CTX not set A smaller context window for this machine.
VIRTUAI_OMLX_URL from oMLX’s settings, else http://127.0.0.1:8000 Where the runner reaches oMLX.
OMLX_API_KEY from oMLX’s settings oMLX’s API key. It stays on this machine.
VIRTUAI_MAX_CONCURRENT_MODEL 1 How many answers the runner generates at once. Raise it for oMLX on a shared host.

Every answer comes from the cloud model : Check that virtuai run is running on a machine with the model, that Model matches the tag or ID exactly, and that the model server is running. For people other than you, start a workspace inference host.

The first answer is very slow : The model is loading into memory. Later answers are faster. If every answer is slow, use a smaller model or update Ollama to 0.40 or newer.

The agent forgets earlier parts of a long conversation : The conversation was summarized to fit the local context window. For long sessions, use a machine with more memory or a cloud model.