Unofficial Kotlin multiplatform variant of the OpenAI SDK
The official OpenAI SDK targets the JVM only, which rules it out for Kotlin projects that also run on native, JS, WASM, iOS or Android Native targets.
This project provides an idiomatic Kotlin multiplatform client for the OpenAI API — built on Ktor and kotlinx.serialization, suspending and coroutine-friendly by default, with a DSL-based request builder instead of long constructor argument lists.
In build.gradle.kts add:
dependencies {
implementation("com.xemantic.ai.openai:openai-sdk-kotlin:0.1.0")
}See DEVELOPMENT.md for maintenance notes — updating the gradle wrapper and the project dependencies.
All the Markdown files in this project are authored with
semantic line breaks.
Each sentence starts on its own line,
and long sentences may be split further at clause boundaries.
This keeps git diff and code review focused on the sentence that actually changed,
instead of on a whole reflowed paragraph.
There is no maximum line length, and paragraphs are never hard-wrapped to a fixed column. Line length is a rendering concern, so it is left to the editor.
IntelliJ IDEA:
Settings → Editor → General → Soft Wraps,
enable Soft-wrap these files and make sure the mask contains *.md
(the default mask already does).
To toggle it for the file at hand only,
use View → Active Editor → Soft-Wrap.
VS Code:
add the following to your settings.json:
{
"[markdown]": {
"editor.wordWrap": "on"
}
}Alternatively toggle it for the current file with Alt+Z (Option+Z on macOS).