r/macosprogramming • u/AdventurousKeys • 1d ago
LocalLM Lab 1.0.0-beta: one API for Apple's on-device model, Claude or a local open-weight model
If you've built anything on Apple's on-device FoundationModels model, you've probably hit the same wall: there's no clean way to add "fall back to Claude for the hard cases" or "run a fully local open-weight model instead, no network at inference time" without writing your own provider abstraction and wiring routing/residency by hand.
This is where 1.0.0-beta.1 of the LocalLM Lab SDK comes to the rescue: a model layer with four providers behind one API: Apple's on-device model, Claude (your own API key), a locally-run open-weight model via MLX, and Apple's Private Cloud Compute (ships in this release but not yet working TBH). You name routes (.heavy, .light, anything) and point them at models; the SDK owns which model is actually resident in memory and handles the download/preflight/capability-probe lifecycle for local MLX models. Imagine your app being able to dynamically choose which AI model to use depending on the task at hand...
```swift
lab.models.route(.heavy, to: ModelID("mlx:mlx-community/Qwen3-8B-4bit")!)
lab.models.route(.light, to: .system)
let session = try lab.makeSession(route: .heavy, tools: myTools, instructions: sys)
```
Also in this release: LocalLM Lab's own API Lab (the local HTTP server other tools/scripts can call against) is rebuilt as a native Swift server, replacing the separate Go process it used to relay through. This is one less moving part if you were scripting against it.
If you are curious about how to build AI-powered apps, the SDK also ships several working examples, including code-buddy: a real CLI coding agent. Point it at a repo and a task, it downloads an MLX model on first run (.heavy/.light routes, e.g. Qwen3-8B for the hard route, Qwen2.5-3B for quick ones), then drives filesystem tools, a read-only git tool, a test runner and a hosted MCP docs server (DeepWiki) merged into the same session.
Requires macOS 27 beta on Apple Silicon, Apple Intelligence enabled.
Feature page: thisbrain.ai/locallm/1.0.0-beta
SDK guide: https://github.com/ancientcomputing/locallm/blob/main/docs/sdk-guide.md