diff options
| author | Claude <claude@anthropic.com> | 2026-03-04 19:14:55 +0100 |
|---|---|---|
| committer | Claude <claude@anthropic.com> | 2026-03-04 19:14:55 +0100 |
| commit | 171c5b86ef05974426ba5c5d8547c8025977d1a2 (patch) | |
| tree | 2a1193e2bb81a6341e55d0b883a3fc33f77f8be1 /src/gemini/__init__.py | |
| parent | 9f14edf2b97286e02830d528038b32d5b31aaa0a (diff) | |
| parent | 0278c87f062a9ae7d617b92be22b175558a05086 (diff) | |
| download | gemini-py-main.tar.gz gemini-py-main.zip | |
Diffstat (limited to 'src/gemini/__init__.py')
| -rw-r--r-- | src/gemini/__init__.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/gemini/__init__.py b/src/gemini/__init__.py new file mode 100644 index 0000000..8c78cd7 --- /dev/null +++ b/src/gemini/__init__.py @@ -0,0 +1,53 @@ +""" +gemini-py: Python SDK for Gemini API. + +Reverse-engineered from Gemini CLI v0.31.0. Uses OAuth credentials from +~/.gemini/oauth_creds.json (created by logging in via the Gemini CLI). + +Example: + import asyncio + from gemini import GeminiClient + + async def main(): + async with GeminiClient() as client: + # Streaming + async for chunk in client.send_message_stream("Hello!"): + print(chunk.text_delta, end="", flush=True) + print() + + # Non-streaming + response = await client.send_message("What is 2+2?") + print(response.text) + + asyncio.run(main()) +""" + +from .client import GeminiClient, query +from .models import Model, list_models +from .types import ( + Content, + FunctionDeclaration, + GeminiOptions, + GenerateContentResponse, + GenerationConfig, + StreamChunk, + ToolCall, + UsageMetadata, +) + +__version__ = "0.1.0" + +__all__ = [ + "GeminiClient", + "query", + "Model", + "list_models", + "GeminiOptions", + "GenerateContentResponse", + "StreamChunk", + "Content", + "GenerationConfig", + "UsageMetadata", + "FunctionDeclaration", + "ToolCall", +] |
