Gemini-Native Endpoint: generateContent
Call the Gemini lineup over the native Google protocol — generateContent structure, multimodal parts, system instructions, thinking budgets and streaming.
Endpoint: https://api.zaimod.com/v1beta/models/{model}:generateContent — structurally identical to Google's official Gemini API. The official google-genai SDK connects via a custom base_url.
Official SDK
from google import genai
from google.genai import types
client = genai.Client(
api_key="sk-your-zaimod-key",
http_options=types.HttpOptions(base_url="https://api.zaimod.com"),
)
resp = client.models.generate_content(
model="gemini-3.1-flash-lite-preview",
contents="Explain RAG in three sentences",
)
print(resp.text)Raw HTTP
curl "https://api.zaimod.com/v1beta/models/gemini-3.1-flash-lite-preview:generateContent" \
-H "x-goog-api-key: $ZAIMOD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"parts": [{"text": "Hello"}]}]
}'The OpenAI-style header also works: Authorization: Bearer $ZAIMOD_API_KEY.
Request structure
{
"systemInstruction": {"parts": [{"text": "You are a meticulous editor."}]},
"contents": [
{"role": "user", "parts": [{"text": "Polish this sentence: ..."}]},
{"role": "model", "parts": [{"text": "..."}]},
{"role": "user", "parts": [{"text": "Make it shorter"}]}
],
"generationConfig": {
"temperature": 0.3,
"maxOutputTokens": 2048
}
}Roles are user and model; history is passed in full every turn.
Multimodal input
Parts can mix text and media:
{
"contents": [{
"role": "user",
"parts": [
{"text": "What product is in this image?"},
{"inlineData": {"mimeType": "image/jpeg", "data": "<base64>"}}
]
}]
}Images, audio and video are supported (the Gemini premium group has the most complete video analysis). URL references use fileData.
Streaming
Switch the endpoint to :streamGenerateContent?alt=sse:
curl -N "https://api.zaimod.com/v1beta/models/gemini-3.1-pro-preview:streamGenerateContent?alt=sse" \
-H "x-goog-api-key: $ZAIMOD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"parts": [{"text": "Tell me a nerdy joke"}]}]}'SDK side:
for chunk in client.models.generate_content_stream(
model="gemini-3.1-pro-preview",
contents="Tell me a nerdy joke",
):
print(chunk.text, end="")Thinking models
gemini-3.7-flash-thinking-* / gemini-3.8-flash-thinking-* accept a thinking budget:
{
"contents": [{"parts": [{"text": "Prove that the angles of a triangle sum to 180°"}]}],
"generationConfig": {"thinkingConfig": {"thinkingBudget": 4096}}
}The -low / -medium / -high suffixes set default thinking intensity — just pick a suffix, no extra parameters needed.
Structured output
{
"contents": [{"parts": [{"text": "Extract company names and amounts"}]}],
"generationConfig": {"responseMimeType": "application/json"}
}The Gemini lineup
| Model | Positioning |
|---|---|
| gemini-3.1-flash-lite-preview | Lowest-cost daily driver |
| gemini-2.5-flash / 3.5-flash | Multimodal workhorses |
| gemini-3.1-pro-preview | Long-context flagship |
| gemini-3.8-flash family | Coding and agents |
Pricing on the pricing page.