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

# /v1beta/models/{model}:generateContent

> Gemini를 사용하여 동기식 텍스트 또는 다중 모드 출력을 생성합니다.

> Gemini 官方文档把视频场景拆成两类：视频理解通常走 `generateContent`，长任务式的视频生成则走 long-running operation。

* 官方文档支持把视频以内联数据、Files API 文件、Cloud Storage URL 甚至 YouTube URL 的形式传给 Gemini
* 视频理解适合摘要、镜头分析、时序问答和字幕辅助场景
* 大文件和可复用视频更适合先上传到 Files API，再在 `contents.parts` 中引用
* 如果你接的是 Veo 这类长任务生成模型，请改走 `/v1beta/models/{model}:predictLongRunning`
* 视频理解的文本结果通常仍然从 `candidates[].content.parts[]` 读取
* 长视频场景要先评估格式约束、抽帧频率和 token 成本


## OpenAPI

````yaml POST /v1beta/models/{model}:generateContent
openapi: 3.1.0
info:
  title: OpenAPI Plant Store
  description: >-
    A sample API that uses a plant store as an example to demonstrate features
    in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://maas.apigo.ai
security:
  - bearerAuth: []
paths:
  /v1beta/models/{model}:generateContent:
    post:
      summary: Gemini generateContent
      description: Generates synchronous text or multimodal output with Gemini.
      parameters:
        - name: model
          in: path
          description: Gemini model name.
          required: true
          schema:
            type: string
            example: gemini-2.5-pro
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GeminiGenerateContentRequest'
            example:
              contents:
                - role: user
                  parts:
                    - text: 请总结这段内容
      responses:
        '200':
          description: Successful Gemini content response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeminiGenerateContentResponse'
              example:
                candidates:
                  - content:
                      role: model
                      parts:
                        - text: 这里是总结结果。
                    finishReason: STOP
                usageMetadata:
                  promptTokenCount: 24
                  candidatesTokenCount: 36
                  totalTokenCount: 60
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - googleApiKey: []
components:
  schemas:
    GeminiGenerateContentRequest:
      type: object
      required:
        - contents
      properties:
        contents:
          type: array
          items:
            $ref: '#/components/schemas/GeminiContent'
        systemInstruction:
          $ref: '#/components/schemas/GeminiContent'
        generationConfig:
          $ref: '#/components/schemas/GeminiGenerationConfig'
        safetySettings:
          type: array
          items:
            $ref: '#/components/schemas/GeminiSafetySetting'
        tools:
          type: array
          items:
            type: object
            additionalProperties: true
    GeminiGenerateContentResponse:
      type: object
      properties:
        candidates:
          type: array
          items:
            $ref: '#/components/schemas/GeminiCandidate'
        usageMetadata:
          $ref: '#/components/schemas/GeminiUsageMetadata'
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    GeminiContent:
      type: object
      properties:
        role:
          type: string
        parts:
          type: array
          items:
            $ref: '#/components/schemas/GeminiPart'
    GeminiGenerationConfig:
      type: object
      properties:
        temperature:
          type: number
        topP:
          type: number
        maxOutputTokens:
          type: integer
        responseMimeType:
          type: string
    GeminiSafetySetting:
      type: object
      properties:
        category:
          type: string
        threshold:
          type: string
    GeminiCandidate:
      type: object
      properties:
        content:
          $ref: '#/components/schemas/GeminiContent'
        finishReason:
          type: string
        safetyRatings:
          type: array
          items:
            $ref: '#/components/schemas/GeminiSafetyRating'
    GeminiUsageMetadata:
      type: object
      properties:
        promptTokenCount:
          type: integer
        candidatesTokenCount:
          type: integer
        totalTokenCount:
          type: integer
    GeminiPart:
      type: object
      properties:
        text:
          type: string
        inlineData:
          $ref: '#/components/schemas/GeminiInlineData'
        fileData:
          $ref: '#/components/schemas/GeminiFileData'
    GeminiSafetyRating:
      type: object
      properties:
        category:
          type: string
        probability:
          type: string
    GeminiInlineData:
      type: object
      properties:
        mimeType:
          type: string
        data:
          type: string
    GeminiFileData:
      type: object
      properties:
        mimeType:
          type: string
        fileUri:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    googleApiKey:
      type: apiKey
      in: header
      name: x-goog-api-key

````