---
title: "Generate content"
method: POST
path: "/v1beta/models/gemini-3.6-flash:generateContent"
---

# Generate content

`POST /v1beta/models/gemini-3.6-flash:generateContent`

Generate a response with Gemini 3.6 Flash. The final non-empty conversation turn must use the user role.

## Query parameters

- `key` string, required

## Request body

- object
  - `contents` Content[], required — Conversation turns. Do not end the request with a non-empty model turn.
    - `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
  - `systemInstruction` SystemInstruction
    - `parts` Part[]
      - `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
  - `generationConfig` GenerationConfig — Do not include temperature, topP, topK, candidateCount, or thinkingBudget.
    - `thinkingConfig` object
      - `thinkingLevel` 'medium' | 'high' — Maximum reasoning effort.
    - `maxOutputTokens` integer
    - `responseMimeType` string
    - `responseSchema` object — JSON Schema for structured output.
    - `stopSequences` string[]
  - `tools` Tool[] — Function declarations or supported built-in Gemini tools such as Google Search and code execution.
    - `functionDeclarations` object[]
      - `name` string, required
      - `description` string, required
      - `parameters` object, required — JSON Schema for function arguments.
    - `googleSearch` object
    - `codeExecution` object
    - `urlContext` object
  - `toolConfig` object — Tool execution and function-calling configuration.
  - `safetySettings` SafetySetting[] — Per-category content safety thresholds.
    - `category` string, required
    - `threshold` string, required

## Response `200`

Content 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, including a request ending with a non-empty model turn
- `401` — Unauthorized
- `429` — Rate limit exceeded

---

[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)
