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

# Gemini Native /v1beta generateContent — Google Format

> Call Gemini via POST /v1beta/models/{model}:generateContent using x-goog-api-key. Supports generateContent and streamGenerateContent actions.

KiosAPI supports Gemini's native Google API format — use it with the Google GenAI SDK or any client that already targets the Google AI API. You point your existing Google-format requests at KiosAPI's base URL and authenticate with your KiosAPI key; no other changes to your code are required.

<Tip>
  Use camelCase for all parameters (e.g. `toolConfig` ✅, `tool_config` ❌). Some parameters may not be recognised when passed in snake\_case.
</Tip>

## Request

**POST** `https://kiosapi.com/v1beta/models/{model}:{action}`

### Path Parameters

<ParamField path="model" type="string" required>
  The Gemini model to call (e.g. `gemini-2.5-flash`).
</ParamField>

<ParamField path="action" type="string" required>
  The action to perform. Use `generateContent` for a standard request, or `streamGenerateContent?alt=sse` for a streaming response.
</ParamField>

### Headers

| Header           | Required | Description                                       |
| ---------------- | -------- | ------------------------------------------------- |
| `Content-Type`   | Yes      | `application/json`                                |
| `x-goog-api-key` | No\*     | Your KiosAPI key, e.g. `sk-xxx`                   |
| `Authorization`  | No\*     | `Bearer sk-xxx` (alternative to `x-goog-api-key`) |

<Info>
  You can authenticate with either the `x-goog-api-key` header or `Authorization: Bearer`. Both are accepted — use whichever your client already supports.
</Info>

### Request Body

<ParamField body="contents" type="array" required>
  Array of content objects representing the conversation turns.

  <Expandable title="contents properties">
    <ParamField body="contents[].role" type="string" required>
      Role of this turn: `user` or `model`.
    </ParamField>

    <ParamField body="contents[].parts" type="array" required>
      Array of part objects making up this turn's content.

      <Expandable title="parts properties">
        <ParamField body="contents[].parts[].text" type="string">
          Text content for this part.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

### Examples

<Tabs>
  <Tab title="cURL (Non-Streaming)">
    ```bash theme={null}
    curl -X POST "https://kiosapi.com/v1beta/models/gemini-2.5-flash:generateContent" \
      -H "Content-Type: application/json" \
      -H "x-goog-api-key: sk-xxx" \
      -d '{
        "contents": [
          {
            "role": "user",
            "parts": [
              {"text": "How are you?"}
            ]
          }
        ]
      }'
    ```
  </Tab>

  <Tab title="cURL (Streaming)">
    ```bash theme={null}
    curl -X POST "https://kiosapi.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse" \
      -H "Content-Type: application/json" \
      -H "x-goog-api-key: sk-xxx" \
      -d '{
        "contents": [
          {
            "role": "user",
            "parts": [
              {"text": "How are you?"}
            ]
          }
        ]
      }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    url = "https://kiosapi.com/v1beta/models/gemini-2.5-flash:generateContent"
    headers = {
        "Content-Type": "application/json",
        "x-goog-api-key": "sk-xxx"
    }
    data = {
        "contents": [
            {
                "role": "user",
                "parts": [{"text": "How are you?"}]
            }
        ]
    }

    response = requests.post(url, headers=headers, json=data)
    result = response.json()
    print(result["choices"][0]["message"]["content"])
    ```
  </Tab>
</Tabs>

## Response

```json theme={null}
{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1724972230,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I'm doing well, thank you for asking! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 5,
    "completion_tokens": 15,
    "total_tokens": 20
  }
}
```

<Info>
  For the full parameter reference — including `generationConfig`, `safetySettings`, `systemInstruction`, and `toolConfig` — see the [Gemini official documentation](https://ai.google.dev/models/gemini).
</Info>
