← all repositories
Arthur-Ficial/apfel

Your Mac already has an LLM; this tool finally lets you use it

apfel exposes Apple’s on-device FoundationModels as a UNIX CLI and OpenAI-compatible server—no API keys, no cloud, no downloads.

apfel
Velocity · 7d
+74
★ / day
Trend
steady
star history

What it does

apfel is a Swift CLI that wraps Apple Intelligence’s built-in LLM (Apple FoundationModels) into two familiar interfaces: a pipe-friendly UNIX tool and a local OpenAI-compatible server at localhost:11434/v1. You can echo "text" | apfel, attach files, get JSON output, or drop it in as a backend for existing OpenAI SDK code. It also runs an interactive REPL with apfel --chat.

The interesting bit

Apple ships a capable on-device model but offers no native developer interface; apfel is essentially the missing API layer. The project leans hard into UNIX ergonomics—exit codes, quiet mode for shell scripts, file attachments via -f, and even a --permissive flag to reduce guardrail false positives on creative prompts. The OpenAI compatibility is thorough enough to support streaming, tool calling, JSON schema enforcement, and MCP (Model Context Protocol) servers, including remote ones over HTTP.

Key highlights

  • 100% on-device inference; zero network calls, zero API keys
  • OpenAI-compatible server with streaming, tool calling, and response_format: json_schema
  • MCP support: local Python servers and remote Streamable HTTP endpoints
  • Ships with demo scripts (cmd, oneliner, mac-narrator, gitsum) that turn natural language into shell commands
  • Optional apfel-run wrapper for TOML-based configuration when flags become unwieldy
  • Install via Homebrew; builds with Command Line Tools, no Xcode required

Caveats

  • macOS 26 Tahoe+ and Apple Silicon only; Windows and Intel Macs need not apply
  • 4096-token context window shared between input and output—easy to hit on large diffs or files
  • No embeddings endpoint, no legacy /v1/completions, no multimodal images; some OpenAI parameters (logprobs, n>1, penalties) are explicitly rejected with 400

Verdict

If you’re on a recent Apple Silicon Mac and want a free, private LLM for scripting, quick CLI tasks, or as a local drop-in for OpenAI SDK code, apfel is a pragmatic choice. Everyone else should wait for Apple to expand platform support—or stick with Ollama.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.