# AFM — local AI infrastructure for Apple Silicon

A native Swift CLI and local server that turns an Apple Silicon Mac into a private, OpenAI-compatible AI server for Hugging Face MLX models or Apple's on-device Foundation Model.

AFM (the afm command) runs as a native Swift executable, needing no Python runtime, and serves chat, streaming, tool calls, structured output, reasoning and logprobs, plus vision OCR, speech and embeddings, through both a command-line single-prompt mode and a local OpenAI-compatible HTTP server with a built-in web UI. Performance features include prefix caching, concurrent decoding, speculative decoding and metrics.

The project is migrating to a two-layer architecture: AFMKit is a reusable Swift foundation owning the shared model contracts and provider runtimes (Apple Foundation Models, MLX and DwarfStar) for apps and agents that want to embed inference directly, while maclocal-api remains the complete product — the CLI, server, WebUI and packaging — now built on one exact-versioned AFMKit dependency instead of duplicated provider code. It requires an Apple Silicon Mac with a current macOS/Xcode toolchain; MLX weights download from Hugging Face on first use.

Website: https://github.com/scouzi1966/maclocal-api
