Ship Onde from Kotlin.

com.ondeinference:onde-inference is the Kotlin SDK for Onde Inference. It runs GGUF language models on the device in Android 8.0+ apps and on the JVM, with suspend functions and Flow streaming, from Maven Central.

Maven Central

Published as com.ondeinference:onde-inference. Add one Gradle line and the native engine comes with it.

Kotlin-first API

Suspend functions for loading and chat, and a Flow<StreamChunk> when you want tokens as they arrive.

Android and JVM

A Kotlin Multiplatform library. The same Rust core runs in Android apps and on the JVM on macOS and Linux.

History handled

The engine keeps the conversation. Ask a follow-up and it already has the earlier turns.

Quick start

Add one Gradle dependency.

Add the library to your app module, then the INTERNET permission so the first model download can reach Hugging Face. To check model downloads or GGUF output before you wire up the UI, use Onde CLI.

// build.gradle.kts
dependencies {
    implementation("com.ondeinference:onde-inference:1.5.0")
}
<!-- AndroidManifest.xml -->
<uses-permission android:name="android.permission.INTERNET" />

Usage

Load. Chat. Stream.

Create one OndeInference with the application context, load the default model in a coroutine, and send a message. For tokens as they arrive, collect the Flow from stream.

import com.ondeinference.onde.OndeInference

val onde = OndeInference(applicationContext)

lifecycleScope.launch {
    // Downloads the default model from Hugging Face on first run.
    onde.loadDefaultModel(systemPrompt = "You are a helpful, concise assistant.")

    val result = onde.chat("What is the capital of Sweden?")
    println(result.text)
}
lifecycleScope.launch {
    onde.stream("Write a haiku about the ocean.").collect { chunk ->
        textView.append(chunk.delta)
        if (chunk.done) println("[done]")
    }
}

Coverage

Phones, emulators and the JVM.

Android 8.0 (API 26) is the floor. The Android build bundles the engine for four ABIs, and the JVM JAR carries native libraries for macOS and Linux.

PlatformABI / architectureStatus
Androidarm64-v8a, armeabi-v7a, x86_64, x86Ready
JVM on macOSApple silicon, IntelReady
JVM on Linuxx86_64, arm64Ready

FAQ

Frequently asked questions.

The same answers, with the install and quick-start code, are in a markdown version of this page for agents and tools that read text.

How do I add Onde to an Android app?

Add implementation("com.ondeinference:onde-inference:1.5.0") to build.gradle.kts and the INTERNET permission to AndroidManifest.xml for the first model download. Create OndeInference(applicationContext), then call loadDefaultModel and chat from a coroutine.

Which Android versions and devices are supported?

Android 8.0 (API 26) and newer. The engine ships for four ABIs: arm64-v8a, armeabi-v7a, x86_64 and x86, so it runs on phones and on emulators.

Does the Kotlin SDK run outside Android?

Yes. It is a Kotlin Multiplatform library with a JVM target, and the JAR bundles native libraries for macOS (Apple silicon and Intel) and Linux (x86_64 and arm64).

Which model loads by default?

loadDefaultModel loads Qwen 2.5 Coder 1.5B (about 941 MB, Q4_K_M) on Android and Qwen 2.5 Coder 3B (about 1.93 GB, Q4_K_M) on the JVM. It needs about 1.1 GB of free storage on Android.

How do I stream tokens in Kotlin?

onde.stream(message) returns a Flow<StreamChunk>. Collect it in a coroutine and append each chunk's delta to your UI; the last chunk has done set to true.

Does the Kotlin SDK need a network connection?

Only for the first model download. The model is fetched from Hugging Face the first time it loads and cached on the device. After that, inference runs on the device with no network request, and prompts never leave it.

Is the Kotlin SDK free and open source?

Yes. The Kotlin SDK is free and dual-licensed under MIT and Apache 2.0. The engine source is at github.com/ondeinference/onde.

Onde Kotlin SDK

Private AI, native to Android.

One Gradle dependency, one Kotlin API. Run models on the device on Android and the JVM without standing up a backend. Talk to us about scale.