Skip to content

About

Unofficial OpenAI API client for Kotlin multiplatform

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

openai-sdk-kotlin

Unofficial Kotlin multiplatform variant of the OpenAI SDK

Maven Central Version GitHub Release Date license

GitHub Actions Workflow Status GitHub branch check runs GitHub commits since latest release GitHub last commit

GitHub contributors GitHub commit activity GitHub code size in bytes GitHub Created At kotlin version discord users online Bluesky

Why?

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.

Usage

In build.gradle.kts add:

dependencies {
    implementation("com.xemantic.ai.openai:openai-sdk-kotlin:0.1.0")
}

Development

See DEVELOPMENT.md for maintenance notes — updating the gradle wrapper and the project dependencies.

Documentation conventions

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.

Markdown soft wrapping in the IDE

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).

About

Unofficial OpenAI API client for Kotlin multiplatform

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages