HomeWork / SwiftLM Selected work

Project notes

SwiftLM

One Swift API for every language model your app can reach, with prompt contracts, token budgets, explicit fallbacks, and redacted receipts.

SwiftApache-2.0v2.0.0Stable

Repository snapshot

  • 33Commits
  • Sep 2026Last updated
  • Apache-2.0License
  • May 2026Started
  • Swift 100.0%

Overview

SwiftLM is the layer a language model feature needs around the model: a prompt you can version, a context that fits, a next step when the model can't answer, and a record of what happened. One Swift API reaches Apple's on-device model, Private Cloud Compute, custom Core AI or MLX models, OpenAI, and Anthropic. The on-device model is the default, cloud providers run only when an app lists them, and the core has no network access and no telemetry. Version 2.0 renamed the package from SwiftLLM, since it handles models of every size, and adopted the OS 27 Foundation Models framework.

Highlights

  • 01

    One API, every model

    Apple's on-device model, Private Cloud Compute, any OS 27 LanguageModel such as Core AI or MLX, OpenAI, and Anthropic behind one client that streams.

  • 02

    Local first, cloud by choice

    The on-device model is the default. Private Cloud Compute and cloud providers run only when listed, and every client reports where content goes.

  • 03

    Fallbacks with reasons

    Routers skip models that can't honor a request and move on after quota, context, and availability errors. Refusals and bad output stop the run.

  • 04

    Prompts and budgets

    Versioned prompt contracts, token budgets with reports, boundary-aware chunking, and context packing that fits the model's window.

  • 05

    Checked output

    Schema descriptors, validators, and repair policies for structured generation, plus source-aware local retrieval with citations.

  • 06

    Receipts and evaluation

    Every routed run leaves a receipt with no prompt or response text in it, and evaluation cases replay a feature when a prompt or a model changes.

Products

SwiftLM
The provider-neutral client, router, prompts, context, retrieval, validation, workflows, and receipts.
SwiftLMFoundationModels
Apple's on-device model, Private Cloud Compute, custom LanguageModel values, and multi-turn sessions.
SwiftLMOpenAI
The OpenAI Responses API, opt-in.
SwiftLMAnthropic
The Anthropic Messages API, opt-in.
SwiftLMEvaluation
Prompt evaluation, structured output assertions, fallback matrices, and local debug bundles.

SwiftLM is open source.

Browse the code and docs, or get in touch if you need a platform or developer tool built.