Today we are launching maclocal.ai, the official home for the AFM project. AFM is an OpenAI-compatible API server that runs large language models locally on Apple Silicon, with no cloud dependencies, no API keys, and no data leaving your machine.
What is AFM?
AFM gives you a drop-in replacement for the OpenAI API, powered entirely by your Mac's hardware.
Point any OpenAI-compatible client at http://localhost:9999/v1 and start generating
completions from models running on your M-series chip.
The server exposes two standard endpoints: /v1/chat/completions for chat-based generation
and /v1/models for listing loaded models. If your tool speaks OpenAI, it speaks AFM.
Two Backends
AFM supports two inference backends:
- MLX (
afm mlx) -- uses Apple's MLX framework to run any MLX-format model from Hugging Face. Thousands of models are available through the mlx-community organization. - Apple Foundation Models (
afm) -- uses Apple's built-in on-device models on macOS 26 and later. No download required.
Key Features
AFM is not just a basic inference server. It includes production-grade features that make it suitable for real development workflows:
- Streaming -- server-sent events for real-time token delivery
- Tool calling -- OpenAI-compatible function calling with auto-detected formats
- Prompt caching -- server-level KV cache reuse across turns for faster multi-turn conversations
- Full sampling control -- temperature, top-p, top-k, min-p, repetition penalty, presence penalty, and seed
- Logprobs -- token-level log probabilities for confidence analysis
- Stop sequences -- custom stop strings with buffer-based boundary detection
- Reasoning extraction --
<think>tag content separated into a dedicated response field
Getting Started
Install AFM and start serving a model in two commands:
brew install scouzi1966/afm/afm
afm mlx -m mlx-community/Qwen3-Coder-0.6B-4bit --port 9999 Then test it with curl:
curl http://localhost:9999/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "mlx-community/Qwen3-Coder-0.6B-4bit",
"messages": [{"role": "user", "content": "Hello!"}]
}' For detailed setup instructions, head to our Installation and Quick Start guides.
Get Involved
AFM is open source and hosted on GitHub. We welcome contributions of all kinds: bug reports, feature requests, documentation improvements, and pull requests. If you are building tools on Apple Silicon and want local inference that just works, give AFM a try and let us know what you think.