展示HN:Apfel – 免费的已在你的Mac上的AI
Show HN: Apfel – The free AI already on your Mac

原始链接: https://apfel.franzai.com

苹果的 macOS 26 (Tahoe) 现在包含一个内置的大语言模型 (LLM),直接在 Apple Silicon 的神经网络引擎和 GPU 上运行——完全离线。 最初,它仅限于 Siri 和系统功能,但开发者可以通过 Apple 的 FoundationModels 框架 (Swift API) 访问该模型。 然而,直接访问比较复杂。“apfel”项目弥合了这一差距,提供了一个用户友好的界面。 它封装了 Apple 的 API,通过命令行工具、兼容 OpenAI 的 HTTP 服务器和交互式聊天提供访问。 Apfel 增加了原生 API 中缺失的关键功能,例如适当的错误处理、JSON 输出、4096-token 窗口内的上下文管理以及 OpenAI 模式转换。 它使用 Swift 6.3 构建,并且是开源的,允许用户利用 Apple 的设备端 LLM 与现有的工具和工作流程,例如 shell 脚本和 OpenAI SDK。

## Apfel:Mac 上的免费 AI - 摘要 Apfel 是一款新工具,允许用户在他们的 Mac (macOS Tahoe 或更新版本) 上本地访问 Apple Foundation Models。它提供命令行界面和兼容 OpenAI 的 API,实现离线使用,并通过将数据保存在设备上优先保护隐私。 讨论强调了本地模型在隐私方面的优势,特别是考虑到对云端 AI 服务数据使用的担忧。虽然本地模型提供安全性,但一些评论员指出潜在的漏洞,例如恶意代码注入或数据泄露,以及公开训练模型的重要性。 用户正在尝试使用 Apfel 进行脚本编写、代码生成和一般问答等任务。对于较小的任务,性能似乎良好,但 4K token 的上下文窗口限制了它处理大型输入的能力。一些用户报告说,响应存在不一致和不准确的情况,类似于 Siri。 该项目是开源的,可在 GitHub 上获取,一些人指出其登陆页面对于一个简单的工具来说过于“营销化”。它正在引起人们的兴奋,因为它提供了一种利用 Apple 的 AI 能力而无需依赖云连接的方式。
相关文章

原文

Apple ships an on-device LLM

Starting with macOS 26 (Tahoe), every Apple Silicon Mac includes a language model as part of Apple Intelligence. Apple exposes it through the FoundationModels framework - a Swift API that gives apps access to SystemLanguageModel. All inference runs on the Neural Engine and GPU. No network calls, no cloud, no API keys. The model is just there.

But Apple only uses it for Siri

Out of the box, the on-device model powers Siri, Writing Tools, and system features. There is no terminal command, no HTTP endpoint, no way to pipe text through it. The FoundationModels framework exists, but you need to write a Swift app to use it. That is what apfel does.

What apfel adds

apfel is a Swift 6.3 binary that wraps LanguageModelSession and exposes it three ways: as a UNIX command-line tool with stdin/stdout, as an OpenAI-compatible HTTP server (built on Hummingbird), and as an interactive chat with context management.

It handles the things Apple's raw API does not: proper exit codes, JSON output, file attachments, five context trimming strategies for the small 4096-token window, real token counting via the SDK, and conversion of OpenAI tool schemas to Apple's native Transcript.ToolDefinition format.

hardware Apple Silicon (Neural Engine + GPU)

|

model Apple's on-device LLM (shipped with macOS)

|

sdk FoundationModels.framework (Swift API)

|

apfel CLI + HTTP server + context management

|

you Terminal, shell scripts, OpenAI SDKs, curl

4,096 tokens Context window (input + output)

1 model Fixed, not configurable

Swift 6.3 Strict concurrency, no Xcode

MIT license Open source

联系我们 contact @ memedata.com