Gemini family
Google’s Gemini text models, centered on the Gemini 3.x series. They can be called through the Gemini-native API (the official google-genai SDK works directly) or the OpenAI-compatible API.
Common tasks
Models
The models accept text, image, audio and PDF input, with a context of about 1M tokens. For the full model list and live prices, see the model page , or query the Models API. For image generation models, see Nano Banana.
google/gemini-3.8-flashgoogle/gemini-3.1-pro-previewgoogle/gemini-3.5-flash-liteNo thinking by default; fast responsesgoogle/gemini-3.5-flashYou can omit the google/ prefix. The native API path also works with or without the prefix: both models/google/gemini-3.8-flash:generateContent and models/gemini-3.8-flash:generateContent are valid.
Choosing an endpoint
The native API does not accept the key as a ?key= URL parameter; that returns 401. Use a request header.
Gemini models are currently served by Google Vertex AI (google_vertex). For the full request parameters, see Generate Content.
Examples
Python (google-genai)
import os
from google import genai
client = genai.Client(
api_key=os.environ["OFOX_API_KEY"],
http_options={"api_version": "v1beta", "base_url": "https://api.ofox.ai/gemini"},
)
resp = client.models.generate_content(
model="google/gemini-3.8-flash",
contents="Explain idempotency in one sentence.",
)
print(resp.text)Prompt caching
Gemini applies implicit caching automatically: when a request’s prefix matches a recent request and is long enough, the cached portion is billed at the cache read rate, with no changes to your request.
Common errors
For other general errors, see Error Handling.
Official docs
- Gemini API · Models
- Gemini API · Thinking
- Gemini API · Google Search
- Gemini API · Structured output
- Gemini API · OpenAI compatibility
The official docs describe behavior when calling Google directly. When calling through OfoxAI, model IDs and endpoints on this page take precedence.
FAQ
How do I write a Gemini model ID?
The standard format is google/gemini-3.8-flash; you can also omit the google/ prefix. The native API path works with or without the prefix as well.
What should I do if Gemini responds slowly?
Except for Flash-Lite, Gemini thinks by default, and complex questions can take more than a minute. Pass thinkingLevel: "low" to reduce thinking, pass thinkingBudget: 0 to turn it off on some models, or switch to a Flash-Lite model, which does not think by default.
How do I turn off Gemini thinking?
3.5 Flash and 3 Flash Preview accept thinkingBudget: 0 to turn thinking off. 3.1 Pro Preview and 3.8 Flash cannot turn it off completely; use thinkingLevel: "low" to reduce it. The Flash-Lite series does not think by default.
Why is the Gemini answer truncated with finishReason MAX_TOKENS?
Thinking tokens also count toward maxOutputTokens. Increase maxOutputTokens or reduce thinking.
Can Gemini search the web?
Yes. On the native API, add {"google_search": {}} to tools; groundingMetadata in the response contains the search queries and sources. On the OpenAI-compatible API, pass web_search_options: {}.
How do I authenticate with the Gemini-native API?
Pass your OfoxAI API key in the x-goog-api-key header; Authorization: Bearer is also accepted. The ?key= URL parameter is not supported.
What does 410 model_deprecated mean?
The preview model has been retired, e.g. gemini-3-pro-preview. Switch to google/gemini-3.1-pro-preview or a stable model.
Can Gemini analyze audio and PDFs?
Yes. On the native API, pass base64-encoded files via inline_data; on the OpenAI-compatible API, use a file content block for PDFs and an input_audio content block for audio.