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

# Gemini Chat

> Interface description: Compatible endpoint of Gemini `:generateContent` API (non-streaming, aggregation returns complete results). The request and response formats follow the Gemini specification; authentication uses the `x-goog-api-key` header (carried by Gemini SDK by default). Existing Gemini SDK can be accessed by simply replacing the baseURL and API Key, and billing is based on AiToEarn points.

Before calling this interface, please request the ["Conversation Model List"](/en/api-reference/get-api-ai-models-chat) interface (`GET /api/ai/models/chat`) to obtain the currently available model list.



## OpenAPI

````yaml /openapi/en/aitoearn.openapi.json post /api/ai/v1beta/models/{model}:generateContent
openapi: 3.0.1
info:
  title: AiToEarn Open Platform API
  description: >-
    AiToEarn Open Platform API. You can switch between the China and
    international sites for testing. Business success is determined by whether
    the response body has code === 0.
  version: 1.0.0
  contact: {}
servers:
  - url: https://aitoearn.cn
    description: China site
  - url: https://aitoearn.ai
    description: International site
security: []
tags:
  - name: AI Services
  - name: AI Services/Video Generation
  - name: AI Services/Image Generation
  - name: Channel Management
  - name: Channel Management/Accounts
  - name: Channel Management/Publishing
  - name: Channel Management/Platforms
  - name: Channel Management/Works
  - name: Channel Management/Account Groups
  - name: Channel Management/Authorization
  - name: Asset Management
  - name: AI Services/Large Language Models
paths:
  /api/ai/v1beta/models/{model}:generateContent:
    post:
      tags:
        - AI Services/Large Language Models
      summary: Gemini Chat
      description: >-
        Interface description: Compatible endpoint of Gemini `:generateContent`
        API (non-streaming, aggregation returns complete results). The request
        and response formats follow the Gemini specification; authentication
        uses the `x-goog-api-key` header (carried by Gemini SDK by default).
        Existing Gemini SDK can be accessed by simply replacing the baseURL and
        API Key, and billing is based on AiToEarn points.


        Before calling this interface, please request the ["Conversation Model
        List"](/en/api-reference/get-api-ai-models-chat) interface (`GET
        /api/ai/models/chat`) to obtain the currently available model list.
      operationId: RelayController_geminiGenerateContent
      parameters:
        - name: model
          in: path
          description: >-
            Model ID. First call the ["Conversation Model
            List"](/en/api-reference/get-api-ai-models-chat) interface (`GET
            /api/ai/models/chat`) and pass in the `data[n].name` returned by it.
          required: true
          example: ''
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: >-
                    Model ID, consistent with the path parameter `model`. The
                    value comes from `data[n].name` returned by the
                    ["Conversation Model
                    List"](/en/api-reference/get-api-ai-models-chat) interface.
                contents:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - model
                        description: >-
                          Message role, used to distinguish different message
                          sources
                      parts:
                        type: array
                        items:
                          anyOf:
                            - type: object
                              properties:
                                text:
                                  type: string
                                  description: text fragment
                              required:
                                - text
                            - type: object
                              properties:
                                inlineData:
                                  type: object
                                  properties:
                                    mimeType:
                                      type: string
                                      description: Embedded media type
                                    data:
                                      type: string
                                      description: media raw data
                                  required:
                                    - mimeType
                                    - data
                                  description: >-
                                    Embedded media byte data passed directly
                                    with the request
                              required:
                                - inlineData
                            - type: object
                              properties:
                                fileData:
                                  type: object
                                  properties:
                                    mimeType:
                                      type: string
                                      description: Media type of file source data
                                    fileUri:
                                      type: string
                                      description: File or media resource URI
                                  required:
                                    - fileUri
                                  description: File media data referenced by URI
                              required:
                                - fileData
                        description: >-
                          An ordered list of content fragments within a single
                          message
                    required:
                      - parts
                  description: Contents list
                config:
                  $ref: '#/components/schemas/ModelProxyConfigVo'
              required:
                - model
                - contents
            examples: {}
        required: true
      responses:
        '200':
          description: >-
            Native third-party protocol response or SSE data, not wrapped in the
            AiToEarn common response envelope.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                description: >-
                  Native third-party protocol response, not wrapped in the
                  AiToEarn common response envelope.
              examples:
                success:
                  summary: Native third-party success response
                  value:
                    id: RelayController_geminiGenerateContent_example
                    object: response
            text/event-stream:
              schema:
                type: string
                description: SSE streaming response.
      deprecated: false
      security:
        - apikey-header-x-goog-api-key: []
components:
  schemas:
    ModelProxyConfigVo:
      description: Generate configuration
      type: object
      properties:
        temperature:
          type: number
          description: >-
            Controls the randomness of the output. The higher the value, the
            more divergent it is. The lower the value, the more stable it is.
        topP:
          type: number
          description: >-
            Kernel sampling parameters, limiting the maximum cumulative
            probability of tokens considered during sampling.
        topK:
          type: number
          description: >-
            Top-K sampling parameters, limiting the number of highest
            probability tokens considered during sampling
        candidateCount:
          type: number
          description: The number of candidate answers to be returned
        maxOutputTokens:
          type: number
          description: Maximum number of output tokens for candidate answers
        responseLogprobs:
          type: boolean
          description: Whether to return token logarithmic probability information
        logprobs:
          type: number
          description: >-
            The number of high-probability candidate tokens returned in each
            decoding step, only takes effect when `responseLogprobs=true`
        presencePenalty:
          type: number
          description: >-
            There is a penalty that is used to reduce or increase the tendency
            of tokens to appear again.
        frequencyPenalty:
          type: number
          description: >-
            Frequency penalty, which suppresses or encourages repetition based
            on the number of occurrences of the token
        seed:
          type: number
          description: Decode random seeds to improve output reproducibility
        responseMimeType:
          type: string
          description: expected response type
        responseJsonSchema:
          description: >-
            JSON output structure constraints, usually used with
            `responseMimeType=application/json`
      additionalProperties: true
  securitySchemes:
    apikey-header-x-goog-api-key:
      type: apiKey
      in: header
      name: x-goog-api-key
      description: API Key header used by Gemini SDK-compatible endpoints.

````