GitHub
ESC

fm.cr

Crystal bindings for Apple's FoundationModels framework. Run on-device AI powered by Apple Intelligence directly from Crystal.

Requires macOS 26+ (Tahoe) with Apple Intelligence enabled.

Overview

fm.cr provides a Crystal interface to Apple's on-device language model through a Swift FFI bridge. It supports text generation, streaming, structured output with JSON schemas, tool calling, and context management -- all running locally on Apple Silicon.

Features

Installation

Add fm.cr to your shard.yml:

dependencies:
  fm:
    github: hahwul/fm.cr

Then run:

shards install

The native Swift FFI library is built automatically via the postinstall script.