Gemini4KT
0.9.0indexedLightweight wrapper for Gemini REST API, offering simple request/response handling, Gradle example runner, generated API documentation and minimal dependency footprint.
Lightweight wrapper for Gemini REST API, offering simple request/response handling, Gradle example runner, generated API documentation and minimal dependency footprint.
We will not maintain this library anymore. We are moving to Google Gen AI Java SDK(https://github.com/googleapis/java-genai).
This is a Kotlin Multiplatform wrapper library for Gemini's RestAPI, a lightweight library that does not require the Android SDK.
See RestAPI specifications and https://ai.google.dev/gemini-api/reference/rest for more information.
Set your Gemini API key as an environment variable before running the sample:
cp .env.example .env
# Edit .env and set GEMINI_API_KEY=your-real-key
source .env
./gradlew jvmRun
.env is ignored by git so your key stays local. Look at src/commonTest/kotlin/io/github/ugaikit/gemini4kt/samples for sample usage.
Agent.baseEnvironment and CreateAgentRequest.baseEnvironment accept either an inline
AgentEnvironment or an AgentEnvironmentReference. Code that needs inline environment fields
such as , , or can use or
and should handle when the API returns an environment ID.
The API documentation is available at https://takanori-ugai.github.io/Gemini4KT/.
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("io.github.ugaikit:gemini4kt:0.8.0")
}
}
}
}
sourcestypenetworkagent.inlineEnvironmentrequest.inlineEnvironmentnullSurfaced from shared tags and platforms — no rankings paid for.