
Naga
An open-source LLM runtime for Apple Silicon.
Naga is an open-source, from-scratch runtime for Apple Silicon Macs that runs and serves local LLMs on MLX, with quantization, prefix caching, constrained decoding, an OpenAI-compatible server, local RAG and an MCP agent.

Naga at a glance
- What it is
- A from-scratch LLM inference and serving runtime on MLX
- Platforms
- macOS on Apple Silicon, Python 3.10 or later
- Licence
- Apache-2.0, free and open source
- Status
- Early: a hacking-friendly runtime rather than a packaged release
- Made by
- NGMOB Pte. Ltd., Singapore
What Naga is
Naga implements the whole inference stack above MLX’s tensor operators itself: the transformer forward pass, KV cache, quantization, prefix caching and constrained decoding. It does not sit on transformers, llama.cpp, vLLM or Ollama.
It runs Qwen2 and Qwen2.5 text models and LLaVA-style vision models, quantizes to INT4 or INT8, reuses KV cache across requests with a radix tree, and guarantees schema-valid JSON for tool calls with a grammar automaton.
On top sit an OpenAI-compatible server with streaming and function calling (it works as an Open WebUI backend), local RAG over text, Markdown and PDF, an MCP agent over stdio or HTTP, an agent SDK, and a monitoring dashboard with Prometheus metrics.
- Qwen2.5-3B, 4-bit, M2 Max 32 GB
- 75 tok/sQwen2.5-3B, 4-bit, M2 Max 32 GB
- peak memory in that test
- 1.9 GBpeak memory in that test
- faster first token on multi-turn
- 7.9×faster first token on multi-turn
- throughput with 16-way batching
- 4.6×throughput with 16-way batching
What you can do with Naga
- Hand-written inference
- Qwen2/2.5 text and LLaVA-style vision models, with no transformers or llama.cpp underneath.
- INT4 and INT8 quantization
- Quantized layers on mx.quantized_matmul for faster decode and about a third of the memory.
- Prefix caching
- A radix-tree KV cache reused across requests keeps multi-turn latency flat.
- Constrained decoding
- A JSON grammar automaton guarantees schema-valid output for tool calls.
- OpenAI-compatible server
- /v1/chat/completions with SSE streaming and function calling; works with Open WebUI.
- RAG, MCP and agents
- Local embeddings and retrieval, an MCP agent over stdio or HTTP, and an agent SDK.
Questions about Naga
What is Naga?
Naga is a from-scratch runtime for LLM inference, serving and agentic workloads on Apple Silicon. It builds on MLX tensor operators and implements the transformer, KV cache, quantization, prefix caching, constrained decoding, an OpenAI-compatible server, RAG and an MCP agent itself.
Who makes Naga and what does it cost?
Naga is an open-source project from NGMOB, developed in the public GitHub repository maweis1981/naga. It is free under the Apache License 2.0 and installed from source with pip.
What hardware does Naga need?
macOS on an Apple Silicon Mac and Python 3.10 or later. In the published benchmark on an M2 Max with 32 GB, Qwen2.5-3B decoded at 75 tokens per second with 4-bit weights and 1.9 GB peak memory.
Does Naga work with OpenAI-compatible tools?
Yes. Naga serves /v1/chat/completions with SSE streaming and function calling, and can be used as an Open WebUI backend by pointing the base URL at http://localhost:8000/v1.
Facts last checked on 2026-10-30 against github.com/maweis1981/naga. Built with MLX, Apple Silicon, Python, FastAPI, MCP, RAG.