dexterm

docs › Use a local model with Ollama

Use a local model with Ollama

Run the analyst, your agents and paper autotrade on a free model on your own machine, with no login and no key, behind a restriction profile you choose.

dexterm can run its AI on a model on your own computer through Ollama, instead of your Claude or Codex login. There is no account, no key and no bill: the model runs on your machine and every answer costs $0. dexterm talks to Ollama on http://127.0.0.1:11434 by default, so your questions, the screen context and the tool results stay on this machine.

A local engine can do everything the Claude path does: the analyst and its skills, tune-by-chat strategy proposals, the AUTOTRADE runner's sessions, and an agent on the dexterm tools. You decide how far it may go with a restriction profile. The limits that protect money are not part of that choice: they are enforced outside the model and are the same for every engine (see what stays outside the model).

Set it up in two minutes#

1. install Ollama            https://ollama.com/download   (open it once so it runs)
2. ollama pull qwen3:8b      about 5 GB, once
3. dexterm ai engine ollama  run dexterm's AI on the local engine
4. dexterm ai model qwen3:8b
5. dexterm doctor            the "Ollama (local AI)" line should be a ✓

Then press a on a coin, or type a question, as usual. The panel title says ANALYST · ollama and the caption under an answer shows local $0. In the chat box, /engine ollama switches new conversations to the local model and /engine claude switches back.

dexterm never downloads or ships a model: you pull the one you want with Ollama.

Which model#

These are tool-capable models from Ollama's library, a good place to start. They are suggestions, not a dexterm benchmark: dexterm ai probe checks the copy you pulled.

modeldownloadnote
qwen3:8b~5 GBa good default on a 16 GB machine
qwen3:14b~9 GBsteadier tool use, needs about 16 GB free
llama3.1:8b~5 GBa widely used tool caller
mistral-small3.2~15 GBstrong tool use on a 32 GB machine

Smaller models answer faster and make more mistakes. A model with no tool calling still works for questions (see models without tool calling).

dexterm asks Ollama for a 32,768-token context window, or the model's own maximum when that is smaller. On a small machine lower it with dexterm ai ctx 16384.

Pick the engine, globally or per surface#

dexterm ai engine <auto|claude|codex|ollama> sets the engine for everything; add --surface analyst|autotrade|agent to set one surface only (for example the analyst on Claude and paper autotrade on the local model). dexterm ai status shows the engine for each surface, the local model, the profile and a quick probe; dexterm ai status --parity adds the full list of what runs where.

For the analyst the order is: --analyst-engine, then DEXTERM_ANALYST_ENGINE, then analyst.engine in config.json, then ai.json, then auto. **auto is unchanged**: Claude Code when it is installed, else Codex, else the local model once you set one up (or Ollama is installed). With none of them, the analyst says how to set up an AI backend, and dexterm doctor lists all three ways.

The settings live in ~/.dexterm/ai.json (mode 0600). Only you write it, with dexterm ai … or by hand. No MCP tool, chat message, Telegram command or model output can change it.

