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
This Python package is automatically generated by the OpenAPI Generator 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
pip install gemini-client
From source
If you want to install from source:
pip install git+https://github.com/AbQaadir/gemini-client.git
Then import the package:
import openapi_client
Tests
Execute pytest to run the tests.
Getting Started
Please follow the installation procedure and then run the following:
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 | POST /v1beta/models/{model}:batchEmbedContents | |
| GenerativeServiceApi | generative_service_count_tokens | POST /v1beta/models/{model}:countTokens | |
| GenerativeServiceApi | generative_service_embed_content | POST /v1beta/models/{model}:embedContent | |
| GenerativeServiceApi | generative_service_generate_answer | POST /v1beta/models/{model}:generateAnswer | |
| GenerativeServiceApi | generative_service_generate_dynamic_content | POST /v1beta/dynamic/{dynamic}:generateContent | |
| GenerativeServiceApi | generative_service_generate_model_content | POST /v1beta/models/{model}:generateContent | |
| GenerativeServiceApi | generative_service_generate_tuned_model_content | POST /v1beta/tunedModels/{tunedModel}:generateContent | |
| GenerativeServiceApi | generative_service_stream_generate_dynamic_content | POST /v1beta/dynamic/{dynamic}:streamGenerateContent | |
| GenerativeServiceApi | generative_service_stream_generate_model_content | POST /v1beta/models/{model}:streamGenerateContent | |
| GenerativeServiceApi | generative_service_stream_generate_tuned_model_content | POST /v1beta/tunedModels/{tunedModel}:streamGenerateContent |
Documentation For Models
- AttributionSourceId
- AttributionSourceIdGroundingPassageId
- AttributionSourceIdSemanticRetrieverChunk
- BatchEmbedContentsRequest
- BatchEmbedContentsResponse
- Blob
- Candidate
- CitationMetadata
- CitationSource
- CodeExecutionResult
- Condition
- Content
- ContentEmbedding
- CountTokensRequest
- CountTokensResponse
- DynamicRetrievalConfig
- EmbedContentRequest
- EmbedContentResponse
- ExecutableCode
- FileData
- FunctionCall
- FunctionCallingConfig
- FunctionDeclaration
- FunctionResponse
- GenerateAnswerRequest
- GenerateAnswerResponse
- GenerateAnswerResponseInputFeedback
- GenerateContentRequest
- GenerateContentResponse
- GenerateContentResponsePromptFeedback
- GenerateContentResponseUsageMetadata
- GenerationConfig
- GoogleProtobufAny
- GoogleSearchRetrieval
- GroundingAttribution
- GroundingChunk
- GroundingChunkWeb
- GroundingMetadata
- GroundingPassage
- GroundingPassages
- GroundingSupport
- Interval
- LogprobsResult
- LogprobsResultCandidate
- LogprobsResultTopCandidates
- MetadataFilter
- ModalityTokenCount
- ModelSchema
- MultiSpeakerVoiceConfig
- Part
- PrebuiltVoiceConfig
- RetrievalMetadata
- SafetyRating
- SafetySetting
- SearchEntryPoint
- Segment
- SemanticRetrieverConfig
- SpeakerVoiceConfig
- SpeechConfig
- Status
- ThinkingConfig
- Tool
- ToolConfig
- ToolGoogleSearch
- UrlContextMetadata
- UrlMetadata
- VideoMetadata
- VoiceConfig
Documentation For Authorization
Authentication schemes defined for the API:
ApiKeyAuth
- Type: API key
- API key parameter name: x-goog-api-key
- Location: HTTP header
Author
Release files for gemini-client 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gemini_client-1.0.0.tar.gz | 87.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gemini_client-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 231.1 kB
Release files / gemini_client-1.0.0.tar.gz
| Download URL | gemini_client-1.0.0.tar.gz |
|---|---|
| Size | 87.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08b3d0572304c45db35c1da7c81730838c61d4dcf7efb7a3aee8af9076d46ce9
|
|
BLAKE2b-256 checksum How to use checksums |
702fa601aeb1e5a6d3eee384741146aec4d3a36ea5a7da5a595f084cc7a55e0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / gemini_client-1.0.0-py3-none-any.whl
| Download URL | gemini_client-1.0.0-py3-none-any.whl |
|---|---|
| Size | 143.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb6d750a9a9b9f833f2f24549f61da0d8081b1add90ca4cc0c984ff136bd4c8f
|
|
BLAKE2b-256 checksum How to use checksums |
043903e6136ea9266b785fdc903a3b83b811e1eb203991a91bb2f51399d6a6e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|