whatisgithub

What is foundation-models-utilities?

apple/foundation-models-utilities — explained in plain English

Analysis updated 2026-05-18

117SwiftAudience · developerSetup · easy

In one sentence

An official Apple package adding external server connections, conversation history management, and on-demand skill injection to Apple's on-device Foundation Models framework.

Mindmap

A visual breakdown will appear here once this repo is fully enriched.

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Connect an app's AI session to a local or remote server using the standard chat completions protocol.

USE CASE 2

Automatically compress long AI conversation transcripts so they fit within a model's memory limit.

USE CASE 3

Load domain-specific instructions into an AI session only when the model decides they're relevant.

What is it built with?

SwiftXcodeSwift Package Manager

How does it compare?

apple/foundation-models-utilitiesomarshahine/homeclawjohn-rocky/coreai-model-zoo
Stars117120112
LanguageSwiftSwiftSwift
Setup difficultyeasyeasyhard
Complexity2/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Install via Xcode or Swift Package Manager, works on Apple platforms and some Linux distros.

So what is it?

This is an official Apple package that adds extra building blocks on top of Apple's Foundation Models framework, which is Apple's system for running AI language models on-device across its platforms. The utilities here cover three main areas: connecting to external AI servers, managing how much conversation history a session holds, and injecting task-specific instructions on demand. The first feature, called ChatCompletionsLanguageModel, lets your app talk to any AI server that uses the standard chat completions protocol. That includes local AI servers you run on your own machine. You point it at a URL, give it a model name, and it works like any other language model session in the framework. This is useful because a large ecosystem of open-source AI tools already speaks that same protocol. The second feature is history management. When you have a long back-and-forth conversation with an AI, the transcript can grow until it exceeds the model's memory limit. This package provides modifiers that compress the transcript automatically using different strategies: dropping tool calls that are already finished, keeping only the most recent entries via a rolling window, and summarizing older exchanges into a single compact entry. You compose these strategies together based on what your app needs, since there is no single approach that works for every case. The third feature is called Skills. Instead of loading all your instructions into the AI session upfront, which wastes memory and slows down the first response, Skills inserts specific guidance into the conversation only when the model decides it is relevant. A skill might be a writing style guide, calendar rules, or any domain-specific prompt. The model activates a skill by generating a tool call, and the skill's content is then added to the transcript at that moment. This keeps the session leaner and faster. The package works on Apple platforms and on some Linux distributions such as Ubuntu. Installation is through Xcode or Swift Package Manager.

Copy-paste prompts

Prompt 1
Show me how to use ChatCompletionsLanguageModel to connect my Swift app to a local AI server.
Prompt 2
Add a rolling-window history compression modifier to my Foundation Models chat session.
Prompt 3
Create a Skill that injects calendar rules into an AI conversation only when the model calls it.
Prompt 4
Explain the tradeoffs between the three history compression strategies in foundation-models-utilities.

Frequently asked questions

What is foundation-models-utilities?

An official Apple package adding external server connections, conversation history management, and on-demand skill injection to Apple's on-device Foundation Models framework.

What language is foundation-models-utilities written in?

Mainly Swift. The stack also includes Swift, Xcode, Swift Package Manager.

How hard is foundation-models-utilities to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is foundation-models-utilities for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.