
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
Command-line and programmatic access to Apple's on-device Foundation Models (Apple Intelligence) on macOS 26+.
Apple Intelligence from your command line and your code. apple-fm gives you the on-device Foundation Models on macOS 26+ / Apple Silicon — free, private, and fully offline. No API key, no network, nothing leaves your Mac.
Apple ships these models as a Swift-only framework with no command-line front-end. apple-fm provides one — a fast, lightweight CLI and a TypeScript library, so you can use the on-device model from your terminal or your code.
probe, one-shot generate (freeform, guided,
or streamed), and an interactive chat — all over a single
NDJSON protocol.DynamicGenerationSchema, not best-effort prompting. Stream it, too.chat holds one on-device
session across turns, reusing the model's cache instead of replaying the
transcript, and automatically summarizes older turns as the small context
window fills.npm install -g apple-fm # CLI
npm install apple-fm # library
Requires macOS 26+ on Apple Silicon with Apple Intelligence enabled. Every release is Developer-ID signed and notarized, so it runs without security prompts.
apple-fm installs on any OS — so it can be a dependency of a cross-platform
project — but the on-device model only runs on macOS 26+ Apple Silicon.
Everywhere else it degrades gracefully instead of crashing: probe() returns
{ available: false, reason: 'unsupportedPlatform' }, and generate / chat
throw a clear [unsupportedPlatform] error. Gate on isPlatformSupported() or
probe():
import { isPlatformSupported, probe, generate } from 'apple-fm';
if ((await probe()).available) {
await generate({ prompt: '…' });
} else {
// fall back (cloud model, cached result, skip the feature, …)
}
apple-fm probe # is the on-device model available?
apple-fm generate "Summarize: …" # one-shot text
cat notes.md | apple-fm generate # read the prompt from stdin
apple-fm generate "…" --stream # stream tokens as they arrive
apple-fm generate "…" --schema shape.json # structured/guided JSON output
apple-fm chat # interactive chat (streamed, auto-compacted)
Run apple-fm --help for the full flag list.
Before generating, confirm Apple Intelligence is ready on this machine.
Pass a JSON Schema with --schema and apple-fm returns JSON guaranteed to
conform to it — native guided generation, not prompt-and-hope — ready to pipe
into the rest of your tooling.
chat is a multi-turn REPL that streams replies and compacts the transcript
automatically near the context window. Built-in slash commands: /reset,
/system, /clear, /compact, /help, /quit.
import { probe, generate, ChatSession } from 'apple-fm';
if ((await probe()).available) {
// One-shot
const summary = await generate({ prompt: 'Summarize: …', system: 'Be terse.' });
// Streaming
await generate({ prompt: '…', stream: true }, {}, (chunk) => process.stdout.write(chunk));
// Guaranteed structured output — pass a JSON Schema, get conforming JSON back
const json = await generate({ prompt: 'A classic sci-fi novel', schema: novelSchema });
// Multi-turn chat: one persistent on-device session, auto-compacted
const chat = new ChatSession({ system: 'You are a helpful assistant.' });
const reply = await chat.send('Hello');
}
The full API (probe, generate, ChatSession, protocol helpers, and types) is
documented in docs/ai/code-summary.md.
apple-fm talks to the same on-device model that powers Apple Intelligence — nothing is sent to the cloud. For chat it keeps one model session alive across turns so replies stay fast, and automatically summarizes older messages as the context window fills, so long conversations stay coherent and cheap. And because it resolves the current on-device model at runtime, OS and model updates are picked up automatically — no reinstall.
apple-fm is an independent, unofficial project and is not affiliated with, endorsed by, or sponsored by Apple Inc. It simply provides command-line and programmatic access to Apple's on-device Foundation Models on machines that already support them (macOS 26+ on Apple Silicon with Apple Intelligence enabled). Apple, Apple Intelligence, Apple Silicon, Foundation Models, and macOS are trademarks of Apple Inc.
MIT © Brian Westphal
FAQs
Command-line and programmatic access to Apple's on-device Foundation Models (Apple Intelligence) on macOS 26+.
The npm package apple-fm receives a total of 734 weekly downloads. As such, apple-fm popularity was classified as not popular.
We found that apple-fm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.