---
title: "Generate Gemini content"
method: POST
path: "/v1beta/models/{model}:generateContent"
---

# Generate Gemini content

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

Generates a Gemini response using the native generateContent REST request and response format.

## Path parameters

- `model` string, required

## Request body

- GeminiGenerateContentRequest — Request body for the Gemini generateContent REST format.
  - `contents` GeminiContent[], required — Current conversation content. Include the full history for multi-turn requests.
    - `role` 'user' | 'model' | 'system' — Content producer. Conversation turns normally use user or model.
    - `parts` GeminiPart[], required
      - `text` string
      - `inlineData` object
        - `mimeType` string, required
        - `data` string, required — Base64-encoded data.
      - `fileData` object
        - `mimeType` string
        - `fileUri` string, required
      - `functionCall` object
        - `name` string
        - `args` object
      - `functionResponse` object
        - `name` string
        - `response` object
      - `executableCode` object
      - `codeExecutionResult` object
      - `thought` boolean
      - `thoughtSignature` string
  - `tools` object[] — Tools the model may use, such as function declarations, code execution, or supported built-in tools.
  - `toolConfig` object — Configuration shared by the tools in this request.
  - `safetySettings` GeminiSafetySetting[] — Per-category safety blocking settings.
    - `category` 'HARM_CATEGORY_HARASSMENT' | 'HARM_CATEGORY_HATE_SPEECH' | 'HARM_CATEGORY_SEXUALLY_EXPLICIT' | 'HARM_CATEGORY_DANGEROUS_CONTENT' | 'HARM_CATEGORY_CIVIC_INTEGRITY', required
    - `threshold` 'HARM_BLOCK_THRESHOLD_UNSPECIFIED' | 'BLOCK_LOW_AND_ABOVE' | 'BLOCK_MEDIUM_AND_ABOVE' | 'BLOCK_ONLY_HIGH' | 'BLOCK_NONE' | 'OFF', required
  - `systemInstruction` GeminiContent
    - `role` 'user' | 'model' | 'system' — Content producer. Conversation turns normally use user or model.
    - `parts` GeminiPart[], required
      - `text` string
      - `inlineData` object
        - `mimeType` string, required
        - `data` string, required — Base64-encoded data.
      - `fileData` object
        - `mimeType` string
        - `fileUri` string, required
      - `functionCall` object
        - `name` string
        - `args` object
      - `functionResponse` object
        - `name` string
        - `response` object
      - `executableCode` object
      - `codeExecutionResult` object
      - `thought` boolean
      - `thoughtSignature` string
  - `generationConfig` GeminiGenerationConfig — Generation and output configuration. Availability varies by model.
    - `stopSequences` string[]
    - `responseMimeType` 'text/plain' | 'application/json' | 'text/x.enum'
    - `responseSchema` object
    - `responseJsonSchema` object
    - `responseModalities` string[]
    - `candidateCount` integer
    - `maxOutputTokens` integer
    - `temperature` number
    - `topP` number
    - `topK` integer
    - `seed` integer
    - `presencePenalty` number
    - `frequencyPenalty` number
    - `responseLogprobs` boolean
    - `logprobs` integer
    - `enableEnhancedCivicAnswers` boolean
    - `thinkingConfig` object
      - `includeThoughts` boolean
      - `thinkingBudget` integer
      - `thinkingLevel` 'THINKING_LEVEL_UNSPECIFIED' | 'MINIMAL' | 'LOW' | 'MEDIUM' | 'HIGH'
    - `imageConfig` object
      - `aspectRatio` string
      - `imageSize` '512' | '1K' | '2K' | '4K'
    - `mediaResolution` 'MEDIA_RESOLUTION_UNSPECIFIED' | 'MEDIA_RESOLUTION_LOW' | 'MEDIA_RESOLUTION_MEDIUM' | 'MEDIA_RESOLUTION_HIGH'
    - `responseFormat` object
  - `cachedContent` string — Cached content resource to use as context. Format: cachedContents/{cachedContent}.
  - `serviceTier` 'unspecified' | 'standard' | 'flex' | 'priority' — Service tier for this request.
  - `store` boolean — Overrides the project-level request logging configuration.

## Response `200`

Successful Gemini GenerateContentResponse.

- GeminiGenerateContentResponse
  - `candidates` GeminiCandidate[]
    - `content` GeminiContent
      - `role` 'user' | 'model' | 'system' — Content producer. Conversation turns normally use user or model.
      - `parts` GeminiPart[], required
        - `text` string
        - `inlineData` object
          - `mimeType` string, required
          - `data` string, required — Base64-encoded data.
        - `fileData` object
          - `mimeType` string
          - `fileUri` string, required
        - `functionCall` object
          - `name` string
          - `args` object
        - `functionResponse` object
          - `name` string
          - `response` object
        - `executableCode` object
        - `codeExecutionResult` object
        - `thought` boolean
        - `thoughtSignature` string
    - `finishReason` 'FINISH_REASON_UNSPECIFIED' | 'STOP' | 'MAX_TOKENS' | 'SAFETY' | 'RECITATION' | 'LANGUAGE' | 'OTHER' | 'BLOCKLIST' | 'PROHIBITED_CONTENT' | 'SPII' | 'MALFORMED_FUNCTION_CALL' | 'IMAGE_SAFETY' | 'UNEXPECTED_TOOL_CALL'
    - `finishMessage` string
    - `safetyRatings` object[]
    - `citationMetadata` object
    - `groundingMetadata` object
    - `avgLogprobs` number
    - `index` integer
  - `promptFeedback` object
    - `blockReason` string
    - `safetyRatings` object[]
  - `usageMetadata` GeminiUsageMetadata
    - `promptTokenCount` integer
    - `cachedContentTokenCount` integer
    - `candidatesTokenCount` integer
    - `toolUsePromptTokenCount` integer
    - `thoughtsTokenCount` integer
    - `totalTokenCount` integer
    - `serviceTier` string
  - `modelVersion` string
  - `responseId` string
  - `modelStatus` object

## Other responses

- `400` — Parameter error
- `401` — Authorization failed

---

[API](https://skmtc.net/ttapi/apis/flowmusic-api-docs.md) · [All operations](https://skmtc.net/ttapi/apis/flowmusic-api-docs/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ttapi/flowmusic-api-docs/revisions/f27f8a59dbd0/schema)
