Skip to content

Gemini-compatible API

The Gemini-compatible route accepts Google-style generateContent requests and translates them to rout.my routing internally.

text
POST https://api.rout.my/compatible/v1beta/models/{model}:generateContent
POST https://api.rout.my/compatible/v1beta/models/{model}:streamGenerateContent

The /gemini/... alias is also available for clients that expect that prefix.

Authentication

Both styles are accepted:

http
Authorization: Bearer sk_your_key_here

or:

text
?key=sk_your_key_here

Generate content

bash
curl "https://api.rout.my/compatible/v1beta/models/provider%2Fmodel-id:generateContent?key=$ROUTMY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [
          { "text": "Write a short greeting." }
        ]
      }
    ]
  }'

If the client cannot include slashes in the path model name, use a short alias only when that alias is configured. The exact model ID from /v1/models is still the safest value for OpenAI-compatible endpoints.

Image output

For Gemini-style image generation, include IMAGE in responseModalities:

json
{
  "contents": [
    {
      "role": "user",
      "parts": [
        { "text": "Create a square icon of a blue glass cube." }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": ["IMAGE", "TEXT"],
    "imageConfig": {
      "aspectRatio": "1:1",
      "imageSize": "1K"
    }
  }
}

Generated images are returned as Gemini-style inlineData parts when available.

Streaming

text
POST /compatible/v1beta/models/{model}:streamGenerateContent

Streaming responses are sent as Server-Sent Events in Gemini-compatible shape.

Models list

Gemini-compatible clients can also call:

text
GET https://api.rout.my/compatible/v1/models

or:

text
GET https://api.rout.my/compatible/models

API documentation for rout.my.