Gemini-compatible API

GetRouter exposes Gemini-compatible model listing and content generation endpoints.

GET  https://getrouter.ai/v1beta/models
POST https://getrouter.ai/v1beta/models/{model}:generateContent

Replace {model} with the exact model ID.

List models

curl https://getrouter.ai/v1beta/models \
  -H "x-goog-api-key: YOUR_API_KEY"

The response uses a Gemini-compatible model list shape.

Generate content

curl "https://getrouter.ai/v1beta/models/MODEL_ID:generateContent" \
  -H "x-goog-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [
          {"text": "Explain API routing in two sentences."}
        ]
      }
    ],
    "generationConfig": {
      "temperature": 0.4,
      "maxOutputTokens": 256
    }
  }'

Generated content is returned in the Gemini-compatible candidates structure. Usage can be returned in usageMetadata.

Request fields

The generateContent schema includes:

  • contents with user or model roles
  • Text parts
  • Inline data parts with mimeType and Base64 data
  • generationConfig, including temperature, top-p, top-k, maximum output tokens, and stop sequences
  • safetySettings
  • tools
  • systemInstruction

Model support varies. Start with text-only content before adding multimodal input, tools, or model-specific configuration.

Inline data example

A compatible multimodal model can accept an inline data part:

{
  "contents": [
    {
      "role": "user",
      "parts": [
        {"text": "Describe the attached image."},
        {
          "inlineData": {
            "mimeType": "image/png",
            "data": "BASE64_IMAGE_DATA"
          }
        }
      ]
    }
  ]
}

Gemini image generation payloads

The same generateContent path can expose image-oriented response configuration for compatible models, including response modalities and image configuration. Use the exact model documentation and API Reference example for those requests.

Compatibility notes

  • Gemini-compatible clients may construct URLs differently from OpenAI-compatible clients.
  • Do not enter https://getrouter.ai/v1 into a Gemini client unless its integration guide explicitly asks for that value.
  • Confirm whether the client expects an API root, an API version path, or a complete operation endpoint.

Next steps