Skip to content

Start // Local Model TUI

Point ostk at a model running on your machine. ostk's TUI becomes the chat surface, while kernel-mediated audit, capability bounds, and local project state remain available. Tool support and context behavior still depend on the selected model and integration.

01
Verify install and run ostk init in your project (universal steps from /start).
02
Pick a backend. ollama is the cross-platform default; mlx is an option on Apple Silicon only (faster on M-series, kernel-managed mlx_lm.server lifecycle).
03
Pull or load a model. Tool-capable models recommended — not every local model supports function calling.
04
Spawn an agent with the model alias. ostk routes inference to the local server; ostk-mediated tools retain audit and pin-cap enforcement.
05
Open ostk tui to chat. First response is slower (model warm-up); subsequent calls are fast.

Total time: ~15 minutes (most of it is model download). You need ostk v7.7.7+ and either ollama or mlx_lm installed locally.

The TUI takes your prompt and routes it to the kernel daemon. The MLX route hands inference to a kernel-managed mlx_lm.server, and the response streams back into the chat surface. The inference path requires no model API key, and canonical project state remains local. Other configured tools can still use the network; if Anthropic credentials are available, an anchored ostk-managed session can also make best-effort Anthropic Files copies of drains or context pages. Those copies are optional for correctness.

OSTK_TUI

Real session. Two turns, no edits. Ternary-Bonsai-8B-mlx-2bit on Apple Silicon, lazy-spawned by the kernel's native MLX driver on first prompt.

Run on ollama (default path)

ollama runs models on macOS, Linux, and Windows. It exposes an OpenAI-wire HTTP server at localhost:11434 by default. ostk's OpenAI-wire driver routes models prefixed ollama/ or local/ to that endpoint.

Source: src/cpu/providers.rs:74 (Ollama prefix routing), src/cpu/openrouter.rs (OpenAI-wire client).

1.1

Install ollama

TERMINAL
# macOS / Linux
$ curl -fsSL https://ollama.com/install.sh | sh

# Or via Homebrew
$ brew install ollama

ollama auto-starts a daemon on macOS. On Linux, run ollama serve in a separate terminal.

1.2

Pull a tool-capable model

Not every model on ollama supports function calling — and ostk needs function calling to dispatch tool calls. Verified-capable picks:

qwen2.5-coder:32b strong tool support, ~20GB on disk, ~32GB RAM at runtime
qwen2.5-coder:7b ~5GB on disk, fits on 16GB-RAM laptops, weaker tool reasoning
llama3.1:70b strong general, ~40GB on disk, needs ~64GB RAM
llama3.1:8b solid baseline, ~5GB on disk, fits on 16GB-RAM laptops
deepseek-r1:70b does NOT support tools — will fail

Tool support is per-model and per-build. Verified 2026-04. Check ollama list --json | jq '.models[].capabilities' for the current state on your machine.

TERMINAL
$ ollama pull qwen2.5-coder:32b
pulling manifest
pulling [================] 19.8 GB
verifying sha256
ok
1.3

Spawn an agent with the local model

Pass the model alias prefixed with ollama/:

TERMINAL
$ cd ~/projects/your-repo
$ ostk init  # skip if already done

$ ostk _agent --name worker --model ollama/qwen2.5-coder:32b \
  --budget 10 \
  --task "Explain the structure of this repo"

The --budget is a USD cap (10 means $10). For local models the dollar bound is symbolic — there's no per-token cost — but the field is required and 0 / unlimited / negative are rejected at parse time. _agent is the lowest-level spawn primitive (hidden in --help); most users go through ostk tui or an Agentfile via ostk run. Source: src/main.rs:1057-1073, src/commands/agent_cmd.rs:239.

Run on Apple mlx (Apple Silicon only)

Apple's mlx framework runs quantized models on M-series chips. On M-series hardware mlx is typically faster than ollama for the same model size. ostk has a native Mlx CPU driver — a peer of the Anthropic and Ollama drivers, with its own kernel-managed lifecycle for mlx_lm.server. On first use of an mlx/-prefixed model the kernel auto-spawns the server, polls it ready, and pins a pidfile + log + flock under .ostk/mlx/<port>.{pid,log,lock}. The default model is Ternary-Bonsai-8B, a ternary-quantized model purpose-built for low-latency local inference.

Source: src/cpu/providers.rs:22-27 (ApiProvider::Mlx), src/cpu/mlx_lifecycle.rs:25-34 (MlxRuntime + ensure_running), src/commands/mlx.rs:22-46 (operator verbs).

2.1

Install mlx_lm

The kernel manages the mlx_lm.server process for you, but the Python package that provides it still needs to be on your PATH:

TERMINAL
# Apple Silicon Mac required
$ pip install mlx-lm
2.2

Spawn an agent — the kernel starts the server for you

