Skip to main content
POST
/
v1beta
/
models
/
{model}
:generateContent
Generate Gemini-compatible content
curl --request POST \
  --url https://api.apiany.ai/v1beta/models/{model}:generateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "parts": [
        {}
      ],
      "role": "<string>"
    }
  ],
  "generationConfig": {
    "temperature": 1,
    "topP": 123,
    "topK": 123,
    "maxOutputTokens": 123,
    "stopSequences": [
      "<string>"
    ],
    "responseMimeType": "<string>",
    "responseSchema": {},
    "responseModalities": [
      "<string>"
    ]
  },
  "tools": [
    {}
  ],
  "systemInstruction": {}
}
'
{
  "candidates": [
    {}
  ],
  "usageMetadata": {}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

model
string
required

Body

application/json
contents
object[]
required
generationConfig
object

Generation config. Also note: call :streamGenerateContent (instead of :generateContent) to receive a Gemini SSE stream.

tools
object[]

Tools with functionDeclarations the model may call.

systemInstruction
object

System instruction as a Gemini Content object ({ parts: [{ text }] }).

Response

Gemini-compatible response.

candidates
object[]
required
usageMetadata
object