---
title: "Text Generation"
method: POST
path: "/v1beta/models/gemini-3-pro-preview:generateContent"
---

# Text Generation

`POST /v1beta/models/gemini-3-pro-preview:generateContent`

Generate model response based on conversation content.

## Query parameters

- `key` string, required

## Request body

- object
  - `contents` object[], required — Array of conversation contents with user and model messages.
    - `role` 'user' | 'model'
    - `parts` object[]
      - `text` string — Text content
  - `systemInstruction` object — System instruction
    - `parts` object[]
      - `text` string
  - `generationConfig` object
    - `temperature` number — Sampling temperature. Higher values make output more random.
    - `topP` number — Nucleus sampling threshold.
    - `thinkingConfig` object — Thinking configuration
      - `includeThoughts` boolean — Whether to include thinking process
      - `thinkingBudget` integer — Thinking token budget

## Response `200`

Response generated successfully

- GenerateContentResponse
  - `candidates` object[]
    - `content` Content
      - `role` 'user' | 'model'
      - `parts` Part[], required
        - `text` string
        - `thought` boolean — Whether this part contains model reasoning.
        - `thoughtSignature` string — Opaque signature that must be preserved in multi-turn tool workflows.
        - `inlineData` object
          - `mimeType` string, required
          - `data` string, required — Base64-encoded image
        - `fileData` object
          - `mimeType` string, required
          - `fileUri` string, uri, required — Gemini Files URI or supported public media URL.
        - `functionCall` object
          - `name` string
          - `args` object
        - `functionResponse` object
          - `name` string
          - `id` string — Call ID returned by the model.
          - `response` object
        - `executableCode` object
          - `language` string
          - `code` string
        - `codeExecutionResult` object
          - `outcome` string
          - `output` string
    - `finishReason` string
    - `index` integer
    - `safetyRatings` object[], nullable
  - `usageMetadata` object
    - `promptTokenCount` integer
    - `candidatesTokenCount` integer
    - `cachedContentTokenCount` integer
    - `thoughtsTokenCount` integer
    - `toolUsePromptTokenCount` integer
    - `totalTokenCount` integer
    - `serviceTier` string
    - `promptTokensDetails` ModalityTokenCount[]
      - `modality` string
      - `tokenCount` integer
    - `toolUsePromptTokensDetails` ModalityTokenCount[], nullable
      - `modality` string
      - `tokenCount` integer
  - `modelVersion` string
  - `responseId` string
  - `quota` integer — AnyFast quota usage reported for the request.

## Other responses

- `400` — Invalid request
- `401` — Unauthorized

---

[API](https://skmtc.net/anyfast/apis/anthropic-claude-compatible-endpoint.md) · [All operations](https://skmtc.net/anyfast/apis/anthropic-claude-compatible-endpoint/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/anyfast/anthropic-claude-compatible-endpoint/versions/edfc53e182a1/schema)
