mlx-optiq
Introducing OptiQ Code

The best coding agent for local models on a Mac

Point it at a repo, describe a change, and watch a model you are running yourself edit the code and get the tests green. No cloud, no API key, no per-token bill.

OptiQ Code is a coding agent that lives in your terminal and runs on your own model. It drives whatever optiq serve is serving, a 4-bit quant on your MacBook or a 27B on a Mac Studio, through the same read, edit, run-tests loop you would expect from a cloud agent. Everything stays on your machine.

terminalbash
$ pip install mlx-optiq
$ optiq serve --model mlx-community/Qwen3.6-27B-OptiQ-4bit --idle-timeout 300
$ cd my-project && optiq code

Why run the model yourself

Cloud coding agents are excellent. They also send your code to someone else's computer and bill you by the token. For plenty of work that trade is fine. For a private repo, an offline machine, or a long agent loop you would rather not meter, it is not. A local model drops the meter and the network. The catch has always been that local models are weaker, and weaker models fail in ways a strong one hides.

Built for the model you actually have

A small model often reasons its way to the right fix and then loses it on the mechanics. A diff that will not apply. A turn spent re-reading the same file. An empty patch on the last step. OptiQ Code spends its engineering there, not on another prompt.

  • It never returns an empty patch. Every way the loop can end salvages the working git diff. Out of turns, crashed, or stopped by the clock, your change still comes back.
  • It recovers from a bad edit. When an exact-match edit keeps missing, the harness stops retrying and asks for a full-file rewrite instead of dead-ending.
  • It refuses to stall. Reading without editing, or repeating itself, trips a nudge: make one small, testable change, then run the tests.
  • It tolerates messy output. ANSI is stripped, and a tool call the model wrote as text instead of a structured call still runs.
OptiQ Code running a task in the terminal
Working through a task: inline tool markers, a live diff, and a test run.

Watch it edit itself

The honest test of a coding agent is whether it can work on its own code. Here OptiQ Code, driven by a local 27B, adds a feature to its own tools.py and turns a planted test green.

OptiQ Code editing OptiQ Code, on a local Qwen3.6-27B-OptiQ-4bit.

Proven on real bugs

Reliability here is a measured result, not a slogan. An initial version of OptiQ Code, driving a 4B local model, resolved 36% of a SWE-bench-Lite subset, a state-of-the-art result for a model that size. The resolve rate matters less than what sits underneath it: a valid patch on every task. A comparable-budget baseline came up empty on 40%. That gap is the point. A stronger local quant lifts the resolve rate, and the reliability is there from the start.

Approve every edit, or let it run

Read-only tools always run. Anything that touches your files pauses for a single keystroke, so you stay in the loop by default. Trust the repo, or running unattended? Auto mode skips the prompts.

OptiQ Code approval prompt
Single-Enter approval before a write. Deny it and the model tries another way.

It remembers

Every run is saved per repo. Pick up where you left off with optiq code -c and the model keeps its context. Export any session as a shareable trace with optiq code export, handy for a bug report or for building a dataset from your own work.

Bring your best local model

OptiQ Code drives whatever you serve, so it gets better as your model does. For the best results, use the OptiQ quant with the highest Capability Score your Mac can run. In general that is Qwen3.6-27B-OptiQ-4bit.

Get started

terminalbash
$ pip install mlx-optiq
$ optiq serve --model mlx-community/Qwen3.6-27B-OptiQ-4bit --idle-timeout 300
$ cd my-project && optiq code

# or headless, for scripts and CI
$ optiq code -p "Fix the failing test in parser.py"

The OptiQ Code guide covers approval modes, sessions, the tool set, and headless use. The product page has the full picture.