简介
apfel 把 Apple Foundation Models 暴露成 UNIX CLI 与本地 OpenAI 兼容服务,让你在本机 100% 离线/本地推理(无需 API key)。它支持工具调用与 4096 token 上下文,GitHub 已验证 5,329★。
最适合: 希望在 Mac 上获得本地 OpenAI 兼容后端(无需云端 key)的开发者与 agent 工具链
适配: macOS 26+ Apple Silicon;OpenAI SDK 可用 base_url;Shell 管道;文件附件提示
配置时间: 10–20 分钟
关键事实(已验证)
- README 提供
apfel --serve:本地 OpenAI 兼容服务端点http://localhost:11434/v1。 - 要求:macOS 26 Tahoe+、Apple Silicon(M1+)且已启用 Apple Intelligence。
- README 徽章标注版本 1.3.3,并提到 4096 token 上下文。
- GitHub:5,329 stars · 205 forks;最近更新 2026-05-12(GitHub API 验证)。
正文
apfel 有两种更“工程化”的用法:
1)脚本/终端 CLI:把输入输出放进管道里,用 -f 附件把文件内容塞进提示词,并用 JSON 输出方便自动化。
2)本地服务端:把任意 OpenAI 兼容 SDK/agent 的 base_url 指向 http://localhost:11434/v1,把提示与上下文留在本机。
建议先选一种路径接入你的工具链(CLI 或 server),再加一个最小健康检查(小提示词 + 快速返回),确保系统升级后能第一时间发现问题。
README 原文节选(verbatim)
apfel
The free AI already on your Mac.
Apple Silicon Macs ship a built-in LLM via Apple FoundationModels. apfel exposes it as a UNIX tool and a local OpenAI-compatible server. 100% on-device. No API keys, no cloud.
| Mode | Command | What you get |
|---|---|---|
| UNIX tool | apfel "prompt" / echo "text" | apfel |
Pipe-friendly answers, file attachments, JSON output, exit codes |
| OpenAI-compatible server | apfel --serve |
Drop-in local http://localhost:11434/v1 backend for OpenAI SDKs |
apfel --chat - interactive REPL.
Tool calling works in all contexts. 4096-token context.

Requirements & Install
macOS 26 Tahoe+, Apple Silicon (M1+), Apple Intelligence enabled.
brew install apfelUpdate:
brew upgrade apfelBuild from source (Command Line Tools with macOS 26.4 SDK / Swift 6.3, no Xcode):
git clone https://github.com/Arthur-Ficial/apfel.git && cd apfel && make installNix, same-day tap, Mint, mise, troubleshooting: docs/install.md.