SDK

The interface and design decisions behind the Gemini AI client.

Architecture

The SDK wraps the Google Gemini SDK (google-genai) with a clean Python interface. It handles API key management, caching, error recovery, and model selection.

It was extracted from the Alma project. The original code lived inside a Flask application with hardcoded model names, framework coupling, and a Go service dependency. The extraction removed all of that.

Design decisions

Methods

generate_text(prompt)              # Simple text
generate_chat(messages)            # Chat with history
generate_text_with_thinking(p)     # Text + reasoning
generate_chat_with_thinking(m)     # Chat + reasoning
generate_text_with_url_context(p)  # Text + URL context
generate_chat_with_url_context(m)  # Chat + URL context
text_to_speech(text)               # Text to MP3
generate_image(prompt)             # Image generation
research_topic(topic)              # Deep research

Image providers

Three providers via ImageProviderRegistry:

Found something unexpected? Report an issue.