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; does not spend your rate limit
POSThttps://api.oxyy.ai/v1beta/models/{model}:embedContentGoogle embedding models
POSThttps://api.oxyy.ai/v1beta/models/{model}:batchEmbedContentsGoogle embedding models
POSThttps://api.oxyy.ai/v1beta/models/{model}:predictImagen
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.

Google models only. Any other vendor's model is refused in Google's error shape. Each Google model is served on the methods GET /v1beta/models lists for it in supportedGenerationMethods: chat models on generateContent and countTokens, embedding models on embedContent (the SDK's embed_content), Imagen on predict (generate_images). Veo (generate_videos) is not served here — use 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
:countTokensSupportedCounted by the serving provider's own count endpoint where it has one, else estimated by this gateway; the X-Oxyy-Token-Count header says which (provider or estimate). Free, and it does not spend your rate limit: counting has its own budget per key, ten times your tier's requests per minute and at least 600 a minute. A provider count carries Google's promptTokensDetails and cacheTokensDetails when it gives them.
:embedContent, :batchEmbedContentsSupportedGoogle embedding models; run and billed exactly as /v1/embeddings
:predict (Imagen)SupportedGoogle Imagen models, the SDK's generate_images; run and billed exactly as /v1/images/generations
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
Other vendors' modelsNot supportedRefused in Google's own error shape
Veo through this SDKNot supportedUse /v1/videos/generations