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

# Gemini格式

> 使用 Gemini generateContent 风格进行对话



## OpenAPI

````yaml /api-reference/chat/Gemini.json POST /v1beta/models/{model}:generateContent
openapi: 3.1.0
info:
  title: API
  version: 1.0.0
  description: API 文档，支持绘图、语音生成、视频生成、音乐生成等多种 AIGC 接口。
servers:
  - url: https://aiapi.xiaoliu.fun
    description: 生产服务器
security:
  - bearerAuth: []
paths:
  /v1beta/models/{model}:generateContent:
    post:
      tags:
        - 聊天模型
      summary: Gemini 风格生成
      description: 使用 Gemini generateContent 风格进行对话
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
          description: 模型名称，如 gemini-2.5-pro
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                contents:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - model
                      parts:
                        type: array
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                    required:
                      - role
                      - parts
                generationConfig:
                  type: object
                  properties:
                    temperature:
                      type: number
                    maxOutputTokens:
                      type: integer
                safetySettings:
                  type: array
                  items:
                    type: object
                tools:
                  type: array
                  items:
                    type: object
              required:
                - contents
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  candidates:
                    type: array
                    items:
                      type: object
                      properties:
                        content:
                          type: object
                          properties:
                            role:
                              type: string
                            parts:
                              type: array
                              items:
                                type: object
                                properties:
                                  text:
                                    type: string
                        finishReason:
                          type: string
                  usageMetadata:
                    type: object
                    properties:
                      promptTokenCount:
                        type: integer
                      candidatesTokenCount:
                        type: integer
                      totalTokenCount:
                        type: integer
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````