The fastest way to run LLMs in Node.js on Apple Silicon.
npm install node-mlx
npx node-mlx "What is 2+2?"Requirements: macOS 14+ (Sonoma) on Apple Silicon (M1/M2/M3/M4), Node.js 20+
🚀 2× faster than node-llama-cpp on Apple Silicon 🧠 Unified memory – no CPU↔GPU copying overhead 📦 Zero config – just npm install and you're ready
import { generate } from "node-mlx"
const result = generate("qwen", "Explain quantum computing:", {
maxTokens: 200,
temperature: 0.7
})
console.log(result.text)
console.log(`${result.tokensPerSecond} tok/s`)| Provider | Models | Status |
|---|---|---|
| Qwen | Qwen3 0.6B–4B | ✅ Recommended |
| Microsoft | Phi-4 | ✅ High Quality |
| Gemma 3 1B–27B | ✅ Latest | |
| Meta | Llama 4 | ✅ Auth required |
| Mistral | Ministral 3B–14B | ✅ |
| OpenAI | GPT-OSS 20B/120B | ✅ MoE |
Use short aliases or any model from mlx-community:
loadModel("qwen") // Qwen3-4B (default)
loadModel("phi4") // Phi-4 (high quality)
loadModel("gemma-3-12b") // Gemma-3-12B
loadModel("mlx-community/Mistral-7B-Instruct-v0.3-4bit")Benchmarks on Mac Studio M1 Ultra (64GB):
| Model | node-mlx | node-llama-cpp | Winner |
|---|---|---|---|
| Mistral 7B | 101 tok/s | 51 tok/s | 2× faster 🏆 |
| Phi-4 14B | 56 tok/s | 32 tok/s | 1.8× faster 🏆 |
| Qwen3 4B | 120 tok/s | 65 tok/s | 1.8× faster 🏆 |
| Gemma-3 12B | 78 tok/s | 42 tok/s | 1.9× faster 🏆 |
See CONTRIBUTING.md for development setup.
Built on MLX by Apple, mlx-swift, and swift-transformers by HuggingFace.
MIT © 2026 Sebastian Software GmbH