Gemini API

Google's native generateContent API at /v1beta, so the google-genai SDK works unchanged on every catalog model.

Generate content

Set the SDK base URL to https://api.experientiallabs.ai with API version v1beta. Auth: x-goog-api-key (SDK default), ?key=, or Authorization: Bearer. {model} is any slug from GET /v1beta/models (the same set as /v1/models).

POST/v1beta/models/{model}:generateContentGET/v1beta/models
curl "https://api.experientiallabs.ai/v1beta/models/gemini-4-argon:generateContent" \
  -H "x-goog-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contents": [{"role": "user", "parts": [{"text": "Hello"}]}]}'

Stream

:streamGenerateContent?alt=sse (alt=sse is required) sends one GenerateContentResponse per frame; the last carries finishReason and usageMetadata.

POST/v1beta/models/{model}:streamGenerateContent
curl -N "https://api.experientiallabs.ai/v1beta/models/gemini-4-argon:streamGenerateContent?alt=sse" \
  -H "x-goog-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contents": [{"role": "user", "parts": [{"text": "Hello"}]}]}'

Supported fields

FieldContract
contentsText, inlineData (images, MP4 video, WAV/MP3 audio, PDF), public fileData, functionCall / functionResponse (thought signatures kept)
systemInstructionText parts
tools, toolConfigfunctionDeclarations; AUTO, ANY, NONE, allowedFunctionNames. Google server tools (googleSearch, codeExecution, urlContext, fileSearch) are a 400
generationConfigSampling, maxOutputTokens, stopSequences, JSON mode, responseJsonSchema / responseSchema, thinkingConfig. candidateCount other than 1, non-text modalities, speechConfig, imageConfig are refused
safetySettings, labels, seed, logprobsDropped with disclosure
cachedContentRefused; Gemini lanes cache automatically
{
  "contents": [{"role": "user", "parts": [{"text": "Ada Lovelace, born 1815"}]}],
  "generationConfig": {
    "responseMimeType": "application/json",
    "responseJsonSchema": {"type": "object", "properties": {"name": {"type": "string"}, "born": {"type": "integer"}}}
  }
}

Usage, tokens and errors

usageMetadata has promptTokenCount (cached reads also as cachedContentTokenCount), candidatesTokenCount, thoughtsTokenCount, totalTokenCount, plus cost. :countTokens answers an estimate, free. Idempotency-Key is not honored. Errors use Google's envelope; the gateway code is in details[0].reason and the field in details[0].metadata.param (Errors).

POST/v1beta/models/{model}:countTokens
{"error": {"code": 400, "message": "...", "status": "INVALID_ARGUMENT",
  "details": [{"reason": "unsupported_parameter", "metadata": {"param": "generationConfig.candidateCount"}}]}}