gemini-client 1.0.0
Python client library for Google Gemini AI API - GenerativeService API
Requires Python: >=3.9
Keywords: Gemini, AI, Google, GenerativeAI, OpenAI, Chatbot, LLM

# Gemini Client - Python SDK for Google Gemini AI API

A comprehensive Python client library for Google's Gemini AI API. This package provides easy-to-use interfaces for text generation, chat, embeddings, and multimodal AI capabilities.

**Author:** Qaadir  
**Email:** qaadireng@gmail.com  
**GitHub:** [github.com/AbQaadir](https://github.com/AbQaadir)

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 0.0.1
- Package version: 1.0.0
- Generator version: 7.14.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements

Python 3.9+

## Installation & Usage

### pip install

```sh
pip install gemini-client
```

### From source

If you want to install from source:

```sh
pip install git+https://github.com/AbQaadir/gemini-client.git
```

Then import the package:
```python
import openapi_client
```

### Tests

Execute `pytest` to run the tests.

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python

import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://generativelanguage.googleapis.com
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
    host = "https://generativelanguage.googleapis.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'


# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = openapi_client.GenerativeServiceApi(api_client)
    model = 'model_example' # str | The model id.
    batch_embed_contents_request = openapi_client.BatchEmbedContentsRequest() # BatchEmbedContentsRequest | 

    try:
        api_response = api_instance.generative_service_batch_embed_contents(model, batch_embed_contents_request)
        print("The response of GenerativeServiceApi->generative_service_batch_embed_contents:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling GenerativeServiceApi->generative_service_batch_embed_contents: %s\n" % e)

```

## Documentation for API Endpoints

All URIs are relative to *https://generativelanguage.googleapis.com*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*GenerativeServiceApi* | [**generative_service_batch_embed_contents**](docs/GenerativeServiceApi.md#generative_service_batch_embed_contents) | **POST** /v1beta/models/{model}:batchEmbedContents | 
*GenerativeServiceApi* | [**generative_service_count_tokens**](docs/GenerativeServiceApi.md#generative_service_count_tokens) | **POST** /v1beta/models/{model}:countTokens | 
*GenerativeServiceApi* | [**generative_service_embed_content**](docs/GenerativeServiceApi.md#generative_service_embed_content) | **POST** /v1beta/models/{model}:embedContent | 
*GenerativeServiceApi* | [**generative_service_generate_answer**](docs/GenerativeServiceApi.md#generative_service_generate_answer) | **POST** /v1beta/models/{model}:generateAnswer | 
*GenerativeServiceApi* | [**generative_service_generate_dynamic_content**](docs/GenerativeServiceApi.md#generative_service_generate_dynamic_content) | **POST** /v1beta/dynamic/{dynamic}:generateContent | 
*GenerativeServiceApi* | [**generative_service_generate_model_content**](docs/GenerativeServiceApi.md#generative_service_generate_model_content) | **POST** /v1beta/models/{model}:generateContent | 
*GenerativeServiceApi* | [**generative_service_generate_tuned_model_content**](docs/GenerativeServiceApi.md#generative_service_generate_tuned_model_content) | **POST** /v1beta/tunedModels/{tunedModel}:generateContent | 
*GenerativeServiceApi* | [**generative_service_stream_generate_dynamic_content**](docs/GenerativeServiceApi.md#generative_service_stream_generate_dynamic_content) | **POST** /v1beta/dynamic/{dynamic}:streamGenerateContent | 
*GenerativeServiceApi* | [**generative_service_stream_generate_model_content**](docs/GenerativeServiceApi.md#generative_service_stream_generate_model_content) | **POST** /v1beta/models/{model}:streamGenerateContent | 
*GenerativeServiceApi* | [**generative_service_stream_generate_tuned_model_content**](docs/GenerativeServiceApi.md#generative_service_stream_generate_tuned_model_content) | **POST** /v1beta/tunedModels/{tunedModel}:streamGenerateContent | 


## Documentation For Models

 - [AttributionSourceId](docs/AttributionSourceId.md)
 - [AttributionSourceIdGroundingPassageId](docs/AttributionSourceIdGroundingPassageId.md)
 - [AttributionSourceIdSemanticRetrieverChunk](docs/AttributionSourceIdSemanticRetrieverChunk.md)
 - [BatchEmbedContentsRequest](docs/BatchEmbedContentsRequest.md)
 - [BatchEmbedContentsResponse](docs/BatchEmbedContentsResponse.md)
 - [Blob](docs/Blob.md)
 - [Candidate](docs/Candidate.md)
 - [CitationMetadata](docs/CitationMetadata.md)
 - [CitationSource](docs/CitationSource.md)
 - [CodeExecutionResult](docs/CodeExecutionResult.md)
 - [Condition](docs/Condition.md)
 - [Content](docs/Content.md)
 - [ContentEmbedding](docs/ContentEmbedding.md)
 - [CountTokensRequest](docs/CountTokensRequest.md)
 - [CountTokensResponse](docs/CountTokensResponse.md)
 - [DynamicRetrievalConfig](docs/DynamicRetrievalConfig.md)
 - [EmbedContentRequest](docs/EmbedContentRequest.md)
 - [EmbedContentResponse](docs/EmbedContentResponse.md)
 - [ExecutableCode](docs/ExecutableCode.md)
 - [FileData](docs/FileData.md)
 - [FunctionCall](docs/FunctionCall.md)
 - [FunctionCallingConfig](docs/FunctionCallingConfig.md)
 - [FunctionDeclaration](docs/FunctionDeclaration.md)
 - [FunctionResponse](docs/FunctionResponse.md)
 - [GenerateAnswerRequest](docs/GenerateAnswerRequest.md)
 - [GenerateAnswerResponse](docs/GenerateAnswerResponse.md)
 - [GenerateAnswerResponseInputFeedback](docs/GenerateAnswerResponseInputFeedback.md)
 - [GenerateContentRequest](docs/GenerateContentRequest.md)
 - [GenerateContentResponse](docs/GenerateContentResponse.md)
 - [GenerateContentResponsePromptFeedback](docs/GenerateContentResponsePromptFeedback.md)
 - [GenerateContentResponseUsageMetadata](docs/GenerateContentResponseUsageMetadata.md)
 - [GenerationConfig](docs/GenerationConfig.md)
 - [GoogleProtobufAny](docs/GoogleProtobufAny.md)
 - [GoogleSearchRetrieval](docs/GoogleSearchRetrieval.md)
 - [GroundingAttribution](docs/GroundingAttribution.md)
 - [GroundingChunk](docs/GroundingChunk.md)
 - [GroundingChunkWeb](docs/GroundingChunkWeb.md)
 - [GroundingMetadata](docs/GroundingMetadata.md)
 - [GroundingPassage](docs/GroundingPassage.md)
 - [GroundingPassages](docs/GroundingPassages.md)
 - [GroundingSupport](docs/GroundingSupport.md)
 - [Interval](docs/Interval.md)
 - [LogprobsResult](docs/LogprobsResult.md)
 - [LogprobsResultCandidate](docs/LogprobsResultCandidate.md)
 - [LogprobsResultTopCandidates](docs/LogprobsResultTopCandidates.md)
 - [MetadataFilter](docs/MetadataFilter.md)
 - [ModalityTokenCount](docs/ModalityTokenCount.md)
 - [ModelSchema](docs/ModelSchema.md)
 - [MultiSpeakerVoiceConfig](docs/MultiSpeakerVoiceConfig.md)
 - [Part](docs/Part.md)
 - [PrebuiltVoiceConfig](docs/PrebuiltVoiceConfig.md)
 - [RetrievalMetadata](docs/RetrievalMetadata.md)
 - [SafetyRating](docs/SafetyRating.md)
 - [SafetySetting](docs/SafetySetting.md)
 - [SearchEntryPoint](docs/SearchEntryPoint.md)
 - [Segment](docs/Segment.md)
 - [SemanticRetrieverConfig](docs/SemanticRetrieverConfig.md)
 - [SpeakerVoiceConfig](docs/SpeakerVoiceConfig.md)
 - [SpeechConfig](docs/SpeechConfig.md)
 - [Status](docs/Status.md)
 - [ThinkingConfig](docs/ThinkingConfig.md)
 - [Tool](docs/Tool.md)
 - [ToolConfig](docs/ToolConfig.md)
 - [ToolGoogleSearch](docs/ToolGoogleSearch.md)
 - [UrlContextMetadata](docs/UrlContextMetadata.md)
 - [UrlMetadata](docs/UrlMetadata.md)
 - [VideoMetadata](docs/VideoMetadata.md)
 - [VoiceConfig](docs/VoiceConfig.md)


<a id="documentation-for-authorization"></a>
## Documentation For Authorization


Authentication schemes defined for the API:
<a id="ApiKeyAuth"></a>
### ApiKeyAuth

- **Type**: API key
- **API key parameter name**: x-goog-api-key
- **Location**: HTTP header


## Author