Overview
GoModel accepts the Gemini API request dialect atPOST /v1beta/models/{model}:generateContent, in addition to its
OpenAI-compatible API. Clients built on the Google Gen AI SDKs
(google-genai, @google/genai) work by changing the base URL, the API version, and the API key.
The request is translated to GoModel’s canonical chat type at ingress and runs
through the same pipeline as /v1/chat/completions, so virtual models, workflow
policy, guardrails, rate limits, budgets, failover, usage and cost tracking, and
request logging all apply. Because every provider implements chat completion, a
Gemini-format request can be routed to any configured provider (OpenAI,
Anthropic, Bedrock, and others), not only Gemini.
Supported endpoints
{model} is any model ID GoModel serves: gemini-2.5-flash,
openai/gpt-4o-mini, a virtual model name. A model list returns resource names
(models/openai/gpt-4o-mini): pass one to an SDK as it is, or append it to
/v1beta/ in a REST path.
Authentication
A GoModel key is accepted the way the Gemini API takes its own:x-goog-api-key: <key>: the header the SDKs send.?key=<key>: the query parameter of plain REST calls. Prefer the header: a key in a URL can end up in the logs of a proxy in front of the gateway. GoModel redacts it from its own access log and removes it from the request URL after authentication.Authorization: Bearer <key>: GoModel’s primary scheme, which takes precedence when present.
x-goog-api-key and ?key= are read on /v1beta routes only. x-api-key is
accepted too, as on every route.
Example
v1beta as shown: recent SDK releases default to
v1, and GoModel serves the Gemini API under /v1beta only. Without it,
generation calls get a 405, and model listing reads the OpenAI-compatible
/v1/models instead.
The response uses the Gemini shape (candidates, usageMetadata,
modelVersion, responseId). Errors use the Gemini error envelope
({"error": {"code": 400, "message": "...", "status": "INVALID_ARGUMENT"}}),
including authentication errors and unknown /v1beta routes, so the SDKs raise
their own typed errors.
What translates
Cost tracking and request logs
Requests are tracked and logged like the OpenAI-compatible routes, and cost is computed from the provider that served the request. Because the request path carries the model, usage and the request log record these routes under their path template,/v1beta/models/{model}:generateContent and
/v1beta/models/{model}:streamGenerateContent, so one filter covers every
model. The model is recorded in its own field.
Limitations
Every request is translated through GoModel’s canonical chat type, including requests routed to a Gemini model. Gemini features without a canonical equivalent are therefore not available yet:- Rejected with a
400:cachedContent, built-in tools (googleSearch,codeExecution,urlContext, and others),fileDataparts (Files API and YouTube URIs),executableCodeandcodeExecutionResultparts, a non-emptyfunctionResponse.parts, media in a model turn or in the system instruction,candidateCountabove 1,responseModalitiesother thanTEXT, andresponseMimeTypevalues other thantext/plainandapplication/json. - Ignored:
topK,safetySettings(the serving provider’s own safety defaults apply), and other tuning members without a portable equivalent, such aslogprobs,mediaResolution, andvideoMetadata. - Thought summaries from Gemini models are not returned, and an exact
thinkingBudgetbecomes one of the effort levels above. - Generated images are not returned; use
/v1/images/generationsfor image models. - Not served:
countTokens,embedContent,batchGenerateContent, the Files and cached-content APIs, and the Vertex AI path layout; unknown methods answer404.streamGenerateContentwithoutalt=sseanswers400. - The response cache is not consulted on these routes.