← all repositories
aallam/openai-kotlin

OpenAI's API, but make it Kotlin-native

A Kotlin multiplatform client that wraps OpenAI's API in coroutines instead of leaving you to wrestle with raw HTTP.

1.8k stars Kotlin Other AI
openai-kotlin
Not currently ranked — collecting fresh signals.
star history

What it does

openai-kotlin is a typed client for OpenAI’s API built on Kotlin coroutines and Ktor. It covers the full surface area: chat, images, embeddings, audio, fine-tuning, batch jobs, and the newer Assistants/Threads/Vector Stores beta. You bring a Ktor engine (OkHttp, CIO, etc.) and an API key; the library handles the rest.

The interesting bit

Multiplatform is the real pitch. The same dependency works in commonMain for JVM, JS, and WASM targets, with per-platform engine selection. That’s rarer than it should be in the LLM client space, where most libraries are JVM-only or Python-first afterthoughts.

Key highlights

  • Coroutine-native: suspending functions throughout, no callback soup
  • Multiplatform: commonMain dependency with per-target Ktor engines
  • BOM support for Gradle version alignment (Maven users are out of luck here)
  • ProGuard/R8 rules bundled in the JAR
  • Live integration tests exist but are opt-in and billable; offline tests run by default

Caveats

  • Unofficial and unaffiliated with OpenAI; API drift is your problem
  • Gradle required for multiplatform; JVM-only Maven usage is possible but second-class
  • Some features (Assistants, Vector Stores) are still in beta

Verdict

Kotlin developers building cross-platform or server-side LLM features should look here first. If you’re already in Python or don’t need multiplatform, this is just another API wrapper.

Frequently asked

What is aallam/openai-kotlin?
A Kotlin multiplatform client that wraps OpenAI's API in coroutines instead of leaving you to wrestle with raw HTTP.
Is openai-kotlin open source?
Yes — aallam/openai-kotlin is open source, released under the MIT license.
What language is openai-kotlin written in?
aallam/openai-kotlin is primarily written in Kotlin.
How popular is openai-kotlin?
aallam/openai-kotlin has 1.8k stars on GitHub.
Where can I find openai-kotlin?
aallam/openai-kotlin is on GitHub at https://github.com/aallam/openai-kotlin.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.