InferKit
An Objective-C inference toolkit, usable from Swift, that puts Core ML, MLX, Apple's Foundation Models or a remote endpoint behind one protocol, with optional serving to other machines on the network.
View on GitHub ↗- Stars
- ★ 4
- Last commit
- 4 Dec 2026
- Maintenance
- Active
- Licence
- MIT
- Category
- On-device AI SDKs · Cloud-capable
- GitHub
- belisoful/
InferKit
Overview
InferKit is an inference toolkit for macOS, iOS and tvOS, written for Objective-C and usable from Swift. One protocol, NFKInferenceBackend, covers every engine, so the same request and result types can drive a Core ML model, an OpenAI-compatible or Anthropic endpoint (hosted, or a local runner such as Ollama), Apple's on-device Foundation Models, or an MLX model.
Swapping engines means swapping the backend. Inference is synchronous and can take several seconds, so the docs say to run it off the main thread, or to submit it as an NFKInferenceJob for progress and cancellation.
The core package has no third-party package dependencies and keeps a platform floor of macOS 11, iOS 14 and tvOS 14. Heavier runtimes ship as companion packages in the same repository: InferKitMLX (MLX models on Apple silicon, macOS 14 and iOS 17), InferKitFoundationModels (Apple's on-device model, macOS 26 and iOS 26), and InferKitAppleSwift (Swift-only Apple speech, document, lens-smudge and translation APIs, also macOS 26 and iOS 26). Those companions are added from a local checkout, because Swift Package Manager cannot address a package in a subdirectory of a remote repository.
A Remote backend can call hosted providers. The README names OpenAI, Anthropic, xAI, Gemini, Groq, Mistral, DeepSeek, Together, OpenRouter, TypeSafe, OpenCode Zen and OpenCode Go, the local runners Ollama, LM Studio, llama.cpp and vLLM, and an InferKit server. Hosted providers need an API key; local runners do not. The toolkit can also host any backend for other machines on the network through NFKInferenceServer, answering OpenAI-compatible routes, with a client key unless the host turns that off.
The GitHub description says "119+ common on-device models". The README describes the MLX companion as having "60-plus models". A model catalogue on main lists a much larger set, but every entry there is marked as introduced in 0.4.0, and 0.4.0 has not been tagged. Those counts are the project's own, and they do not currently agree. Model weights keep their own licence terms, which in the main catalogue include restrictive licences as well as MIT and Apache-2.0.
The project is licensed under the MIT licence. The latest GitHub release is v0.3.1, dated 16 Sep 2026, which is also the version in Package.swift and the podspec. main is ahead of that tag.
The toolkit was built for the author's MetalForge effects suite, but has no host-framework dependency. It sits beside other on-device SDKs such as mlx-swift-lm, CoreML-LLM, AnyLanguageModel and Xybrid, rather than replacing them.
Features
- A shared NFKInferenceBackend protocol, with request, result and job types, plus a passthrough mock, in-process Core ML, on-device Core ML language models, and streaming Remote clients.
- Apple-framework engines behind the same protocol, including Vision, VideoToolbox, Speech, SoundAnalysis, AVFoundation voices and NaturalLanguage, with no extra weights to ship.
- Optional MLX, Foundation Models and Apple Swift companion packages, plus runtime discovery so the core does not link those engines unless they are present.
- A Remote provider list covering hosted cloud APIs and local runners, model listing from the server, and an InferKit server that can advertise over Bonjour.
- Subsystems for tensor conversion, image and video coding, tokenizers, a Core ML compute-plan reader, and a Hugging Face download and cache layer.
- Prebuilt XCFramework assets on the v0.3.1 release: the core alone, and static or dynamic builds that include MLX.
- CocoaPods support for the core (pod 'InferKit'). The MLX companion is not a pod.
Requirements
- For the core Swift package or pod: macOS 11, iOS 14 or tvOS 14, Xcode, and Swift Package Manager or CocoaPods.
- For InferKitMLX: Apple silicon, macOS 14 or iOS 17, and a local checkout of the companion package. The install guide also notes Metal library linking rules for the binary builds.
- For InferKitFoundationModels: Apple Intelligence hardware, and macOS 26 or iOS 26. A provider bridge that stands behind Apple's session API is documented as needing macOS 27 or iOS 27.
- For InferKitAppleSwift: macOS 26 or iOS 26.
- Network access for model downloads and for any remote backend. Hosted providers need the relevant API key.
- Enough disk space and memory for the chosen model. Memory figures in the docs are the author's.
Install
Swift Package Manager, core: add .package(url: "https://github.com/belisoful/InferKit.git", from: "0.3.1") and depend on the InferKit product. In Xcode, use File, Add Package Dependencies, and enter the repository URL. This resolves the published 0.3.1 line, not unreleased work on main.
CocoaPods, core: add pod 'InferKit' and run pod install.
Companion packages: add them by path from a clone, for example .package(path: "path/to/InferKit/InferKitMLX"), or drag the companion folder into an Xcode project as a local package. They cannot be added as a remote package URL.
Binary XCFrameworks for v0.3.1 are attached to the GitHub Release (core, static MLX, and dynamic MLX). Linking recipes are in the installation guide.
A short Objective-C path after install is to create a backend, for example NFKRemoteBackend, build an NFKInferenceRequest, and call runInferenceForRequest:error:, or submit an NFKInferenceJob.
Example
Add the 0.3.1 Swift package, create a Remote backend pointed at a local Ollama endpoint, and run a prompt request off the main thread. To stay on the device, use a Core ML backend, or add the MLX companion from a local checkout and load one of its catalogue models. To call a hosted provider, pass that provider's API key to the matching Remote backend; that path can send the request to the cloud.
Works with
Listed in
- github.com/belisoful/InferKit
- github.com/belisoful/InferKit/blob/main/README.md
- github.com/belisoful/InferKit/blob/main/Docs/installation.md
- github.com/belisoful/InferKit/blob/main/Docs/inference-guide.md
- github.com/belisoful/InferKit/blob/main/Docs/model-index.md
- github.com/belisoful/InferKit/releases
Read the code before you install anything. SwiftAgents doesn't review or endorse the tools listed here. Active: a commit in the last 90 days. Slowing: last commit within the past year. Stale: older than a year, or archived.
More in this category
apfel
Command-line tool, chat mode and local OpenAI-compatible server for the on-device model in Apple's FoundationModels framework. Needs macOS 26 and Apple silicon.
Argmax OSS Swift (WhisperKit)
Argmax's open-source on-device speech toolkit for Apple silicon, and the home of WhisperKit.
MLX Swift Examples
Example apps and code showing how to use MLX Swift.
SwiftAgents