Gemini Native
Google Gemini-compatible endpoints for generateContent, streaming, token counting, and model listing.
https://onerouter.com/v1beta/models/{model}:generateContentTroubleshooting
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
| Parameter | Type | Required | Description |
|---|---|---|---|
| x-goog-api-key | string · required | required | Your OneRouter API key. Standard for Gemini clients. |
| Authorization | string | optional | `Bearer YOUR_API_KEY` is also accepted. |
| Content-Type | string · required | required | Must be `application/json`. |
Supported paths
| Parameter | Type | Required | Description |
|---|---|---|---|
| /v1beta/models/{model}:generateContent | POST | required | Generate content using Gemini-native schema. |
| /v1beta/models/{model}:streamGenerateContent | POST | optional | Stream Gemini content events. |
| /v1beta/models/{model}:countTokens | POST | optional | Count tokens when supported upstream. |
| /v1beta/models | GET | optional | List Gemini-compatible models. |
| /gemini/* | ANY | optional | Compatibility prefix for Gemini CLI and Google-compatible tooling. |
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| contents | array | required | Conversation turns. Each has `role` (`user` or `model`) and `parts` (text or inline data). |
| systemInstruction | object | optional | System-level guidance as a `parts` object. |
| generationConfig | object | optional | Sampling controls: `temperature`, `topP`, `topK`, `maxOutputTokens`, `stopSequences`. |
| tools | array | optional | Function declarations or grounding tools when supported. |
| safetySettings | array | optional | Per-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.