mlx-dspark CLI
A local Mac server with faster generation and identical output: Claude Code and Codex run on a model on your own computer
- 737 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- A server exposed to a network without a key accepts requests from anyone who can reach port 8080
- Downloads model weights from Hugging Face and runs drafter code from third-party repositories
- `mlx-dspark claude` starts Claude Code with a replaced API address, so the actions are chosen by a local model
Install
- Works in
Manual install
pip install mlx-dsparkEngine and CLI only. Apple Silicon and Python 3.10 or newer are required. `uv pip install mlx-dspark` works too.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- A server exposed to a network without a key accepts requests from anyone who can reach port 8080
- Downloads model weights from Hugging Face and runs drafter code from third-party repositories
- `mlx-dspark claude` starts Claude Code with a replaced API address, so the actions are chosen by a local model
This is third-party code. Review the repository files before installing.
What it does
mlx-dspark runs language models on Apple Silicon through MLX and speeds up generation with speculative decoding. A helper model (the drafter) proposes several tokens ahead and the main model verifies each one, so the output matches a normal run and only speed changes. It supports DeepSeek's DSpark and z-lab's DFlash drafters. For models in the verified pair list (Gemma-4, Qwen3, Qwen3.6, Qwen3.8, LFM2.5, Ornith-1.0, Nemotron, Bonsai and others) the drafter resolves automatically from `--model`. `mlx-dspark generate` answers a single prompt, while `mlx-dspark serve` starts a local HTTP server on port 8080 with OpenAI Chat Completions, Responses and Anthropic Messages interfaces. LM Studio and other OpenAI-compatible clients connect to it. For Claude Code there is `mlx-dspark claude`: it finds the running server, passes Claude Code the address and key through the environment of that single process only, and hands over the terminal. Settings files and the account login stay untouched. For Codex you add a provider with `wire_api = "responses"` to `~/.codex/config.toml`. `mlx-dspark benchmark` measures the speedup on your Mac and `mlx-dspark doctor` checks the environment. A macOS app also exists, with chat, a model manager and a speed gauge in the menu bar.
Who it is for. For owners of Macs with Apple Silicon who want to run Claude Code, Codex or chat on a local model faster than plain MLX.
Good fit when
- You want Claude Code on Qwen3-8B 8-bit locally on your Mac: `mlx-dspark serve --model mlx-community/Qwen3-8B-8bit`, then `mlx-dspark claude`
- You want to point Codex at a local server through the Responses interface
- You need an OpenAI-compatible server for LM Studio and other clients that answers faster with no quality loss
- You want to measure what speculative decoding gives on your specific Mac with `mlx-dspark benchmark --model <repo> --trials 3`
- You must verify that output is identical to a normal run: the Mac app shows a token-by-token verdict in its Race mode
Not a fit when
- Your Mac has an Intel chip, or you use Linux or Windows: Apple Silicon is required
- You need models such as DeepSeek-V4: the project runs consumer-size models with published drafters and does not support V4
- The server must serve many users: it is built for one local user, although `--max-batch N` enables batched requests
- You need `previous_response_id` compatibility: the Responses implementation keeps no server-side state
Example request
Install mlx-dspark, start a local server with Qwen3-8B and connect Claude Code to it with mlx-dspark claudeLimitations
- Apple Silicon and Python 3.10 or newer are required. The package installs MLX 0.32.0 or newer.
- Model weights download from Hugging Face on first run and are not bundled.
- Speedup figures were measured by the author on an M4 Pro with short context; your machine will differ. For the MoE model Qwen3.6-35B-A3B the gain is small: from 1.05× to 1.67×.
- The server listens on `127.0.0.1`. To expose it to a network set `--api-key`: then every route except `GET /health` requires the key.
- The macOS app is not yet notarized by Apple: when installing from the cask you clear quarantine with `xattr`.
- The repository's last commit is from October 2026.
How to disable. Stop the server (Ctrl+C in its terminal) and run `pip uninstall mlx-dspark`. The Mac app is removed with `brew uninstall --cask mlx-dspark`. Delete the Codex provider block from `~/.codex/config.toml`.
FAQ
How do I run Claude Code on a local model on a Mac?
In one terminal run `mlx-dspark serve --model mlx-community/Qwen3-8B-8bit --no-thinking`, in another `mlx-dspark claude`. The command finds the server and starts Claude Code pointed at it. Keep the server running for the whole session.
Does speculative decoding change answer quality?
No. The main model verifies every proposed token, so output matches a normal run and only speed changes. You can check it with `mlx-dspark benchmark --model <repo> --trials 3` or the Race mode in the app.
How do I connect Codex to mlx-dspark?
Start `mlx-dspark serve`, then add a `model_providers` entry to `~/.codex/config.toml` with your server's `/v1` address and `wire_api = "responses"`. The server supports a stateless `POST /v1/responses`: Codex sends its own history.
Which models does mlx-dspark work with?
For verified pairs such as Gemma-4 12B, Qwen3-8B, Qwen3.8-27B and LFM2.5 the drafter resolves itself. For other models the `--mode auto` setting uses drafter-free n-gram lookup, and `--drafter <repo>` names your own drafter.
How is mlx-dspark different from Ollama?
Ollama runs many models on many systems, while mlx-dspark runs only on Apple Silicon through MLX and adds speculative decoding with DSpark and DFlash drafters. Client setup is the same: point the OpenAI API address to the local server.
Discussion
No questions or reviews yet.
Related
CLI toolsA local model server for Apple Silicon Macs in OpenAI, Anthropic and Ollama formats: Claude Code, Codex and OpenCode connect with one command
A vLLM-style inference server on MLX that runs language models on Apple Silicon Macs and serves them over an API
A local model server for Apple Silicon Macs: Qwen 3.8 and Gemma 4 with MTP decoding and OpenAI and Anthropic APIs for Claude Code, Codex and Cursor
An MCP server that hands bounded tasks to a local model or a cheap cloud API, while Claude stays the architect and saves tokens
llmman runs Claude Code, Codex and OpenCode on a local or hosted model with one command and stores models as OCI images
The Apple Intelligence model built into a Mac as a terminal command and a local OpenAI-compatible server: no keys, no cloud
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Repository stars | Main difference |
|---|---|---|---|
| mlx-dspark (this card) | no | 737 | |
| vllm-mlx: local LLM server for Claude Code on Mac | no | 1,654 | a vLLM-style MLX server with batching, without DSpark and DFlash drafters |
| mlx-serve | yes | 2,439 | another MLX server for local models, while this one adds speculative decoding |
| Ollama | yes | 186,866 | runs models on many systems, while mlx-dspark runs only on Apple Silicon |
README in short
The page starts with the two speculative decoding methods and a table of verified models with speedups measured on an M4 Pro. It continues with `pip` and Homebrew install, a quick start, sections on the OpenAI and Anthropic server, running Claude Code and Codex, long-context measurements and per-model results.