v0.10.7
The Leap SDK is a Kotlin Multiplatform library: the same ModelRunner / Conversation / MessageResponse API runs on every supported target. The code differs only in language (Swift vs. Kotlin) and packaging (SPM, Gradle, or Kotlin/Native plugin) β the call shapes are identical. For background on what the SDK is and what first-class LFM support means in practice, see the Overview.
Migrating from 0.9.x? v0.10.0 unifies the SDK into a single Kotlin Multiplatform distribution published from
Liquid4All/leap-sdk. The standalone Liquid4All/leap-ios repo is no longer the source-of-truth. See the SDK changelog for the transition story and drop-in replacements for legacy Leap.load(...) / LiquidEngine(...) call sites.1. Prerequisites
- iOS / macOS
- Android
- JVM Desktop
- Linux / Windows native
- Xcode 16.0+ with Swift 6.0.
- iOS 17.0+ or macOS 15.0+ (Apple Silicon only β Mac Catalyst is not supported; the shipped XCFrameworks contain only
ios-arm64,ios-arm64-simulator, andmacos-arm64slices, andPackage.swiftdeclares only.iOS(.v17)/.macOS(.v15)platforms). - A physical iPhone or iPad with at least 3 GB RAM for best performance. The simulator works for development but runs models much slower.
2. Install the SDK
- iOS / macOS (SPM)
- Android (Gradle)
- JVM Desktop
- Linux / Windows native
The Leap SDK ships exclusively through Swift Package Manager in v0.10.0. CocoaPods support has been removed.
Pick exactly one of
- In Xcode choose File β Add Package Dependencies.
- Enter
https://github.com/Liquid4All/leap-sdk.git. - Select the
0.10.7release (or newer). - Add the products you need to your app target.
| Product | What it provides | Re-exports |
|---|---|---|
LeapSDK | Core inference + conversation API. Use this when you only need foreground manifest loads via LeapDownloader.loadModel(...). | β |
LeapModelDownloader | The Swift ModelDownloader class with URLSession-backed loadModel(...) / downloadModel(...) and background-session support. Re-exports every LeapSDK Kotlin type, so a single import LeapModelDownloader reaches Conversation, ModelRunner, ChatMessage, Leap, the convenience extensions, and so on. | every LeapSDK type |
LeapOpenAIClient | OpenAI-compatible cloud chat client | β |
LeapUI | Voice assistant widget (SwiftUI/AppKit/Compose) | LeapSDK |
LeapSDKMacros | @Generatable / @Guide macros | swift-syntax |
LeapSDK or LeapModelDownloader per target. LeapModelDownloader is the recommended choice β its ModelDownloader.loadModel(...) covers everything LeapDownloader.loadModel(...) does and adds background-friendly transfers, and LeapSDKβs types are re-exported through the same import LeapModelDownloader statement. Drop the LeapSDK dependency from any target that already pulls in LeapModelDownloader. Add LeapSDKMacros if you use @Generatable constrained generation. LeapOpenAIClient and LeapUI are independent opt-ins.Framework type (v0.10.6+).
LeapModelDownloader.xcframework is now a dynamic framework (was static in 0.10.5) and bundles the three inference engine dylibs under Frameworks/. SPM applies Embed & Sign automatically; manual Xcode integrators must select βEmbed & Signβ on the framework instead of βDo Not Embedβ.Pin to explicit binary XCFrameworks
Pin to explicit binary XCFrameworks
For explicit pinning, declare each framework as a Note that the binary target name is
.binaryTarget in your Package.swift. The XCFramework assets live on the Liquid4All/leap-sdk v0.10.7 release page β copy the SHA-256 values from there.LeapUi (lowercase i) β import LeapUi in Swift sources matches the binary-target module name, even though the SPM library product is LeapUI.3. Load a model
The recommended path is manifest-based loading. On every platform, the platform downloaderβsloadModel(...) downloads (if needed) and loads in one call β ModelDownloader.loadModel(...) on iOS / macOS, LeapModelDownloader.loadModel(...) on Android, and LeapDownloader.loadModel(...) on JVM and Linux / Windows Kotlin/Native. All paths fetch from the LEAP Model Library on first use and load from cache thereafter.
- Swift (iOS / macOS)
- Kotlin (Android)
- Kotlin (JVM / native)
ModelDownloader.loadModel(...) runs the file transfer through URLSession (so it inherits background-session support when you pass a sessionConfiguration) and then loads the on-disk files in place β no need to pair the downloader with a separate loader. If you only need foreground transfers and cross-platform Swift/Kotlin code, LeapDownloader.loadModel(modelName:, quantizationType:) has the same shape minus the URLSession integration; it ships in the same LeapModelDownloader SPM product, so no extra import is needed. See Model Loading.Loading a sideloaded GGUF
When you already have a model file on disk β shipped as an app asset,adb push-ed for development, or downloaded by your own pipeline β use loadSimpleModel(model: ModelSource(...)) to skip the LEAP Model Library lookup entirely.
- Swift (iOS / macOS)
- Kotlin (all platforms)
mmprojPath. For an audio-capable model, pass audioDecoderPath (and optionally audioTokenizerPath).4. Stream a response
Both platforms expose the same streaming shape: an async sequence ofMessageResponse values, each handled with an exhaustive switch.
- Swift (iOS / macOS)
- Kotlin (all platforms)
5. Send images and audio (optional)
If the loaded model is multimodal (and its companion files were detected), you can attach a non-text part β an image, a WAV blob, or raw PCM samples β alongside the text in aChatMessage.
Multimodality is model-specific. Most multimodal models we ship are text + one other modality: text + vision (the VLM family) or text + audio (the audio family) β not both in the same checkpoint. Send image content (
fromJPEGData(_:), image(url:), fromBitmap(...) / fromUIImage(_:)) only to a vision-capable model, and audio content (fromWAVData(_:), fromFloatSamples(_:sampleRate:)) only to an audio-capable model. Mixing modalities a model wasnβt trained on will either fail to load the companion file or produce nonsense. Check the modelβs Hugging Face card before wiring up a non-text input path.- Swift (iOS / macOS)
- Kotlin (all platforms)
6. Next steps
Model Loading
Full
LeapModelDownloader / LeapDownloader reference, loadSimpleModel, KV cache reuse, and runtime options.Conversation & Generation
Conversation, ModelRunner, MessageResponse, and GenerationOptions.Function Calling
Tool use with Hermes and Pythonic parsers.
Constrained Generation
Structured JSON output via
@Generatable macros.Voice Assistant Widget
Drop-in Compose voice orb for iOS, macOS, Android, and JVM Desktop.
Desktop & Native Platforms
JVM Desktop, Linux native (Kotlin/Native), Windows MinGW, and macOS deep-dive.