Google Gemini¶
Setup¶
No extra install — included with pip install llmgate.
Model prefix¶
Models starting with gemini- are routed to Gemini automatically.
completion("gemini-2.5-flash-lite", messages)
completion("gemini-2.0-flash", messages)
completion("gemini-2.5-pro", messages)
Vision¶
Gemini does not accept image URLs natively. llmgate fetches URL images client-side using httpx and sends them as inline bytes — this is transparent to you:
completion("gemini-2.0-flash", messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Describe this chart."},
{"type": "image_url", "image_url": {"url": "https://..."}}, # fetched automatically
],
}])
Structured outputs¶
Uses Gemini's native response_schema + application/json — very reliable:
Notes¶
- Uses the
google-genaiSDK (not the oldergoogle-generativeai). - Conversation roles alternate
user/model. llmgate convertsassistant→modelautomatically. - Tool results are sent as
function_responseparts in a user turn — handled automatically.