GenerateContent
Call AI Hub with the stateless v1beta generateContent and streamGenerateContent compatibility protocol.
POST /api/v1beta/models/{model}:generateContent and POST /api/v1beta/models/{model}:streamGenerateContent (plus /v1beta/... aliases) translate generateContent requests into AI Hub's data-plane routing and billing, then return candidates JSON or SSE frames.
Request
curl --fail-with-body https://tokenhub-api.belive.sg/api/v1beta/models/qwen/qwen3.8-max:generateContent \ -H "x-goog-api-key: $TOKENHUB_API_KEY" \ -H "Content-Type: application/json" \ -d '{"contents":[{"role":"user","parts":[{"text":"Write a one-sentence greeting."}]}]}'
Authentication and model IDs
- Send your workspace inference key in
x-goog-api-keyorAuthorization: Bearer. Query-string?key=credentials are refused with HTTP400so keys never appear in URLs or logs. - Pass an exact
{author}/{slug}catalogue ID in the path (or a supported native alias allowed by your key). GET /api/v1beta/modelslists enabled chat models in{ "models": [...] }format.
Supported boundary
- Supports
systemInstruction,contents(text, inline image/file data,functionCallwiththoughtSignature, andfunctionResponse),tools[].functionDeclarations(parametersandparametersJsonSchema), andgenerationConfig(maxOutputTokens,thinkingConfig.thinkingLevel,stopSequences,responseMimeType/responseSchema). - When a route enforces a smaller single-segment output ceiling,
maxOutputTokensis clamped and reported inX-TokenHub-Ignored-Fields.safetySettingsandtoolConfigare ignored and listed inX-TokenHub-Ignored-Fields. cachedContent,candidateCount > 1,fileDataURIs, numericthinkingBudgeton level-only models, and provider-hosted tools (googleSearch,codeExecution,urlContext) are refused with HTTP400in the{"error":{"code","message","status"}}envelope.
For CLI configuration, see the Antigravity CLI guide.
Support and limits
Responses and Messages use the selected route's supported protocol. Qualified Messages routes preserve native fields; other routes translate supported fields. Unsupported controls are refused with 400 or, on legacy translated routes, listed in X-TokenHub-Ignored-Fields.
Gateway validation, defaults and response forms are in the operation index and the OpenAPI schemas.
Error codes and recovery are in Errors and recovery. Keep the request or job ID from each response: it identifies the call in Activity and for support.