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

# Gemini Format - Generate Content

> - Universal generateContent API reference for all Gemini-native-format compatible models
- Minimized parameters for quick start
- Text conversation: single-turn or multi-turn contextual dialogue
- Multimodal input: supports mixed text + image/audio/video input
- Generation config: control temperature, topP, topK, maxOutputTokens via generationConfig




## OpenAPI

````yaml openapi/en/gemini-format-generate-content.json POST /v1beta/models/{model}:generateContent
openapi: 3.1.0
info:
  title: Gemini Format - Generate Content
  version: '1.0'
servers:
  - url: https://api.aihubmax.com
security:
  - BearerAuth: []
paths:
  /v1beta/models/{model}:generateContent:
    post:
      tags:
        - Text Series > Gemini Format
      summary: Gemini Format - Generate Content
      description: >
        - Universal generateContent API reference for all Gemini-native-format
        compatible models

        - Minimized parameters for quick start

        - Text conversation: single-turn or multi-turn contextual dialogue

        - Multimodal input: supports mixed text + image/audio/video input

        - Generation config: control temperature, topP, topK, maxOutputTokens
        via generationConfig
      operationId: gemini-format-generate-content
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
            example: gemini-2.5-flash
          description: Model name, e.g. gemini-2.5-flash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateContentRequest'
            examples:
              single-turn:
                summary: Single-turn conversation
                description: Basic single-turn Q&A
                value:
                  contents:
                    - role: user
                      parts:
                        - text: >-
                            Explain the core principles of the Transformer
                            architecture
              multi-turn:
                summary: Multi-turn conversation
                description: With system instruction and multi-turn context
                value:
                  contents:
                    - role: user
                      parts:
                        - text: I want to learn Kubernetes. Where should I start?
                    - role: model
                      parts:
                        - text: >-
                            Recommended learning path for Kubernetes:

                            1. First master Docker container basics

                            2. Learn K8s core concepts (Pod, Service,
                            Deployment)

                            3. Set up a local cluster (minikube/kind)


                            Do you have any Docker experience?
                    - role: user
                      parts:
                        - text: >-
                            I have basic Docker experience, used docker-compose
                            before
                  systemInstruction:
                    parts:
                      - text: >-
                          You are a DevOps technical mentor, skilled at creating
                          step-by-step learning plans
              with-image:
                summary: With image
                description: Send an image for model analysis (multimodal input)
                value:
                  contents:
                    - role: user
                      parts:
                        - text: Describe the content of this image
                        - inlineData:
                            mimeType: image/jpeg
                            data: BASE64_ENCODED_IMAGE_DATA
              with-generation-config:
                summary: Custom generation config
                description: Control generation parameters via generationConfig
                value:
                  contents:
                    - role: user
                      parts:
                        - text: >-
                            Output the names and characteristics of three
                            programming languages in JSON format
                  generationConfig:
                    temperature: 0.2
                    maxOutputTokens: 1024
                    responseMimeType: application/json
              with-youtube-video:
                summary: With YouTube video
                description: >-
                  Use a YouTube link as video input (video must be public).
                  `mimeType` can be omitted.
                value:
                  contents:
                    - role: user
                      parts:
                        - text: Summarize the main content of this video
                        - fileData:
                            fileUri: https://www.youtube.com/watch?v=9hE5-98ZeCg
              with-image-url:
                summary: With image URL
                description: >-
                  Reference an image via public HTTPS URL (avoids base64
                  encoding overhead)
                value:
                  contents:
                    - role: user
                      parts:
                        - text: Describe this image
                        - fileData:
                            fileUri: https://example.com/photo.jpg
                            mimeType: image/jpeg
              with-pdf-url:
                summary: With PDF URL
                description: Reference a PDF file via public HTTPS URL
                value:
                  contents:
                    - role: user
                      parts:
                        - text: Summarize this document
                        - fileData:
                            fileUri: https://example.com/report.pdf
                            mimeType: application/pdf
      responses:
        '200':
          $ref: '#/components/responses/GenerateContentSuccess'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    GenerateContentRequest:
      type: object
      required:
        - contents
      properties:
        contents:
          type: array
          description: List of conversation contents
          items:
            type: object
            required:
              - role
              - parts
            properties:
              role:
                type: string
                description: Role of the message sender
                enum:
                  - user
                  - model
              parts:
                type: array
                description: List of content parts
                items:
                  type: object
                  properties:
                    text:
                      type: string
                      description: Text content
                    inlineData:
                      type: object
                      description: >-
                        Inline binary data (base64 encoded). Applicable for:
                        images, audio, PDF, video (base64). Video file size <=
                        100MB.
                      required:
                        - mimeType
                        - data
                      properties:
                        mimeType:
                          type: string
                          description: >-
                            IANA standard MIME type (Gemini natively supported
                            list):

                            - **Images**: image/png, image/jpeg, image/webp,
                            image/heic, image/heif

                            - **Audio**: audio/wav, audio/mp3, audio/aiff,
                            audio/aac, audio/ogg, audio/flac

                            - **Video**: video/mp4, video/mpeg, video/quicktime,
                            video/avi, video/x-flv, video/mpg, video/webm,
                            video/wmv, video/3gpp

                            - **Documents**: application/pdf (supports visual
                            understanding: charts/layouts/images), text/plain,
                            text/markdown, text/html, text/xml (extracted as
                            plain text only)


                            > Available MIME types depend on the selected
                            model/channel capabilities; some channels do not
                            support video base64.
                          examples:
                            - image/png
                            - image/jpeg
                            - image/webp
                            - image/heic
                            - image/heif
                            - audio/wav
                            - audio/mp3
                            - audio/aiff
                            - audio/aac
                            - audio/ogg
                            - audio/flac
                            - video/mp4
                            - video/mpeg
                            - video/quicktime
                            - video/avi
                            - video/x-flv
                            - video/mpg
                            - video/webm
                            - video/wmv
                            - video/3gpp
                            - application/pdf
                            - text/plain
                            - text/markdown
                            - text/html
                            - text/xml
                        data:
                          type: string
                          description: Base64-encoded binary data
                    fileData:
                      type: object
                      description: >-
                        URL reference. Applicable for: YouTube videos, public
                        HTTPS URLs (images / PDF / video). `mimeType` can be
                        omitted for YouTube.
                      required:
                        - fileUri
                      properties:
                        fileUri:
                          type: string
                          description: 'Resource URI: YouTube URL or public HTTPS URL'
                          examples:
                            - https://www.youtube.com/watch?v=9hE5-98ZeCg
                            - https://example.com/photo.jpg
                            - https://example.com/report.pdf
                        mimeType:
                          type: string
                          description: >-
                            IANA standard MIME type (same list as inlineData):

                            - **Images**: image/png, image/jpeg, image/webp,
                            image/heic, image/heif

                            - **Audio**: audio/wav, audio/mp3, audio/aiff,
                            audio/aac, audio/ogg, audio/flac

                            - **Video**: video/mp4, video/mpeg, video/quicktime,
                            video/avi, video/x-flv, video/mpg, video/webm,
                            video/wmv, video/3gpp

                            - **Documents**: application/pdf (supports visual
                            understanding: charts/layouts/images), text/plain,
                            text/markdown, text/html, text/xml (extracted as
                            plain text only)


                            > `mimeType` can be omitted for YouTube links;
                            explicitly declaring it is recommended for other
                            public HTTPS URLs.
                          examples:
                            - image/png
                            - image/jpeg
                            - image/webp
                            - image/heic
                            - image/heif
                            - audio/wav
                            - audio/mp3
                            - audio/aiff
                            - audio/aac
                            - audio/ogg
                            - audio/flac
                            - video/mp4
                            - video/mpeg
                            - video/quicktime
                            - video/avi
                            - video/x-flv
                            - video/mpg
                            - video/webm
                            - video/wmv
                            - video/3gpp
                            - application/pdf
                            - text/plain
                            - text/markdown
                            - text/html
                            - text/xml
                  description: >-
                    Content part, choose one of: text / inlineData / fileData.


                    **Multimodal input support**:

                    - Text: `text`

                    - Image / Audio / PDF (base64 inline): `inlineData{mimeType,
                    data}`

                    - Image / PDF (public HTTPS URL): `fileData{fileUri,
                    mimeType}`

                    - Video: see "Video input" below


                    **Video input (depending on model/channel capabilities)
                    supports 3 forms**:

                    1. **YouTube link**:
                    `fileData{fileUri:"https://www.youtube.com/watch?v=..."}`,
                    `mimeType` can be omitted; video must be **public** (private
                    / unlisted not supported)

                    2. **Public HTTPS URL**: `fileData{fileUri:"https://...",
                    mimeType:"video/mp4"}`; video file size <= **100MB**
                    (calculated by post-download base64 encoded size)

                    3. **Inline base64**: `inlineData{mimeType:"video/mp4",
                    data:"<base64>"}`, size <= **100MB**


                    > Different models / channels support different video forms;
                    some channels currently only support YouTube links. For
                    videos exceeding 100MB, please contact the administrator for
                    a dedicated upload endpoint.
        systemInstruction:
          type: object
          description: System instruction
          properties:
            parts:
              type: array
              description: System instruction content parts
              items:
                type: object
                properties:
                  text:
                    type: string
                    description: System instruction text
        generationConfig:
          type: object
          description: Generation configuration
          properties:
            temperature:
              type: number
              description: Sampling temperature
              minimum: 0
              maximum: 2
            topP:
              type: number
              description: Nucleus sampling parameter
              minimum: 0
              maximum: 1
            topK:
              type: integer
              description: Top-K sampling parameter
            maxOutputTokens:
              type: integer
              description: Maximum number of output tokens
            responseMimeType:
              type: string
              description: Response MIME type, e.g. text/plain or application/json
            responseSchema:
              type: object
              description: >-
                Response JSON Schema (used when responseMimeType is
                application/json)
        tools:
          type: array
          description: List of available tools
          items:
            type: object
            properties:
              functionDeclarations:
                type: array
                description: List of function declarations
                items:
                  type: object
                  properties:
                    name:
                      type: string
                      description: Function name
                    description:
                      type: string
                      description: Function description
                    parameters:
                      type: object
                      description: JSON Schema for function parameters
        safetySettings:
          type: array
          description: Safety settings
          items:
            type: object
            properties:
              category:
                type: string
                description: Safety category
                enum:
                  - HARM_CATEGORY_HARASSMENT
                  - HARM_CATEGORY_HATE_SPEECH
                  - HARM_CATEGORY_SEXUALLY_EXPLICIT
                  - HARM_CATEGORY_DANGEROUS_CONTENT
              threshold:
                type: string
                description: Safety threshold
                enum:
                  - BLOCK_NONE
                  - BLOCK_LOW_AND_ABOVE
                  - BLOCK_MEDIUM_AND_ABOVE
                  - BLOCK_ONLY_HIGH
    GenerateContentResponse:
      type: object
      properties:
        candidates:
          type: array
          description: List of candidate results
          items:
            type: object
            properties:
              content:
                type: object
                description: Generated content
                properties:
                  parts:
                    type: array
                    items:
                      type: object
                      properties:
                        text:
                          type: string
                          description: Generated text content
                          example: Hello! How can I help you today?
                  role:
                    type: string
                    description: Role
                    enum:
                      - model
              finishReason:
                type: string
                description: Reason for stopping generation
                enum:
                  - STOP
                  - MAX_TOKENS
                  - SAFETY
                  - RECITATION
                  - OTHER
                example: STOP
              safetyRatings:
                type: array
                description: List of safety ratings
                items:
                  type: object
                  properties:
                    category:
                      type: string
                      description: Safety category
                    probability:
                      type: string
                      description: Probability level
        usageMetadata:
          type: object
          description: Usage statistics
          properties:
            promptTokenCount:
              type: integer
              description: Prompt token count
              example: 25
            candidatesTokenCount:
              type: integer
              description: Candidates token count
              example: 150
            totalTokenCount:
              type: integer
              description: Total token count
              example: 175
    ErrorResponse400:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid request parameters
            type:
              type: string
              example: invalid_request_error
    ErrorResponse401:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid API Key
            type:
              type: string
              example: authentication_error
    ErrorResponse403:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Access denied
            type:
              type: string
              example: permission_error
    ErrorResponse429:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Rate limit exceeded
            type:
              type: string
              example: rate_limit_error
    ErrorResponse500:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Internal server error
            type:
              type: string
              example: server_error
  responses:
    GenerateContentSuccess:
      description: Content generation response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenerateContentResponse'
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse400'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse401'
    PaymentRequired:
      description: Insufficient balance
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse400'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse403'
    TooManyRequests:
      description: Too many requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse429'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse500'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        ## All endpoints require Bearer Token authentication ##

        Add the following to your request header:

        `Authorization: Bearer YOUR_API_KEY`

````