---
title: "/gemini/v1beta/models/{model}:generateContent"
method: POST
path: "/gemini/v1beta/models/{model}:generateContent"
tags: ["Gemini · GenerateContent"]
---

# /gemini/v1beta/models/{model}:generateContent

`POST /gemini/v1beta/models/{model}:generateContent`

## Request

- Base URL: `https://aihubmix.com`
- URL: `https://aihubmix.com/gemini/v1beta/models/{model}:generateContent`
- Auth: one of:
  - API key in header `x-goog-api-key`
  - API key in query parameter `key`
- TypeScript: <https://skmtc.dev/inferera/apis/aihubmix-gateway-api/docs/gemini/v1beta/models/:model:generateContent/post.ts> (a function with typed inputs; its response is checked against the schema)

Native Gemini protocol entry point. Mirrors the request and response
shapes of `https://generativelanguage.googleapis.com` — clients may
point the google-genai SDK at this gateway directly.

## Request body

- GeminiGenerateContentRequest: Native Gemini `generateContent` request body. Field definitions here are illustrative — refer to https://ai.google.dev/api/rest/v1beta/models/generateContent as the authoritative reference.
  - `contents` object[], required
  - `generationConfig` object: Generation parameters (sampling, output shaping, thinking).
    - `temperature` number, nullable: Sampling temperature (0–2). Higher values are more random.
    - `topP` number, nullable: Nucleus sampling cumulative probability threshold (0–1).
    - `topK` integer, nullable: Number of candidates kept for top-k sampling (≥1).
    - `maxOutputTokens` integer, nullable: Maximum number of tokens in a single response (≥1).
    - `candidateCount` integer, nullable: Number of response candidates to return (1–8).
    - `presencePenalty` number, nullable: Presence penalty (-2–2).
    - `frequencyPenalty` number, nullable: Frequency penalty (-2–2).
    - `seed` integer, nullable: Random seed for reproducible sampling.
    - `responseMimeType` 'text/plain' | 'application/json' | 'text/x.enum', nullable: MIME type of the generated response.
    - `stopSequences` string[], nullable: Stop sequences (up to 5).
    - `responseModalities` string[], nullable: Requested output modalities.
    - `responseLogprobs` boolean, nullable: Whether to return log probabilities in the response.
    - `logprobs` integer, nullable: Number of top logprobs per token (0–20). Only valid when responseLogprobs is true.
    - `responseSchema` object, nullable: Output schema (OpenAPI 3.0 subset). Requires responseMimeType of application/json or text/x.enum; mutually exclusive with responseJsonSchema.
    - `responseJsonSchema` object, nullable: Output schema (standard JSON Schema). Requires responseMimeType of application/json; mutually exclusive with responseSchema.
    - `thinkingConfig` object, nullable: Thinking (reasoning) configuration for thinking-capable models.
      - `includeThoughts` boolean, nullable: Whether to include thought summaries in the response.
      - `thinkingBudget` integer, nullable: Thinking token budget. -1 = dynamic, 0 = off (2.5 Pro cannot disable); model-specific ranges, e.g. 2.5 Pro 128–32768, 2.5 Flash 0–24576, 2.5 Flash-Lite 512–24576. For Gemini 3+ prefer thinkingLevel.
      - `thinkingLevel` 'MINIMAL' | 'LOW' | 'MEDIUM' | 'HIGH', nullable: Maximum depth of internal reasoning before responding. Recommended for Gemini 3 or later models; earlier models return an error.
  - `safetySettings` object[]
  - `systemInstruction` object
  - `tools` object[]

## Response `200`

ok

- GeminiGenerateContentResponse: Native Gemini response body. Refer to Google's official documentation for the authoritative field reference.

## Other responses

- `400`: Invalid request
- `401`: Authentication failed
- `403`: Permission denied
- `404`: Not found
- `429`: Rate limited
- `5XX`: Server / upstream error

---

[API](https://skmtc.dev/inferera/apis/aihubmix-gateway-api.md) - [All operations](https://skmtc.dev/inferera/apis/aihubmix-gateway-api/llms.txt) - [OpenAPI document](https://skmtc.dev/inferera/apis/aihubmix-gateway-api/revisions/f293fe0500c2?raw)
