Gemini Native

Google Gemini-compatible endpoints for generateContent, streaming, token counting, and model listing.

POSThttps://onerouter.com/v1beta/models/{model}:generateContent

Troubleshooting

Errors follow the Google API error shape with an HTTP status. See Errors & Retries for the full list.

Supported models

Use any Gemini model ID, e.g. google/gemini-3.5-flash or google/gemini-3.1-flash-lite. See the Text & Chat Models page for the current lineup.

Overview

These endpoints are compatible with Google's Gemini API. Point a Gemini SDK or the Gemini CLI at OneRouter's /v1beta base, or use the /gemini/* compatibility prefix. Requests use Gemini's native schema: a contents array of turns, each with role and parts. Authenticate with the x-goog-api-key header (a Bearer token is also accepted).

Request headers

ParameterTypeRequiredDescription
x-goog-api-keystring · requiredrequiredYour OneRouter API key. Standard for Gemini clients.
Authorizationstringoptional`Bearer YOUR_API_KEY` is also accepted.
Content-Typestring · requiredrequiredMust be `application/json`.

Supported paths

ParameterTypeRequiredDescription
/v1beta/models/{model}:generateContentPOSTrequiredGenerate content using Gemini-native schema.
/v1beta/models/{model}:streamGenerateContentPOSToptionalStream Gemini content events.
/v1beta/models/{model}:countTokensPOSToptionalCount tokens when supported upstream.
/v1beta/modelsGEToptionalList Gemini-compatible models.
/gemini/*ANYoptionalCompatibility prefix for Gemini CLI and Google-compatible tooling.

Request body

ParameterTypeRequiredDescription
contentsarrayrequiredConversation turns. Each has `role` (`user` or `model`) and `parts` (text or inline data).
systemInstructionobjectoptionalSystem-level guidance as a `parts` object.
generationConfigobjectoptionalSampling controls: `temperature`, `topP`, `topK`, `maxOutputTokens`, `stopSequences`.
toolsarrayoptionalFunction declarations or grounding tools when supported.
safetySettingsarrayoptionalPer-category safety thresholds.

The response

Gemini returns candidates[]. The text lives at candidates[0].content.parts[0].text; finishReason explains why it stopped; usageMetadata reports token counts (see the panel on the right).

Model-dependent features

OneRouter keeps protocol compatibility and forwards model-specific parameters where supported. Features such as tool calling, structured output, reasoning, prompt caching, web search, image input, audio input, video generation, and provider-specific options depend on the selected model and upstream provider. Check the model detail page before relying on a feature in production.