node-mlx

node-mlx

The fastest way to run LLMs in Node.js on Apple Silicon.

2× faster than alternatives. Powered by Apple MLX.

$npm install node-mlx
Terminal
$ npx node-mlx "What is 2+2?"

✓ Loading Qwen3-4B-Instruct...
⚡ Generated 24 tokens at 142 tok/s

The answer is 4.

Why node-mlx?

2× Faster

Native Metal GPU acceleration. Outperforms node-llama-cpp on every benchmark.

Unified Memory

No CPU↔GPU copying. Apple Silicon's unified architecture = maximum efficiency.

Zero Config

npm install and you're ready. Auto-downloads models from HuggingFace.

Performance

~1.9× faster than node-llama-cpp on Apple Silicon. Benchmarks on Mac Studio M1 Ultra (64GB), 4-bit quantization.

Model
Size
node-mlxllama-cpp
Phi-4Phi-4
14B
45
24
Gemma 3Gemma 3
4B
58
30
Qwen3Qwen3
4B
68
36
Qwen3Qwen3
8B
52
27
MinistralMinistral
8B
62
33
Gemma 3nGemma 3n
2B
42
22
Gemma 3nGemma 3n
4B
37
19

Simple API

app.ts
import { generate } from "node-mlx";

// One-liner: load, generate, done
const result = generate("qwen", "Explain quantum computing:");

console.log(result.text);
console.log(`${result.tokensPerSecond} tok/s`);

Built on

Node.jsNode.js
MLXApple MLX
Apple SiliconApple Silicon

Ready to run LLMs at native speed?

Get Started