Google GenAI SDK
Google GenAI SDK
Gemini models can be called with Google's google-genai (Python) and @google/genai (JavaScript) SDKs. Set the base URL in the SDK's HTTP options (http_options in Python, httpOptions in JavaScript) to https://api.oxyy.ai; the SDK adds /v1beta itself.
POSThttps://api.oxyy.ai/v1beta/models/{model}:generateContent
POSThttps://api.oxyy.ai/v1beta/models/{model}:streamGenerateContent
POSThttps://api.oxyy.ai/v1beta/models/{model}:countTokensfree
GEThttps://api.oxyy.ai/v1beta/modelsmodels served over this SDK
The SDK's api_key is sent as the x-goog-api-key header; a ?key=query parameter or Authorization: Bearer works too.
Gemini models only. Any other model is refused with a 400 in Google's error shape. The SDK's Imagen and Veo calls (
generate_images, generate_videos) are not served here either — use image generation and video generation with the models listed there.Code examples
# pip install google-genai import os from google import genai from google.genai import types client = genai.Client( api_key=os.environ["OXYY_API_KEY"], http_options=types.HttpOptions(base_url="https://api.oxyy.ai"), ) response = client.models.generate_content( model="gemini-3-flash", contents="Hello!", config=types.GenerateContentConfig( system_instruction="Be concise.", temperature=0.7, max_output_tokens=1024, ), ) print(response.text)
// npm install @google/genai import { GoogleGenAI } from '@google/genai'; const ai = new GoogleGenAI({ apiKey: process.env.OXYY_API_KEY, httpOptions: { baseUrl: 'https://api.oxyy.ai' } }); const response = await ai.models.generateContent({ model: 'gemini-3-flash', contents: 'Hello!' }); console.log(response.text);
curl https://api.oxyy.ai/v1beta/models/gemini-3-flash:generateContent \ -H "Content-Type: application/json" \ -H "x-goog-api-key: $OXYY_API_KEY" \ -d '{"contents": [{"parts": [{"text": "Hello!"}]}]}'
Supported features
| Feature | Status | Notes |
|---|---|---|
:generateContent, :streamGenerateContent | Supported | Streaming is what ?alt=sse and the SDK's generate_content_stream use |
:countTokens | Supported | Answered from this gateway's tokenizer; exempt from your rate limit |
GET /v1beta/models | Supported | Lists only the models offered over this SDK. Requires your API key. |
systemInstruction | Supported | |
generationConfig | Supported | temperature, topP, topK, maxOutputTokens, stopSequences, responseMimeType, responseSchema, thinkingConfig |
tools / functionDeclarations | Supported | Both parameters and parametersJsonSchema, in camelCase or snake_case — the Python SDK sends snake_case |
safetySettings | Supported | Forwarded to the provider |
| Inline and file data parts | Supported | inlineData (base64) and fileData for images, audio, video and documents |
| Non-Gemini models | Not supported | Refused with a 400 in Google's own error shape |
| Imagen and Veo through this SDK | Not supported | Use /v1/images/generations and /v1/videos/generations |
