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

# 调用 Gemini generateContent

> Gemini API 的 `generateContent` 接口。支持文本和多模态内容；图片生成能力取决于所选模型和当前分组。



## OpenAPI

````yaml /openapi/relay.json post /v1beta/models/{model}:generateContent
openapi: 3.0.1
info:
  title: AIOHub API
  description: AIOHub 公开 API
  version: 1.0.0
servers:
  - url: https://api.aiohub.org
security:
  - BearerAuth: []
tags:
  - name: 获取模型列表
  - name: OpenAI Chat
  - name: OpenAI Responses
  - name: 图片生成
  - name: OpenAI 图像
  - name: 视频生成
  - name: Claude Messages
  - name: Gemini API
  - name: OpenAI Embeddings
  - name: 文本补全
  - name: OpenAI 音频
  - name: Realtime API
paths:
  /v1beta/models/{model}:generateContent:
    post:
      tags:
        - Gemini API
      summary: 调用 Gemini generateContent
      description: Gemini API 的 `generateContent` 接口。支持文本和多模态内容；图片生成能力取决于所选模型和当前分组。
      operationId: geminiRelayV1Beta
      parameters:
        - name: model
          in: path
          description: 模型名称
          required: true
          example: gemini-2.5-flash
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                contents:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                      parts:
                        type: array
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                generationConfig:
                  type: object
                  properties:
                    responseModalities:
                      type: array
                      items:
                        type: string
                    imageConfig:
                      type: object
                      properties:
                        aspectRatio:
                          type: string
                        imageSize:
                          type: string
                  description: 可选生成配置。图片相关字段仅在对应 Gemini 图片模型支持时生效。
              required:
                - contents
            example:
              contents:
                - role: user
                  parts:
                    - text: >-
                        Explain how API gateways route requests in one
                        paragraph.
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeminiResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    GeminiResponse:
      type: object
      properties:
        candidates:
          type: array
          items:
            type: object
            properties:
              content:
                type: object
                properties:
                  role:
                    type: string
                  parts:
                    type: array
                    items:
                      type: object
                      properties: {}
              finishReason:
                type: string
              safetyRatings:
                type: array
                items:
                  type: object
                  properties: {}
        usageMetadata:
          type: object
          properties:
            promptTokenCount:
              type: integer
            candidatesTokenCount:
              type: integer
            totalTokenCount:
              type: integer
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key (sk-xxx)

````