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

FeatureStatusNotes
:generateContent, :streamGenerateContentSupportedStreaming is what ?alt=sse and the SDK's generate_content_stream use
:countTokensSupportedAnswered from this gateway's tokenizer; exempt from your rate limit
GET /v1beta/modelsSupportedLists only the models offered over this SDK. Requires your API key.
systemInstructionSupported
generationConfigSupportedtemperature, topP, topK, maxOutputTokens, stopSequences, responseMimeType, responseSchema, thinkingConfig
tools / functionDeclarationsSupportedBoth parameters and parametersJsonSchema, in camelCase or snake_case — the Python SDK sends snake_case
safetySettingsSupportedForwarded to the provider
Inline and file data partsSupportedinlineData (base64) and fileData for images, audio, video and documents
Non-Gemini modelsNot supportedRefused with a 400 in Google's own error shape
Imagen and Veo through this SDKNot supportedUse /v1/images/generations and /v1/videos/generations