apfel CLI
The Apple Intelligence model built into a Mac as a terminal command and a local OpenAI-compatible server: no keys, no cloud
- 6,518 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- `--serve` opens an HTTP server on `localhost:11434` that any local program can reach until `--token` is set
- The `--mcp` flag launches the MCP servers you name as processes and calls their tools
- With an address in `--mcp`, tool calls go to a remote server, and the token is best set via the `APFEL_MCP_TOKEN` variable
Install
- Works in
In your terminal, with SkillFoxx CLI
npx skillfoxx add cli/apfelDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- `--serve` opens an HTTP server on `localhost:11434` that any local program can reach until `--token` is set
- The `--mcp` flag launches the MCP servers you name as processes and calls their tools
- With an address in `--mcp`, tool calls go to a remote server, and the token is best set via the `APFEL_MCP_TOKEN` variable
This is third-party code. Review the repository files before installing.
What it does
apfel opens the language model built into an Apple Silicon Mac through Apple FoundationModels as an ordinary terminal command. `apfel "question"` prints an answer, the command accepts piped text, and the `-f` flag attaches files: it extracts text from PDFs and images and recognizes a picture on the device. `--code` leaves only code in the answer, `-o json` returns JSON for scripts and `--schema` guarantees output that matches a schema. Computation runs on the Mac itself, with no keys and no cloud. The `--serve` mode starts a server in the OpenAI format at `http://localhost:11434/v1` with the `/v1/chat/completions`, `/v1/responses` and `/v1/models` methods, streaming and tool calling. The only model is called `apple-foundationmodel`. Any client that speaks the OpenAI API connects by pointing at that address, as done for OpenCode and Zed. The `--mcp` flag attaches local and remote MCP servers: apfel discovers their tools and calls them itself. `--chat` opens a dialogue in the terminal, and `apfel demos ./folder` writes out ready shell scripts, such as turning a request in English into a command.
Who it is for. For Apple Silicon Mac owners who need a free local model in scripts, an editor or an agent when a small model and a short context are enough.
Good fit when
- You need to run piped text through a model in a shell script, for example to summarize `git diff` or extract tags
- An agent or editor can connect through the OpenAI format, and requests should stay on your Mac
- You need JSON that strictly follows a schema: the `--schema` flag guarantees the structure
- You want to recognize text in a PDF or a receipt photo and ask about it without sending the file to the cloud
- You are testing your own MCP server: `apfel --chat --mcp ./server.py` shows the calls to its tools
Not a fit when
- You have an Intel Mac or macOS older than 26: apfel works only on Apple Silicon with macOS 26 and newer
- You need a long context or a large model: the 4096 or 8192-token window is shared between input and answer
- You need embeddings or a choice of another model: the server answers those with an error, and there is one model
- You need larger models and open weights: `ollama` fits that, it runs open models of different sizes
- You need generation without Apple's safety filters, which sometimes block harmless requests
Example request
Install apfel, start its server on this Mac and connect OpenCode to it so short requests go to the built-in modelLimitations
- It needs macOS 26 Tahoe or newer, an Apple Silicon Mac (M1 or newer) and Apple Intelligence turned on. Building from source requires Swift 6.3 and the command line tools with the macOS 26.4 SDK.
- The context window is shared by input and output: 4096 tokens on macOS 26 and on M1 or M2, 8192 on macOS 27 with an M3 or newer chip and 12 GB or more of memory. There is one model of about 3 billion parameters and it cannot be changed. `apfel --model-info` shows your window, and an answer takes a few seconds.
- There are no embeddings, `/v1/completions` answers 501, and `logprobs`, `n` above 1, `stop`, `presence_penalty` and `frequency_penalty` are rejected with code 400.
- Apple's safety filters sometimes block harmless requests. The `--permissive` flag cuts false positives.
- The model does not know the current date and invents one, so inject the date into the system prompt. Images reach the model only on macOS 27, while on macOS 26 only recognized text is read. MIT license.
How to disable. Stop the server: Ctrl-C in the window running `apfel --serve`, or `brew services stop apfel` for the background service. Remove the program with `brew uninstall apfel`. Scripts written out by `apfel demos` stay in the folder you chose.
FAQ
How do I connect OpenCode to apfel?
Run `apfel --serve` and set `http://localhost:11434/v1` and the model `apple-foundationmodel` in OpenCode. OpenCode pastes the global `~/.claude/CLAUDE.md` into the system prompt, and that overflows the model's window. `export OPENCODE_DISABLE_CLAUDE_CODE_PROMPT=1` fixes it.
What happens if a request does not fit the window?
Generation never starts: the server returns a `[context overflow]` error with code 400 and the command exits with code 4. Estimate a request beforehand with the `--count-tokens` flag.
How do I get only code in the answer?
The `--code` flag strips the explanations and Markdown fences, so the answer can go straight to a file or to `pbcopy`. If there is no code, the command exits with code 7.
How do I keep other programs off the local server?
Start the server with a token, the `--token` flag or the `APFEL_TOKEN` variable, and requests without an `Authorization` header are refused. Origin checks and CORS are described in `docs/server-security.md`, and CORS is switched on with `--cors`.
Can I attach a remote MCP server?
Yes, `--mcp` accepts a Streamable HTTP address. Pass the token in the `APFEL_MCP_TOKEN` variable, because the flag is visible in `ps aux`. apfel refuses to send a token over plain `http://`.
Does apfel work with PDFs and photos?
The `-f` flag takes PDFs, images and text. From PDFs and pictures apfel extracts text with on-device recognition, and you can ask about the resulting text, for instance the total on a receipt.
Discussion
No questions or reviews yet.
Related
CLI toolsA local model server for Apple Silicon Macs in OpenAI, Anthropic and Ollama formats: Claude Code, Codex and OpenCode connect with one command
Local memory for Claude Code, Codex and Cursor Agent: learns from your activity on a Mac and gives agents context with source receipts over MCP
A local model server for Apple Silicon Macs: Qwen 3.8 and Gemma 4 with MTP decoding and OpenAI and Anthropic APIs for Claude Code, Codex and Cursor
oterm is a terminal chat for Ollama, OpenAI, Anthropic and other providers: SQLite-stored sessions, MCP servers, built-in and custom tools
A local-first AI agent running on your own machine via llama.cpp that drives a browser, edits files, runs approved commands and remembers context across session
An MCP server that lets Claude Code, Codex and other agents call Gemini, GPT, Grok and local models for review, debugging and consensus
Comparison with similar tools
Entries that share the main search query, and how they differ.
| Entry | Official | Repository stars | Main difference |
|---|---|---|---|
| apfel (this entry) | yes | 6,518 | |
| Ollama | yes | 184,341 | runs open models of many sizes on Mac, Windows and Linux, while apfel exposes the single built-in Apple model |
| LM Studio | yes | an app with a window for downloading and running open models, while apfel stays a terminal command with no model downloads |
README in short
The repository front page shows the two modes, requirements and Homebrew install, then command examples, MCP support and an OpenAI API compatibility table. Separate sections cover limitations and reference documents: installation, every flag and exit code, the background service, server security and guides for calling it from Python, Node.js, Bash and other languages. After that come a list of projects built around apfel and a list of community projects. The repository holds Swift sources, integration tests, examples and demo scripts.