> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiany.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini generateContent

> Gemini-compatible content generation endpoint.

Use `/v1beta/models/{model}:generateContent` for Gemini-compatible integrations.

```bash theme={null}
curl https://apiany.ai/v1beta/models/gemini-3.5-flash:generateContent \
  -H "Authorization: Bearer $APIANY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [
          { "text": "Summarize why async media tasks are useful." }
        ]
      }
    ]
  }'
```

The path model is a public APIAny.AI model ID.

## Streaming

Call `:streamGenerateContent` instead of `:generateContent` to receive a
Gemini server-sent event stream of incremental `candidates` chunks.

```bash theme={null}
curl https://apiany.ai/v1beta/models/gemini-3.5-flash:streamGenerateContent \
  -H "Authorization: Bearer $APIANY_API_KEY" \
  -H "Content-Type: application/json" -N \
  -d '{ "contents": [ { "parts": [ { "text": "Hello" } ] } ] }'
```

## Structured output

Use `generationConfig.responseMimeType: "application/json"` with
`responseSchema` for JSON output:

```json theme={null}
{
  "contents": [{ "parts": [{ "text": "Extract name and age" }] }],
  "generationConfig": {
    "responseMimeType": "application/json",
    "responseSchema": {
      "type": "object",
      "properties": { "name": { "type": "string" }, "age": { "type": "integer" } }
    }
  }
}
```

## Parameters

Supported `generationConfig`: `temperature`, `topP`, `topK`, `maxOutputTokens`,
`stopSequences`, `responseMimeType`, `responseSchema`, `responseModalities`
(include `IMAGE` for image output). Also top-level `tools` (functionDeclarations)
and `systemInstruction`.
