Gemini
Gemini Generate Content text and tool-calling model overview
Gemini text capabilities use the Gemini-native generateContent protocol. Do not send OpenAI messages to the Gemini-native endpoint; Gemini uses contents[].parts[].
Endpoint Paths
| Method | Path | Purpose |
|---|---|---|
| POST | /v1beta/models/{model}:generateContent | Gemini v1beta content generation |
| POST | /v1/models/{model}:generateContent | Gemini v1 content generation; the OpenAPI schema includes this v1 path |
| GET | /v1beta/models | Gemini-native model list |
| GET | /v1beta/openai/models | Gemini-compatible OpenAI-style model list |
Request Structure
{
"contents": [
{
"role": "user",
"parts": [
{ "text": "Introduce Routescope API in one sentence." }
]
}
]
}curl -X POST "https://api.routescope.ai/v1beta/models/gpt-4o-mini:generateContent" \ -H "Content-Type: application/json" \ -d '{ "contents": [ { "parts": [ { "text": "Writing a four-word Chinese short poem on the theme of urban night rain." } ] } ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 100000 } }'{
"candidates": [],
"usageMetadata": {},
"modelVersion": "string"
}Authorization
BearerAuth
Model relay interface recognition. Request heading: Autoration: Bearer .
In: header
Path Parameters
Gemini model name.
Request Body
application/json
Enter an array of content to carry one or more rounds of messages between users, models or tools. Each element is a Content object, usually consisting of __ FD_PROTECT_0 __ and __ FD_PROTECT_1 __: __ FD_PROTECT_2 __, commonly known as _ FD_PROTECT_3 __, _ FD_PROTECT_4 __, single-cycle user_9 _ with _ FD_PROTECT_10, _ FD_PROTECT_11 __, _ FD_PROTECT_12 __, _ FD_PRT_13 _ _ _ _ _ _FCED_14 Applies to scenarios such as text conversations, image/audio/video/document understanding, function calls and multimodular generation. The number of arrays and media sizes are based on upstream model and operational configuration limits.
Gemini system command.
Generates configurations such as temperature, TopK, TopP, maximum output length.
Security policy settings. List of safetySettings. Scope: An array length is based on upstream or business configuration.
Gemini tool definition. . Scope: The length of arrays and the complexity of schema are based on upstream limits.
Response Body
application/json
Model Selection
| Model ID | Capability | Typical Use |
|---|---|---|
gemini-2.5-flash-lite | Content generation | Lightweight content generation |
gemini-2.5-flash | Content generation | Low-latency content generation |
gemini-2.5-pro | Content generation | Complex text tasks |
gemini-3.1-flash-lite-preview | Content generation | Preview lightweight model |
gemini-3.1-pro-preview | Content generation | Preview Pro model |
gemini-3-flash-preview | Content generation | Preview Flash model |
gemini-2.5-computer-use-preview-10-2025 | Tool calling | Computer use and tool-calling scenarios |
gemini-3.1-pro-preview-customtools | Tool calling | Custom tool-calling scenarios |
Common Parameters
| Field | Type | Required | Description |
|---|---|---|---|
contents | array | Yes | Gemini content array. Text goes in parts[].text. |
systemInstruction | object | No | System instruction. |
generationConfig | object | No | Generation configuration. |
safetySettings | array | No | Safety policy settings. |
tools | array | No | Gemini tool definitions. |
Model-Specific Notes
| Field | Applicable Models | Description |
|---|---|---|
Path {model} | All Gemini models | Place the target model ID directly in the path. |
tools | gemini-2.5-computer-use-preview-10-2025, gemini-3.1-pro-preview-customtools | These models are intended for tool calling. Do not send tool definitions by default to ordinary content-generation models. |
Generation config support | All | Per-model dedicated defaults are not normalized here. Follow API responses or the actual console display. |
Example Code
curl "https://api.routescope.ai/v1beta/models/gemini-2.5-flash:generateContent" \
-H "Authorization: Bearer $ROUTESCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [{ "text": "Introduce Routescope API in one sentence." }]
}
]
}'Response Structure
Gemini-native responses include fields such as candidates, content.parts, and usageMetadata. Do not reuse the OpenAI choices[].message response structure.
How is this guide?
Last updated on