litellmkts
0.0.3indexedWrapper for the ollama REST API, simplifying integration and management through a modular, developer-friendly interface. Streamlines cross-platform communication with easy extensibility.
Wrapper for the ollama REST API, simplifying integration and management through a modular, developer-friendly interface. Streamlines cross-platform communication with easy extensibility.
A Kotlin Multiplatform library that wraps the Ollama REST API, enabling local LLM integration across every major platform from a single shared codebase.
litellmkts provides a consistent, developer-friendly interface for communicating with local language models — so you can build AI-powered features that run on-device or on a local server, without tying your code to any single platform.
HandlerFactory abstraction lets you plug in different handlers and back-ends as your needs grow.implementation("io.github.lauro299:litellmkts:0.0.3")
git clone https://github.com/lauro299/litellmkts.git
Then import the project into your development environment.
single<ChatHandler> {
val factory = get<HandlerFactory>()
factory.createChatHandler("ollama")
}
val chatHandler by inject<ChatHandler>()
chatHandler.chat(
BaseParamsModel().also {
it["model"] = modelName
it["messages"] = _state.value.messages
}
)
.catch { onEvent(Error) }
.map { it.message?.content ?: "" }
.reduce { accumulator, value -> "$accumulator$value" }
Responses stream back as a Flow, so you can render tokens as they arrive.
The library is organized around a HandlerFactory that creates the appropriate handler for each type of API functionality (chat, and extensible to others). Platform-specific networking lives in each target's source set (androidMain, iosArm64Main, jvmMain, wasmJsMain, etc.), while the shared logic and public API live in commonMain — the standard Kotlin Multiplatform structure that keeps a single source of truth across all platforms.
Contributions are welcome:
git checkout -b your-branch-namegit push origin your-branch-nameMIT — see the LICENSE file for details.
Surfaced from shared tags and platforms — no rankings paid for.