API reference

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

bash
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-key or Authorization: Bearer. Query-string ?key= credentials are refused with HTTP 400 so 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/models lists enabled chat models in { "models": [...] } format.

Supported boundary

  • Supports systemInstruction, contents (text, inline image/file data, functionCall with thoughtSignature, and functionResponse), tools[].functionDeclarations (parameters and parametersJsonSchema), and generationConfig (maxOutputTokens, thinkingConfig.thinkingLevel, stopSequences, responseMimeType/responseSchema).
  • When a route enforces a smaller single-segment output ceiling, maxOutputTokens is clamped and reported in X-TokenHub-Ignored-Fields. safetySettings and toolConfig are ignored and listed in X-TokenHub-Ignored-Fields.
  • cachedContent, candidateCount > 1, fileData URIs, numeric thinkingBudget on level-only models, and provider-hosted tools (googleSearch, codeExecution, urlContext) are refused with HTTP 400 in 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.