IranRouter
Docs contents

Docs

Gemini-native ingress

Leave the google-genai SDK alone and point its base URL at /genai.

POSThttps://iranrouter.com/genai/v1beta/models/{model}:generateContent
POSThttps://iranrouter.com/genai/v1beta/models/{model}:streamGenerateContent

Leave the google-genai SDK as it is and point its base URL at /genai. The model and the streaming choice ride in the path, exactly as Google defines them.

python
from google import genai

client = genai.Client(
    api_key="ir-...",
    http_options={"base_url": "https://iranrouter.com/genai"},
)
resp = client.models.generate_content(
    model="google/gemini-2.5-pro",
    contents="سلام",
)

What is translated

  • contents / systemInstruction / generationConfig and tools both ways, plus usageMetadata on the response.
  • Images as inline_data (base64) or file_data.file_uri.
  • Authenticate with x-goog-api-key or Authorization — either works, and the value is your ir- key.
Options with no honest equivalent on our primary surface are dropped rather than guessed at: topK, safetySettings, responseSchema, cachedContent and the thinking budget. If you need them, call the model through chat/completions instead. models.list() works and returns the same catalogue as GET /v1/models, in Google's shape; countTokensis not implemented and is refused in Google's own error shape.