interface ClientOptions {
    apiKey?: null | string;
    apiVersion?: string;
    baseURL?: null | string;
    clientAdapter: GeminiNextGenAPIClientAdapter;
    defaultHeaders?: HeadersLike;
    defaultQuery?: Record<string, undefined | string>;
    fetch?: Fetch;
    fetchOptions?: MergedRequestInit;
    logger?: Logger;
    logLevel?: LogLevel;
    maxRetries?: number;
    timeout?: number;
}

Properties

apiKey?: null | string

Defaults to process.env['GEMINI_API_KEY'].

apiVersion?: string
baseURL?: null | string

Override the default base URL for the API, e.g., "https://api.example.com/v2/"

Defaults to process.env['GEMINI_NEXT_GEN_API_BASE_URL'].

The adapter to the parent API client instance (for accessing auth, project, location)

defaultHeaders?: HeadersLike

Default headers to include with every request to the API.

These can be removed in individual requests by explicitly setting the header to null in request options.

defaultQuery?: Record<string, undefined | string>

Default query parameters to include with every request to the API.

These can be removed in individual requests by explicitly setting the param to undefined in request options.

fetch?: Fetch

Specify a custom fetch function implementation.

If not provided, we expect that fetch is defined globally.

fetchOptions?: MergedRequestInit

Additional RequestInit options to be passed to fetch calls. Properties will be overridden by per-request fetchOptions.

logger?: Logger

Set the logger.

Defaults to globalThis.console.

logLevel?: LogLevel

Set the log level.

Defaults to process.env['GEMINI_NEXT_GEN_API_LOG'] or 'warn' if it isn't set.

maxRetries?: number

The maximum number of times that the client will retry a request in case of a temporary failure, like a network error or a 5XX error from the server.

2
timeout?: number

The maximum amount of time (in milliseconds) that the client should wait for a response from the server before timing out a single request.

Note that request timeouts are retried by default, so in a worst-case scenario you may wait much longer than this timeout before the promise succeeds or fails.

milliseconds