Expand description
Google Gemini provider adapter.
Implements tt_shared::Provider for Google Gemini’s
generateContent and streamGenerateContent endpoints.
Non-streaming and streaming (SSE via ?alt=sse) are both fully supported.
Embeddings use separate Gemini embedding models and are not wired here;
they return ProviderError::Unsupported.
§Usage
use tt_provider_gemini::{GeminiProvider, ClientConfig};
let provider = GeminiProvider::new(ClientConfig::default());§API differences from OpenAI
- Model is in the URL path, not the request body.
- Auth is the
x-goog-api-keyrequest header (NOT a URL?key=query param — keys in URLs leak via logs/proxies; see review §5.2). - System messages map to
systemInstruction. - Tools use
functionDeclarationsinside a singletoolsobject. - Streaming uses SSE format with
?alt=sse.
Re-exports§
pub use client::ClientConfig;
Modules§
- client
- HTTP client configuration for the Gemini adapter.
- errors
- Maps HTTP status codes and Gemini error bodies to
tt_shared::ProviderError. - pricing
- Pricing table for Google Gemini models (May 2026 baseline).
- stream
- SSE parser and streaming chat completion for the Gemini adapter.
- translate
- Request/response translation for the Gemini adapter.
Structs§
- Gemini
Provider - Stateless Gemini adapter. Holds an HTTP client and the static pricing table.