settinghow
enginedexterm ai engine ollama · DEXTERM_AI_PROVIDER · per surface --surface S
modeldexterm ai model <name> · DEXTERM_OLLAMA_MODEL (when none is set dexterm picks the first suggested model you pulled)
hostdexterm ai host <url> · DEXTERM_OLLAMA_HOST (default http://127.0.0.1:11434)
contextdexterm ai ctx <tokens>
profile`dexterm ai restrictions observeproposepaper · dexterm ai engine ollama --full · DEXTERM_AI_RESTRICTIONS` can only lower it

Restriction profiles#

profilethe local engine may
observeanalyse only: the read tools, no UI actions, no proposals, no orders
proposeeverything the analyst does on Claude: the read tools, the UI actions (open a coin, the screener, the watchlist, a feed, and open a PAPER ticket that you confirm), and strategy proposals you apply with a key. No orders.
paperpropose, plus paper orders: the AUTOTRADE runner's paper sessions, agent paper trading inside a mandate you armed, starting or stopping one of your parallel strategies, paper journal tags and backtest requests
fulleverything the Claude path may do, inside the same caps, mandate tiers and kill switch

**A new local setup starts at propose.** paper is one command: dexterm ai restrictions paper. **full needs a typed confirmation** on a real terminal: dexterm ai engine ollama --full explains the small-model risk and asks you to type ENABLE FULL. It is recorded for that one model: change the model and the engine runs at paper until you confirm again. Going back to a lower profile forgets the confirmation. It needs you at a real terminal: a pipe cannot confirm it.

What stays outside the model#

Whatever profile you pick, and whichever engine runs:

  • your strategy and runner caps, and the kill switch (command, hotkey, the panic file);
  • mandate tiers: arming a mandate is a physical keypress, and no model or agent can arm one;
  • the strategy clamp: every size a model asks for is cut to your strategy and your runner caps, exactly as for Claude;
  • Telegram approvals, when you use them: a one-time button, bound to a nonce, a hash and an expiry and to your account, tapped by you;
  • the prompt firewall: token names, socials and page text reach a local model wrapped as <untrusted> data, byte for byte as they reach Claude.

A model can only ask. It cannot raise a cap, arm a mandate or change its own profile. There is no live mode for it to turn on: dexterm trades on paper only.

What runs on a local model#

surfaceon the local model
analyst chat and follow-upsthe same dexterm MCP server and tools, the same firewalled context, answers streamed word by word
structured skills (dossier, rug-check, larp-check, trench-scan)the same playbook, then Ollama's structured output on the same schema
AI scan modeobserve-only, at the tool list, the MCP server and the app
Jarvis voice questionsasked through the same analyst, on whichever engine /engine picked
dexterm ask "…"a headless question on the analyst's engine
tune by chatstrategy_propose_edit / strategy_propose_new at propose; you apply with y as always
AUTOTRADE runner sessionsdexterm autotrade run <strategy> --paper --engine ollama: the same DOSSIER, DELTA and EVENT messages and the same typed decision, at paper
an agent on the dexterm toolsdexterm ai agent "<goal>", tools by profile
Telegram approvals, the agent busengine-independent: approvals are your taps; bus agents bring their own model

The Claude usage guard does not apply to a local model (no plan limit, $0); the runner's day caps on sessions and turns still do.

Models without tool calling#

If the model cannot call tools, dexterm fetches the selected coin's dossier itself and the model answers from it, and the answer starts with (… has no tool calling: answering from the dossier without tools). Structured verdicts carry a no_tools_mode flag. For tool use pull a tool-capable model (the table above).

A local model that keeps asking for a tool it does not have is refused each time (the call never runs); after three refusals the turn stops and says so.

Check your model: dexterm ai probe#

dexterm ai probe checks that Ollama answers, the model is pulled, it can call tools, and how much context it has. dexterm ai probe --json also asks it three short trading questions and checks it answers in the decision format the AUTOTRADE runner needs. It warns when the model is below the bar for your profile:

profiletool callingcontextdecision format
observeoptional≥ 4,096not needed
proposeyes≥ 8,192not needed
paperyes≥ 8,1922 of 3
fullyes≥ 16,3843 of 3

A decision a model cannot format is refused by the engine, which means fewer trades, never bigger ones.

Autotrade on a local model#

dexterm autotrade run <strategy> --paper --engine ollama (or dexterm ai engine ollama --surface autotrade) runs each candidate's session on your local model. The session has no tools: the request to Ollama never carries any, so the model can only answer. Its reply is constrained to {comment, decision} and turned into the same DECISION {…} line a Claude session writes, so the same closed schema, clamp, caps and run file apply. A reply later than the strategy's decision window is no answer. --model <name> picks another local model for the run. The run file records agent: ollama, the model and $0.

The runner needs the paper profile and refuses to start below it, with the command that raises it.

Your own agent, on the local model#

dexterm ai agent "<goal>" runs the local model as an agent on the dexterm MCP server, the way claude -p connected to dexterm mcp would: the read tools at every profile, proposals at propose, and the paper tools at paper (the server still refuses them unless you armed a mandate and turned on agent paper trading in the app). --thoughts FILE writes its words for the spectator's thought ribbon (--spectate-thoughts FILE).

Another machine#

dexterm ai host http://<machine>:11434 points dexterm at an Ollama on another computer you control. Prompts, screen context and tool results then travel over your network, and dexterm ai status, dexterm doctor and each chat answer say so. dexterm contacts no other host for the local engine. It never follows a redirect: if the host answers with one, dexterm sends nothing on, and dexterm doctor and the chat answer say the host redirected.

How we checked#

Offline tests drive a fake Ollama server through the real app paths and the real dexterm MCP server: tool round trips, the tool list each profile offers, refused calls that never run, the no-tools mode, structured verdicts, the typed full confirmation, and the doctor lines. The firewall test checks the local model receives exactly the text the Claude CLI receives. The caps test runs the same decisions through the Claude path's session interface and a local session over a recorded tape and gets identical clamps, refusals and fills. Answer quality and speed of local models against Claude have not been benchmarked.

Troubleshooting#

messagefix
ollama is not runningopen the Ollama app or run ollama serve, then dexterm doctor
no local model pulledollama pull qwen3:8b then dexterm ai model qwen3:8b
ollama model … is not pulledollama pull <model>
the local model took too longa smaller model answers faster; dexterm ai status lists yours
… did not return the structured verdictask again, or pull a larger tool-capable model
the local engine's restriction profile is propose; an autotrade run needs paperdexterm ai restrictions paper
full was confirmed for …, not …dexterm ai engine ollama --full again for the new model