Skip to content

Repository files navigation

tsfm

tsfm

TypeScript SDK for Apple's Foundation Models framework.
On-device Apple Intelligence in Node.js — No keys. No fees. It just works.

npm CI license


  • On-device inference — your data never leaves the machine
  • Streaming text generation
  • Structured output with typed schemas and generation guides
  • Tool calling
  • Transcript persistence
  • Chat-style and Responses-style APIs via tsfm-sdk/chat

Quick Start

npm install tsfm-sdk
import { SystemLanguageModel, LanguageModelSession } from "tsfm-sdk";

const model = new SystemLanguageModel();
const { available } = await model.waitUntilAvailable();
if (!available) process.exit(1);

const session = new LanguageModelSession({
  instructions: "You are a concise assistant.",
});

const reply = await session.respond("What is the capital of France?");
console.log(reply); // "The capital of France is Paris."

session.dispose();
model.dispose();

Documentation

Read the full docs →

Requirements

  • Apple Silicon (M-Series) Mac running macOS 26 or later
  • Apple Intelligence enabled in System Settings
  • Node.js 24+

Unless you are building from source, Xcode is not required.

Development

npm run build              # build native dylib + compile TypeScript
npm test                   # run all tests
npm run test:unit          # unit tests only (works on any machine)
npm run test:integration   # integration tests (requires macOS 26 + Apple Intelligence)

Contributing

Issues and PRs welcome. If something doesn't work on your machine or you find a missing API, open an issue.

License

© 2026 Cody Bromley and contributors.

tsfm is licensed under the Apache 2.0 license. For complete licensing information, see this project's LICENSE file.

The tsfm-sdk package available from NPM contains precompiled C bindings and libraries for working with macOS 26 Foundation Models adapted from python-apple-fm-sdk which is Copyright Apple Inc. and licensed under the Apache 2.0 license.

This project is unaffiliated with Apple, Inc. The terms "Apple" and "Apple Intelligence" are trademarks of Apple Inc., registered in the U.S. and other countries and regions.

About

TypeScript/Node.js bindings for Apple's on-device Foundation Models (macOS 26+ only)

Topics

Resources

Stars

20 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages