OptiQ Code
OptiQ Code is a terminal coding agent that drives whatever model optiq serve is serving, on your Mac, fully offline. It is engineered for the operational reality of small local models: it never ships an empty patch, recovers from a failed edit, forces progress when a model stalls, and records every session for resume and export.
This guide continues in five more pages: Approval & permissions, Sessions & traces, Headless & CI, the Tools reference, and Robustness.
Install & launch
textual and openai ship with the wheel, so there is nothing extra to install. OptiQ Code talks to optiq serve over the OpenAI Chat Completions API and discovers the served model automatically.
$ pip install mlx-optiq # serve a model once, freeing its RAM after 5 min idle $ optiq serve --model mlx-community/Qwen3.6-27B-OptiQ-4bit --idle-timeout 300 # launch in a repo (or: optiq code PATH) $ cd my-project && optiq code
If no server is running, OptiQ Code tells you how to start one. Point it at a server on another port or host with OPTIQ_BASE_URL, or pass --model to have it spawn one for you.
How the loop works
Each turn, the agent calls the model, runs whatever tools the model asks for, and feeds the results back. It grounds a change by reading the relevant files, makes an edit, runs your tests, and reads the pass/fail count, so both it and the stall detector track real progress rather than text. It keeps going until the model calls done, the tests pass, or a limit is hit. The working git diff is the source of truth for what changed, salvaged on every exit path. The mechanics of that resilience are covered in Robustness.
Configuration
| Flag / env | Effect |
|---|---|
| optiq code [PATH] | Launch the interactive TUI in a repo (default: current dir) |
| --model | Serve and drive this model if no server is already running |
| -p / --print | Headless run toward a goal, then exit (see Headless) |
| -c / --continue | Resume the most recent session in this repo |
| -r / --resume <id> | Resume a specific session by id |
| OPTIQ_BASE_URL | Point at a server on another port or host |
| OPTIQ_API_KEY | Bearer token for the server (default sk-optiq-local) |
Choosing a model
optiq serve is serving. For best results, use the OptiQ quant with the highest Capability Score your Mac can run; in general Qwen3.6-27B-OptiQ-4bit is the best pick. Coding wants the answer, not the monologue, so serve a no-think variant when the model supports it.Track record
An initial version of OptiQ Code, driving a 4B local model, resolved 36% of a SWE-bench-Lite subset, state of the art at that size, with a valid patch on every task, versus 40% empty for a comparable-budget baseline. A stronger local quant lifts the resolve rate; the reliability is there from the start. See the product overview.