Stream Gemini content
const url = 'https://api.staging.katara.com/v1beta/models/example:streamGenerateContent?alt=sse';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"contents":[{"role":"user","parts":[{"text":"example","thought":true,"functionCall":{"id":"example","name":"example","args":{}},"functionResponse":{"id":"example","name":"example","response":{}}}]}],"systemInstruction":{"role":"system","parts":[{"text":"example"}]},"tools":[{"functionDeclarations":[{"name":"example","description":"example","parameters":{},"parametersJsonSchema":{}}]}],"toolConfig":{"functionCallingConfig":{"mode":"AUTO","allowedFunctionNames":["example"]}},"generationConfig":{"temperature":1,"topP":1,"maxOutputTokens":1,"candidateCount":1,"stopSequences":["example"],"seed":1,"responseMimeType":"text/plain","thinkingConfig":{"thinkingBudget":1,"thinkingLevel":"LOW","includeThoughts":true}},"katara":{}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url 'https://api.staging.katara.com/v1beta/models/example:streamGenerateContent?alt=sse' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "contents": [ { "role": "user", "parts": [ { "text": "example", "thought": true, "functionCall": { "id": "example", "name": "example", "args": {} }, "functionResponse": { "id": "example", "name": "example", "response": {} } } ] } ], "systemInstruction": { "role": "system", "parts": [ { "text": "example" } ] }, "tools": [ { "functionDeclarations": [ { "name": "example", "description": "example", "parameters": {}, "parametersJsonSchema": {} } ] } ], "toolConfig": { "functionCallingConfig": { "mode": "AUTO", "allowedFunctionNames": [ "example" ] } }, "generationConfig": { "temperature": 1, "topP": 1, "maxOutputTokens": 1, "candidateCount": 1, "stopSequences": [ "example" ], "seed": 1, "responseMimeType": "text/plain", "thinkingConfig": { "thinkingBudget": 1, "thinkingLevel": "LOW", "includeThoughts": true } }, "katara": {} }'Any model name is served by Katara Cortex. Unsupported fields are refused before inference. Function results must match pending call IDs and names. Usage and cost may follow finishReason; read to the end. Payment refusals retain the common gateway body and headers.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”A foreign model alias or exact katara/ ID.
Query Parameters
Section titled “Query Parameters”Use sse for server-sent events; omitted or json returns an incremental JSON array.
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
object
object
object
object
object
object
object
object
Gemini Schema with uppercase types. Unsupported keywords are refused.
object
JSON Schema; mutually exclusive with parameters.
object
object
object
Distinct declared names, only with ANY mode.
object
object
0 turns thinking off; -1 or a positive budget is accepted and Katara Cortex decides. Not with thinkingLevel.
The same routing controls as Chat Completions.
object
Responses
Section titled “Responses”Content and the verified usage and cost metadata.
object
object
object
object
object
object
object
object
object
object
object
Example
[ { "candidates": [ { "index": 0, "content": { "role": "user" }, "finishReason": "STOP" } ] }]Each data event is a Gemini response object, or a gateway error. EOF ends the stream; no [DONE] event is emitted.
Invalid or unsupported format field or tool-result binding, an API key in the query string, or conflicting credentials (INVALID_ARGUMENT).
Authentication failed.
Payment challenge or insufficient funds; payment headers are retained.
A Gemini endpoint Katara does not serve (NOT_FOUND).
A method other than POST (METHOD_NOT_ALLOWED).
The body is over 32 MiB (RESOURCE_EXHAUSTED).
A compressed request body.
Every vendor that could serve the request is rate limiting (provider_rate_limited). Retry-After says when to retry.
Headers
Section titled “Headers”Invalid or interrupted upstream response; no successful completion is fabricated.
No candidate could serve the request in time (provider_overloaded, upstream_timeout, no_capacity). Retry-After says when to retry.