Integrating modern generative AI capabilities into Kotlin applications shouldn't require juggling raw HTTP clients or bridging disparate Java libraries. Today, we're excited to announce the 1. 0 release of the Google Gen AI SDK for Kotlin ( google-genai-kotlin ). You can dive right into the code, explore runnable samples, and star the project today on GitHub at googleapis/kotlin-genai .
Built from the ground up as a Kotlin Multiplatform (KMP) library, the SDK brings idiomatic Kotlin paradigms (including first-class Coroutines , asynchronous Flow streaming, and immutable data classes with named and default parameters) to developers targeting both the JVM (backend services, serverless functions, desktop) and Android . The SDK provides a unified surface to interact with both the Gemini Developer API (Google AI Studio) and the Gemini Enterprise Agent Platform (on Google Cloud) with minimal configuration tweaks. The SDK is published to Maven Central under com. genai:google-genai-kotlin .
For multiplatform applications, add the dependency to your commonMain source set: For single-platform Kotlin projects, Gradle automatically selects the optimal variant via Gradle Module Metadata: The primary entry point is the Client class. It manages HTTP connections and authentication automatically based on your environment variables ( GEMINI_API_KEY or GOOGLE_API_KEY for Google AI Studio, and GOOGLE_GENAI_USE_ENTERPRISE=true with standard Google Cloud Application Default Credentials).
Using Kotlin's use extension ensures the client's underlying network engine and HTTP connections are released cleanly: For interactive UIs and responsive CLI tools, generateContentStream returns a cold Kotlin Coroutine Flow , delivering token chunks in real time: Managing conversation history manually across request turns can become tedious. The SDK includes a dedicated chats service that automatically maintains context, appends turns, formats conversation history, and handles function calling: You can also use chat. ) for streaming multi-turn chat responses.