There is no separate "start mlx_lm.server" step. On the first mlx/ model invocation the kernel runs ensure_running: it probes localhost:11942, and if the server isn't already up it spawns mlx_lm.server --port 11942 --model <wire-id> detached, polls /v1/models until ready, and pins the pid + model under .ostk/mlx/. Concurrent ostk sessions on the same project coordinate via flock and share one server.

TERMINAL
$ ostk _agent --name worker --model mlx/ternary-bonsai-8b \
  --budget 10 \
  --task "Write a unix one-liner that tails a log and only shows ERROR lines"

First call pays the cold-spawn cost (a few seconds on M-series). Subsequent calls reuse the running server. The alias mlx/ternary-bonsai-8b resolves to the wire model-id from the kernel's MLX driver registry (HUMANFILE mlx_drivers entry, or per-process override via MLX_MODEL_ID; default prism-ml/Ternary-Bonsai-8B-mlx-2bit). Same --budget semantics as the ollama path. Source: src/cpu/mlx_lifecycle.rs:1-14 (lifecycle doc), src/cpu/providers.rs:69-72 (mlx/ prefix routing).

2.3

Operator verbs: ostk mlx

The kernel handles spawn-and-reuse on its own. When you need to inspect or override that — see what's running, switch the model, read the server log, stop a process — use the ostk mlx subcommand:

TERMINAL
# What's running, on which port, serving which model
$ ostk mlx status
PORT     HEALTH      PID       MODEL
11942    ready       57843     prism-ml/Ternary-Bonsai-8B-mlx-2bit

# Explicit start (normally implicit on first agent invocation)
$ ostk mlx start --model mlx-community/Qwen2.5-Coder-32B-Instruct-4bit

# Tail the server log
$ ostk mlx log --port 11942

# Stop one or all
$ ostk mlx stop --port 11942
$ ostk mlx stop --all

# Locally-cached mlx model weights (under ~/.cache/huggingface)
$ ostk mlx models
prism-ml/Ternary-Bonsai-8B-mlx-2bit
mlx-community/Qwen2.5-Coder-32B-Instruct-4bit

Tool calls on mlx models come back inside the text output, not as a separate structured field — quantized models often skip the structured envelope. ostk extracts them either way. Source: src/commands/mlx.rs:39-46 (Action enum), src/main.rs:1382 (MlxCommands).

Tool support is per-model Some local models (notably reasoning-only models like deepseek-r1) cannot emit tool calls. ostk will report "API error 400: model does not support tools." Switch to a tool-capable model.
Latency is higher A 32B-parameter model on a laptop is slower than Sonnet over the wire. First response includes model warm-up. Subsequent calls are fast — mlx tracks a LocalKV prompt cache; ollama relies on its own server-side warmth.
Context window is smaller Hosted Sonnet has 200k tokens; ollama models default to 128k (ostk's per-driver declared window — effective context depends on model + quantization); mlx Bonsai is 65k declared but lower in practice (see /docs/models). Long sessions hit context limits sooner — type :clear in the TUI to cycle context (tack verbs are TUI commands prefixed with a colon; see /docs/tack-grammar).
Local inference is not a global egress switch Ollama and MLX keep model inference on this machine, and canonical project state remains local. Web tools, downloads, outbound drivers, or configured provider-backed context features can still use the network. Anthropic-style fleet prompt-cache reuse does not apply to the local model route.
Quantization affects quality Generic mlx-2bit quants of full-precision models lose accuracy on coding tasks; prefer mlx-4bit or mlx-fp16 for those. Ternary-Bonsai is different — it is quantization-aware ternary, designed to run at low precision; the 2-bit variant is the intended deployment. ollama defaults to Q4_K_M which is a good general balance.
"streaming error: request failed (localhost:11434)" ollama daemon is not running. macOS: open Ollama.app or run `ollama serve`. Linux: `systemctl --user start ollama` or `ollama serve` in another terminal.
"model does not support tools" Your model has no function-calling. Switch: `ostk _agent ... --model ollama/qwen2.5-coder:32b`.
"connection refused (localhost:11942)" mlx_lm.server is not running. Start it with `MLX_MODEL_ID=... mlx_lm.server --port 11942`.
Agent hallucinates tool calls but never invokes them mlx/ollama emit Hybrid-style tool calls (text-form). ostk parses them via extract_text_tool_calls. If the model is too small (<7B), it may emit malformed tool blocks. Try a larger model.
Out of memory during pull Disk space, not RAM. ollama models are 5–40 GB. Delete with `ollama rm <model>`.
Out of memory during inference Pick a smaller quantization (q4 instead of q8) or a smaller model (7b instead of 32b). Quality drops with quantization (see Caveats); 4-bit is the usual sweet spot.
ollama or olleh on a non-default port Set OLLAMA_HOST=http://localhost:NNNN (or OLLEH_HOST) before invoking ostk; the kernel reads these at driver-construction time. Source: src/cpu/mod.rs:834,988,996.