Skip to content
This is the staging documentation, where Katara rehearses releases. Live and Test both settle on Avalanche Fuji in test USDC here.

Generate Gemini content

POST
/v1beta/models/{model}:generateContent
curl --request POST \
--url https://api.staging.katara.com/v1beta/models/example:generateContent \
--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.

model
required
string

A foreign model alias or exact katara/ ID.

Media typeapplication/json
object
contents
required
Array<object>
>= 1 items
object
role
string
Allowed values: user model
parts
required
Array<object>
>= 1 items
object
text
string
thought
boolean
functionCall
object
id
string
name
required
string
args
object
functionResponse
object
id
string
name
required
string
response
required
object
systemInstruction
object
role
string
Allowed values: system user
parts
required
Array<object>
>= 1 items
object
text
required
string
tools
Array<object>
object
functionDeclarations
required
Array<object>
>= 1 items
object
name
required
string
/^[A-Za-z_][A-Za-z0-9_.:-]{0,127}$/
description
string
parameters

Gemini Schema with uppercase types. Unsupported keywords are refused.

object
parametersJsonSchema

JSON Schema; mutually exclusive with parameters.

object
toolConfig
object
functionCallingConfig
object
mode
string
Allowed values: AUTO NONE ANY
allowedFunctionNames

Distinct declared names, only with ANY mode.

Array<string>
generationConfig
object
temperature
number
<= 2
topP
number
<= 1
maxOutputTokens
integer
>= 1
candidateCount
integer
Allowed value: 1
stopSequences
Array<string>
seed
integer
responseMimeType
string
Allowed values: text/plain application/json
thinkingConfig
object
thinkingBudget

0 turns thinking off; -1 or a positive budget is accepted and Katara Cortex decides. Not with thinkingLevel.

integer
>= -1
thinkingLevel
string
Allowed values: LOW MEDIUM HIGH low medium high
includeThoughts
boolean
katara

The same routing controls as Chat Completions.

object

Content and the verified usage and cost metadata.

Media typeapplication/json
object
responseId
string
modelVersion
string
candidates
Array<object>
object
index
integer
0
content
object
role
string
Allowed values: user model
parts
required
Array<object>
>= 1 items
object
text
string
thought
boolean
functionCall
object
id
string
name
required
string
args
object
functionResponse
object
id
string
name
required
string
response
required
object
finishReason
string
Allowed values: STOP MAX_TOKENS SAFETY
usageMetadata
object
promptTokenCount
integer
candidatesTokenCount
integer
totalTokenCount
integer
cachedContentTokenCount
integer
usage
object
katara
object
Example
{
"candidates": [
{
"index": 0,
"content": {
"role": "user"
},
"finishReason": "STOP"
}
]
}

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.

Retry-After
integer

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.

Retry-After
integer