Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Googleapis Python genai Interactions Client

From Leeroopedia
Knowledge Sources
Domains HTTP_Client, Authentication
Last Updated 2026-02-15 14:00 GMT

Overview

Concrete tool for the Gemini NextGen API client with authentication and status error handling.

Description

The GeminiNextGenAPIClient and AsyncGeminiNextGenAPIClient classes extend the base HTTP client with Gemini-specific authentication (API key headers), API version path parameters, and HTTP status code to exception mapping (400->BadRequest, 401->Authentication, 429->RateLimit, etc.).

Usage

This is internal infrastructure. Users interact with it indirectly through the main Client class.

Code Reference

Source Location

Signature

class GeminiNextGenAPIClient(SyncAPIClient):
    api_key: str | None
    api_version: str

    def __init__(
        self,
        *,
        api_key: str | None = None,
        api_version: str | None = "v1beta",
        base_url: str | httpx.URL | None = None,
        timeout: float | Timeout | None | NotGiven = not_given,
        max_retries: int = DEFAULT_MAX_RETRIES,
        http_client: httpx.Client | None = None,
    ) -> None: ...

    def copy(self, **kwargs) -> Self: ...

Import

from google.genai._interactions._client import GeminiNextGenAPIClient

I/O Contract

Inputs

Name Type Required Description
api_key str No API key for authentication
api_version str No API version (default "v1beta")
base_url str or URL No Override base URL
max_retries int No Max retry attempts (default 5)

Outputs

Name Type Description
interactions property InteractionsResource Access to the Interactions API resource

Usage Examples

# Internal usage - accessed through the main Client
from google.genai._interactions._client import GeminiNextGenAPIClient

client = GeminiNextGenAPIClient(
    api_key="GEMINI_API_KEY",
    api_version="v1beta",
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment