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

# Gemini Generate Content

> Call Google's Gemini models via the compatible API

**Endpoint:** `POST /projects/cognition/locations/us/publishers/google/models/{model}:generateContent`

Generate text or multimodal content with Google's Gemini models.

<Note>
  Most integrations should use [Create Chat Completion](/api-reference/chat/create). Use this endpoint when you specifically need Google's `generateContent` request format.
</Note>

<CodeGroup>
  ```python Python theme={null}
  import os
  import requests

  url = "https://api.yourouter.ai/v1/projects/cognition/locations/us/publishers/google/models/gemini-1.5-pro-latest:generateContent"

  response = requests.post(
      url,
      headers={
          "Authorization": f"Bearer {os.environ['YOUROUTER_API_KEY']}",
          "Content-Type": "application/json",
          "vendor": "google"
      },
      json={
          "contents": [
              {"role": "user", "parts": [{"text": "hello gemini"}]}
          ]
      }
  )
  print(response.json())
  ```

  ```bash cURL theme={null}
  curl https://api.yourouter.ai/v1/projects/cognition/locations/us/publishers/google/models/gemini-1.5-pro-latest:generateContent \
    -H "Authorization: Bearer $YOUROUTER_API_KEY" \
    -H "Content-Type: application/json" \
    -H "vendor: google" \
    -d '{"contents": [{"role": "user", "parts": [{"text": "hello gemini"}]}]}'
  ```
</CodeGroup>

## Parameters

<ResponseField name="model" type="string" required>
  The Gemini model to use, e.g. `gemini-1.5-pro-latest`.
</ResponseField>

<ResponseField name="contents" type="array" required>
  Input text or multimedia parts for the model.
</ResponseField>

<ResponseField name="safetySettings" type="object">
  Optional safety settings to control content thresholds.
</ResponseField>

## Image Input

Use `inlineData` for image bytes encoded as base64.

```bash theme={null}
curl https://api.yourouter.ai/v1/projects/cognition/locations/us/publishers/google/models/gemini-2.5-flash:generateContent \
  -H "Authorization: Bearer $YOUROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "vendor: google" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [
          { "text": "Describe this image in one sentence." },
          {
            "inlineData": {
              "mimeType": "image/jpeg",
              "data": "<BASE64_IMAGE>"
            }
          }
        ]
      }
    ]
  }'
```

## PDF Input

The Gemini-native `generateContent` format can send PDFs through `inlineData`. Set `mimeType` to `application/pdf`, and pass the base64-encoded raw PDF bytes in `data`.

```bash theme={null}
curl https://api.yourouter.ai/v1/projects/cognition/locations/us/publishers/google/models/gemini-2.5-flash:generateContent \
  -H "Authorization: Bearer $YOUROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "vendor: google" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [
          { "text": "Summarize this PDF's key content." },
          {
            "inlineData": {
              "mimeType": "application/pdf",
              "data": "<BASE64_PDF>"
            }
          }
        ]
      }
    ]
  }'
```

<Note>
  PDF support depends on the selected Gemini model. Long documents consume more context window; in production, control file size and page count, and split documents when needed.
</Note>

See the [Multimodal guide](/guides/multimodal) for the broader integration path.
