Protocols
Gemini-compatible API
Gemini clients call /v1beta/models/{model}:generateContent. RelayRouter serves that path on its own domain, so the Google GenAI SDK, Gemini CLI and hand-written HTTP calls work after you change the base URL and the key. Streaming uses streamGenerateContent exactly as with Google.
Base URL and endpoints
https://relayrouter.io The SDK appends /v1beta itself; for raw HTTP use https://relayrouter.io/v1beta/models/{model}:generateContent.
| Method | Path | Notes |
|---|---|---|
| POST | /v1beta/models/{model}:generateContent | Single response |
| POST | /v1beta/models/{model}:streamGenerateContent | Streaming, add ?alt=sse for server-sent events |
| GET | /v1/models | The models your key can call |
Authentication: x-goog-api-key: <your RelayRouter key>, or the key query parameter, as with Google.
Code
Python
from google import genai
from google.genai import types
client = genai.Client(
api_key="your-relayrouter-key",
http_options=types.HttpOptions(base_url="https://relayrouter.io"),
)
resp = client.models.generate_content(model="gemini-3.8-flash", contents="Hello!")
print(resp.text)cURL
curl "https://relayrouter.io/v1beta/models/gemini-3.8-flash:generateContent" \
-H "x-goog-api-key: $RELAYROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"parts": [{"text": "Hello!"}]}]}'Gemini CLI
export GOOGLE_GEMINI_BASE_URL="https://relayrouter.io"
export GEMINI_API_KEY="your-relayrouter-key"
geminiGroups that speak this protocol
A key belongs to one group. Create it in the console for one of the groups below; the models page has every group and model with live rates.
| Group | Rate | Models (examples) |
|---|---|---|
| Gemini Fast | ¥2.72 per $1 of standard usage, about 60% below the ¥6.8/$ reference | gemini-2.5-flash, gemini-3-flash, gemini-3-flash-preview, gemini-3.1-flash-lite, gemini-3.1-flash-lite-preview and 4 more |
| Gemini Vertex Official | ¥5.4 per $1 of standard usage, about 21% below the ¥6.8/$ reference | gemini-2.0-flash, gemini-2.5-computer-use-preview-10-2025, gemini-2.5-flash, gemini-2.5-flash-image, gemini-2.5-flash-image-preview and 25 more |
Tools that work as-is
- Google GenAI SDK (Python, TypeScript, Go): http_options.base_url=https://relayrouter.io
- Gemini CLI: GOOGLE_GEMINI_BASE_URL and GEMINI_API_KEY
- Any HTTP client: POST to /v1beta/models/{model}:generateContent
Questions
Which Gemini models are available?
gemini-3.8-flash, gemini-3.7-flash and the other models listed in the Gemini groups on the models page. Each group has its own rate.
Can I call Gemini models through the OpenAI-compatible endpoint instead?
Use the protocol of the group your key belongs to. Gemini groups speak the Gemini API; if your tool only speaks OpenAI, pick an OpenAI-protocol group from the models page.
Does streaming work?
Yes, through streamGenerateContent with ?alt=sse, the same as against Google.
How is it billed?
Per token at the group's rate from a prepaid balance, with no platform fee; failed requests are not billed.