Client
The main entry point for the Google Gen AI SDK.
Note on Mobile Security: While this SDK supports Android targets via Kotlin Multiplatform, it is intended for server-side use or secure backend environments. We strongly discourage embedding API keys or Google Cloud IAM credentials (such as Service Account JSON keys or OAuth tokens) directly into public mobile client applications without protection. For public mobile apps connecting directly from client devices, please use Firebase AI Logic with Firebase App Check enabled.
Usage:
val client = Client(apiKey = "YOUR_API_KEY")
val response = client.models.generateContent("gemini-3.5-flash", "Hello, world!")
println(response.text)Constructors
Constructs a Client instance for either the Gemini Developer API or the Gemini Enterprise API.
Properties
Service for interacting with Auth Tokens API.
Whether the client is configured to use the Gemini Enterprise API.
Whether no API version was configured via HttpOptions.apiVersion or the GOOGLE_GENAI_API_VERSION environment variable, so the client is using the SDK's default API version for its backend.