Routescope APIRoutescope API
Chat Completions

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

MethodPathPurpose
POST/v1beta/models/{model}:generateContentGemini v1beta content generation
POST/v1/models/{model}:generateContentGemini v1 content generation; the OpenAPI schema includes this v1 path
GET/v1beta/modelsGemini-native model list
GET/v1beta/openai/modelsGemini-compatible OpenAI-style model list

Request Structure

{
  "contents": [
    {
      "role": "user",
      "parts": [
        { "text": "Introduce Routescope API in one sentence." }
      ]
    }
  ]
}
POST
/v1beta/models/{model}:generateContent
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

AuthorizationBearer <token>

Model relay interface recognition. Request heading: Autoration: Bearer .

In: header

Path Parameters

model*string

Gemini model name.

Request Body

application/json

contents?

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.

systemInstruction?object

Gemini system command.

generationConfig?

Generates configurations such as temperature, TopK, TopP, maximum output length.

safetySettings?

Security policy settings. List of safetySettings. Scope: An array length is based on upstream or business configuration.

tools?

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 IDCapabilityTypical Use
gemini-2.5-flash-liteContent generationLightweight content generation
gemini-2.5-flashContent generationLow-latency content generation
gemini-2.5-proContent generationComplex text tasks
gemini-3.1-flash-lite-previewContent generationPreview lightweight model
gemini-3.1-pro-previewContent generationPreview Pro model
gemini-3-flash-previewContent generationPreview Flash model
gemini-2.5-computer-use-preview-10-2025Tool callingComputer use and tool-calling scenarios
gemini-3.1-pro-preview-customtoolsTool callingCustom tool-calling scenarios

Common Parameters

FieldTypeRequiredDescription
contentsarrayYesGemini content array. Text goes in parts[].text.
systemInstructionobjectNoSystem instruction.
generationConfigobjectNoGeneration configuration.
safetySettingsarrayNoSafety policy settings.
toolsarrayNoGemini tool definitions.

Model-Specific Notes

FieldApplicable ModelsDescription
Path {model}All Gemini modelsPlace the target model ID directly in the path.
toolsgemini-2.5-computer-use-preview-10-2025, gemini-3.1-pro-preview-customtoolsThese models are intended for tool calling. Do not send tool definitions by default to ordinary content-generation models.
Generation config supportAllPer-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