Gemini-compatible API
The Gemini-compatible route accepts Google-style generateContent requests and translates them to rout.my routing internally.
POST https://api.rout.my/compatible/v1beta/models/{model}:generateContent
POST https://api.rout.my/compatible/v1beta/models/{model}:streamGenerateContentThe /gemini/... alias is also available for clients that expect that prefix.
Authentication
Both styles are accepted:
Authorization: Bearer sk_your_key_hereor:
?key=sk_your_key_hereGenerate content
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:
{
"contents": [
{
"role": "user",
"parts": [
{ "text": "Create a square icon of a blue glass cube." }
]
}
],
"generationConfig": {
"responseModalities": ["IMAGE", "TEXT"],
"imageConfig": {
"aspectRatio": "1:1",
"imageSize": "1K"
}
}
}Put the prompt and any style instructions in contents[].parts[].text (or systemInstruction.parts[].text for shared instructions). Top-level prompt and style are not Gemini request fields. Set the aspect ratio and resolution in generationConfig.imageConfig, as shown above.
Both camelCase and snake_case field names are accepted, including system_instruction, generation_config, response_modalities, image_config, aspect_ratio, image_size, inline_data, and mime_type. Use one naming style consistently; populated camelCase fields take precedence if both are present.
Image references can use inlineData: {"mimeType": "image/png", "data": "<base64>"} or fileData: {"mimeType": "image/png", "fileUri": "https://example.com/reference.png"} (file_data / file_uri are also accepted). The provider must be able to access a referenced URL. For models routed through the Images API, references select image editing and all instruction/message text is joined into the prompt.
Generated images are returned as Gemini-style inlineData parts when available.
Streaming
POST /compatible/v1beta/models/{model}:streamGenerateContentStreaming responses are sent as Server-Sent Events in Gemini-compatible shape.
Models list
Gemini-compatible clients can also call:
GET https://api.rout.my/compatible/v1/modelsor:
GET https://api.rout.my/compatible/models