Skip to main content

Overview

GoModel accepts the Gemini API request dialect at POST /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.
The Gemini API ingress is in beta and covers text, images, function calling, and structured output. Gemini features outside that set are either rejected with a 400 that names them or ignored, as listed under Limitations.

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

Set the API version to 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), fileData parts (Files API and YouTube URIs), executableCode and codeExecutionResult parts, a non-empty functionResponse.parts, media in a model turn or in the system instruction, candidateCount above 1, responseModalities other than TEXT, and responseMimeType values other than text/plain and application/json.
  • Ignored: topK, safetySettings (the serving provider’s own safety defaults apply), and other tuning members without a portable equivalent, such as logprobs, mediaResolution, and videoMetadata.
  • Thought summaries from Gemini models are not returned, and an exact thinkingBudget becomes one of the effort levels above.
  • Generated images are not returned; use /v1/images/generations for image models.
  • Not served: countTokens, embedContent, batchGenerateContent, the Files and cached-content APIs, and the Vertex AI path layout; unknown methods answer 404. streamGenerateContent without alt=sse answers 400.
  • The response cache is not consulted on these routes.
See ADR-0017 for the design rationale and what a native path to Gemini would add.
Last modified on December 3, 2026