Package-level declarations

Types

Link copied to clipboard
class Batches
Link copied to clipboard
class Caches

Provides methods for managing cached content. Instantiating this class is not required. After instantiating a Client, access methods through client.caches directly.

Link copied to clipboard

The main entry point for the Google Gen AI SDK.

Link copied to clipboard
class ClientException(val code: Int, val status: String, message: String) : GenAiApiException

Exception thrown for 4xx client errors from the GenAI API.

Link copied to clipboard
class Files
Link copied to clipboard
open class GenAiApiException(val code: Int, val status: String, message: String) : GenAiException

Exception thrown when the GenAI API returns an error response.

Link copied to clipboard
sealed class GenAiException : Exception

Base exception class for all exceptions originating from the GenAI SDK.

Link copied to clipboard
expect class GoogleCredentials

Represents the credentials used to authenticate requests to the Google GenAI API.

actual typealias GoogleCredentials = <Error class: unknown class>
Link copied to clipboard
class Live

The Live API client for establishing WebSocket connections to Gemini models.

Link copied to clipboard

Represents an active WebSocket session with the Live API.

Link copied to clipboard
class Models

Provides methods for interacting with the available GenAI models. Instantiating this class is not required. After instantiating a Client, access methods through client.models directly.

Link copied to clipboard
class Page<T>(val items: List<T>, val nextPageToken: String?, val sdkHttpResponse: HttpResponse?)

Represents a single immutable page of results.

Link copied to clipboard
class Pager<T>(val name: String, val pageSize: Int? = null, request: suspend (String?) -> Triple<List<T>?, String?, HttpResponse?>) : Flow<T>

A generic pagination class that implements Flow of T items.

Link copied to clipboard
class ServerException(val code: Int, val status: String, message: String) : GenAiApiException

Exception thrown for 5xx server errors from the GenAI API.

Link copied to clipboard
class Tunings

Functions

Link copied to clipboard
suspend fun Files.downloadToFile(file: File, outputPath: <Error class: unknown class>, config: DownloadFileConfig? = null)
suspend fun Files.downloadToFile(fileName: String, outputPath: <Error class: unknown class>, config: DownloadFileConfig? = null)

Downloads a file from the API and streams it directly to a local file path.

Link copied to clipboard
suspend fun Files.upload(path: <Error class: unknown class>, config: UploadFileConfig? = null): File

Uploads a file at the specified path to the API.

suspend fun Files.upload(file: <Error class: unknown class>, config: UploadFileConfig? = null): File

Uploads a file to the API.