Skip to content
This repository was archived by the owner on Jun 12, 2026. It is now read-only.

Repository files navigation

node-mlx

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

CI npm version License: MIT


Quick Start

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+

Why node-mlx?

🚀 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

Usage

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`)

Documentation

📚 Full Documentation

Supported Models

Provider Models Status
Qwen Qwen3 0.6B–4B Recommended
Microsoft Phi-4 ✅ High Quality
Google 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")

Performance

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 🏆

Contributing

See CONTRIBUTING.md for development setup.

Credits

Built on MLX by Apple, mlx-swift, and swift-transformers by HuggingFace.

License

MIT © 2026 Sebastian Software GmbH

About

LLM inference for Node.js powered by Apple MLX on Apple Silicon

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages