Gemini Compatibility Protocol
Learn how to connect the Google GenAI SDK, AI Studio clients, and third-party applications to OpenRely via the Google Gemini native protocol (/v1beta/models/...:generateContent).
Protocol Overview
Some desktop applications, data analytics tools, Chrome extensions built on the Google technology stack, as well as development projects using the official Google GenAI SDK (such as google-genai or @google/genai), communicate directly with the Google Gemini native REST API specification.
The OpenRely API natively supports the Gemini /v1beta/models/{model}:generateContent endpoint, fully compatible with native parameters and the multimodal Parts structure. You do not need to alter your application logic—simply configure the Base URL and API Key to enjoy high-concurrency access to top-tier Gemini models.
📌 Core Connection Specifications
| Parameter | Standard Value | Description |
|---|---|---|
| API Base URL | https://api.openrely.ai | Depending on client requirements, some tools automatically append /v1beta internally. If required, you can configure https://api.openrely.ai/v1beta. |
| Authentication (Headers / Query) | x-goog-api-key: sk-•••• | Passing the OpenRely Key via Header is recommended; URL Query parameter ?key=sk-•••• is also supported. |
| Data Format | Content-Type: application/json | Standard JSON request and response bodies |
⚡ Core Endpoints and Request Examples
Content Generation (generateContent)
The core native generation endpoint for Google Gemini, supporting text generation, multimodal image/text input, structured JSON output, and contextual multi-turn conversations.
- Endpoint:
POST /v1beta/models/{model}:generateContent - Full URL:
https://api.openrely.ai/v1beta/models/gemini:generateContent
Request Example
curl -X POST "https://api.openrely.ai/v1beta/models/gemini:generateContent" \
-H "x-goog-api-key: sk-••••" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [{ "text": "Hello Gemini!" }]
}
]
}'Response Example
{
"candidates": [
{
"content": {
"parts": [
{
"text": "Gemini request served."
}
],
"role": "model"
},
"finishReason": "STOP",
"index": 0
}
],
"usageMetadata": {
"promptTokenCount": 10,
"candidatesTokenCount": 15,
"totalTokenCount": 25
}
}🛠️ Client and SDK Quick Integration
The latest official google-genai SDK released by Google supports overriding the API endpoint directly:
from google import genai
from google.genai import types
client = genai.Client(
api_key="sk-your-openrely-key",
http_options=types.HttpOptions(
base_url="https://api.openrely.ai",
),
)
response = client.models.generate_content(
model="gemini",
contents="Explain quantum mechanics in one sentence",
)
print(response.text)import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({
apiKey: 'sk-your-openrely-key',
endpoint: 'https://api.openrely.ai',
});
const response = await ai.models.generateContent({
model: 'gemini',
contents: 'Hello Gemini!',
});
console.log(response.text);If certain legacy third-party tools do not support custom HTTP request headers, you can pass the key directly as a URL Query parameter:
curl -X POST "https://api.openrely.ai/v1beta/models/gemini:generateContent?key=sk-your-openrely-key" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{ "role": "user", "parts": [{ "text": "Ping" }] }
]
}'Was this page helpful?
Claude Compatibility Protocol
Learn how to connect clients, CLI programming tools, and Anthropic SDKs that only support Claude's native interface to OpenRely via the official Anthropic native protocol (/v1/messages).
⚡ Using API & Playground
Experience and test AI models online with the Playground, and make seamless API calls via OpenAI / Anthropic / Gemini standard-compatible endpoints.