Ktor Client

The Ktor Client, a Kotlin Multiplatform Alternative

Ktor 274,728 (github.com/ktorio/ktor (https://github.com/ktorio/ktor 14,532 ), Apache 2.0) is JetBrains' framework for HTTP servers and clients, built on coroutines (3.6.0, September 2026). Its client is common Kotlin that runs on Android, the JVM, iOS and the web over a platform engine: OkHttp 47,077 on Android, Darwin on iOS, fetch on JS, or CIO, Ktor's own. Features arrive as plugins. Needing no Android code, it runs even in a Kotlin script against the test server:

ktor.main.kts: the Ktor client against BookNest's APIKotlin
@file:DependsOn("io.ktor:ktor-client-cio-jvm:3.6.0")
@file:DependsOn("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.11.0")
import io.ktor.client.*
import io.ktor.client.engine.cio.*
import io.ktor.client.plugins.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.json.*
val client = HttpClient(CIO) {                       // CIO: Ktor's own coroutine engine
  expectSuccess = true                               // 4xx and 5xx throw, as in Retrofit
  defaultRequest { url("http://localhost:8616/") }
}
runBlocking {
  val response = client.get("books")
  val books = Json.parseToJsonElement(response.bodyAsText()).jsonArray
  println("${response.status}, ${books.size} books, first: ${books[0].jsonObject["title"]}")
  try {
    client.get("books/99")
  } catch (e: ClientRequestException) { println(e.response.status) }
}
client.close()
Output
200 OK, 6 books, first: "The Quiet Harbor"
404 Not Found

A script cannot run the serialization plugin, so it reads the JSON tree; in an app, the ContentNegotiation plugin lets client.get("books").body<List<BookDto>>() reuse Retrofit 43,944 's @Serializable classes.