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

# Generate Content

> Native Gemini protocol entry point. Mirrors the request and response
shapes of `https://generativelanguage.googleapis.com` — clients may
point the google-genai SDK at this gateway directly.




## OpenAPI

````yaml /openapi.json post /gemini/v1beta/models/{model}:generateContent
openapi: 3.1.0
info:
  title: AIHubMix Gateway API
  description: |
    Unified multi-protocol gateway. Exposes three native shapes side-by-side:
      - OpenAI (`/v1/chat/completions`, `/v1/responses`, ...)
      - Anthropic (`/v1/messages`)
      - Gemini (`/v1beta/models/{model}:generateContent`)
    Each vendor's native SDK connects directly. Gateway-only fields are
    marked with `x-source.authority: gateway`.
  contact:
    name: AIHubMix Team
  version: 2.1.1
  x-upstream:
    vendorSpecs:
      packageVersion: 0.1.1
      installedFrom: npm
    sources:
      openai/official:
        version: '2026-05-31'
        hash: >-
          sha256:a203971a0bc0cd3b903b9488e3ac40eaa161a274dfaf172c1da73eee029147a8
      anthropic/official:
        version: '2026-05-31'
        hash: >-
          sha256:f9d488f9290d78a081bed62fa0c040476b5d009f3db92c06c8e279e69df73fc9
    layers:
      - role: L0-base
        source: avs://openai/official
        protocol: openai
        authority: official
      - role: L0-base
        source: avs://anthropic/official
        protocol: anthropic
        authority: official
      - role: gateway-other
        source: gateway/anthropic-mappings.yml
        protocol: all
        authority: gateway
      - role: horizontal-auth
        source: gateway/auth.yml
        protocol: all
        authority: gateway
      - role: horizontal-errors
        source: gateway/errors.yml
        protocol: all
        authority: gateway
      - role: L3-gateway
        source: gateway/openai-gateway.yml
        protocol: openai
        authority: gateway
      - role: gateway-other
        source: gateway/openai-image-mappings.yml
        protocol: all
        authority: gateway
      - role: gateway-other
        source: gateway/openai-mappings.yml
        protocol: all
        authority: gateway
      - role: L2-passthrough
        source: gateway/openai-passthrough.yml
        protocol: openai
        authority: gateway
servers:
  - url: https://aihubmix.com
    description: Production
  - url: https://api.inferera.com
    description: Backup (use when the primary domain is unreachable)
security:
  - gatewayBearer: []
tags:
  - name: OpenAI Compatible
    description: >-
      OpenAI-compatible endpoints (chat, completions, embeddings, images, audio,
      videos, moderations).
  - name: Anthropic Compatible
    description: Anthropic-native endpoints (messages with Anthropic protocol).
  - name: Google Vertex AI Compatible
    description: Google Gemini / Vertex AI endpoints.
paths:
  /gemini/v1beta/models/{model}:generateContent:
    parameters:
      - name: model
        in: path
        required: true
        schema:
          type: string
        description: Gemini model name, e.g. `gemini-2.5-pro`.
    post:
      tags:
        - Google Vertex AI Compatible
      summary: Generate Content
      description: |
        Native Gemini protocol entry point. Mirrors the request and response
        shapes of `https://generativelanguage.googleapis.com` — clients may
        point the google-genai SDK at this gateway directly.
      operationId: geminiGenerateContent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GeminiGenerateContentRequest'
      responses:
        '200':
          description: ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeminiGenerateContentResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        5XX:
          description: Server / upstream error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
      security:
        - gatewayGeminiKey: []
        - gatewayGeminiQuery: []
components:
  schemas:
    GeminiGenerateContentRequest:
      type: object
      description: |
        Native Gemini `generateContent` request body. Field definitions here
        are illustrative — refer to
        https://ai.google.dev/api/rest/v1beta/models/generateContent as the
        authoritative reference.
      x-source:
        from: gemini/official
        authority: manual
      additionalProperties: true
      properties:
        contents:
          type: array
          items:
            type: object
            additionalProperties: true
        generationConfig:
          type: object
          additionalProperties: true
        safetySettings:
          type: array
          items:
            type: object
            additionalProperties: true
        systemInstruction:
          type: object
          additionalProperties: true
        tools:
          type: array
          items:
            type: object
            additionalProperties: true
    GeminiGenerateContentResponse:
      type: object
      description: |
        Native Gemini response body. Refer to Google's official documentation
        for the authoritative field reference.
      x-source:
        from: gemini/official
        authority: manual
      additionalProperties: true
    GatewayError:
      type: object
      description: |
        OpenAI-compatible error envelope. Top-level `error` object carrying
        `message` / `type` / `param` / `code`. `request_id` lives in the
        `X-Request-Id` response header, not in the body. The legacy `upstream`
        field is no longer emitted.
      x-source:
        from: gateway
        authority: gateway
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            message:
              type: string
              description: Human-readable error message.
            type:
              type: string
              nullable: true
              description: >
                Error category. OpenAI-compatible values include

                invalid_request_error / authentication_error / permission_error
                /

                not_found_error / rate_limit_error, etc. The upstream value is

                passed through verbatim; the enum is not fixed.
            param:
              type: string
              nullable: true
              description: Name of the offending field, when applicable.
            code:
              nullable: true
              description: |
                Sub-error code. May be a string or integer (the gateway treats
                `code` as an arbitrary type).
  securitySchemes:
    gatewayBearer:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Gateway-issued API key, formatted as `sk-gateway-xxxxxxxx`.
        Used by OpenAI-shaped endpoints (/v1/chat/completions, etc.).
      x-source:
        from: gateway
        authority: gateway
    gatewayGeminiKey:
      type: apiKey
      in: header
      name: x-goog-api-key
      description: |
        Used by Gemini-shaped endpoints (/v1beta/...). The value is the
        gateway API key, shared with other endpoint shapes. The google-genai
        SDK uses this header by default.
      x-source:
        from: gateway
        authority: gateway
    gatewayGeminiQuery:
      type: apiKey
      in: query
      name: key
      description: |
        Query-parameter fallback for Gemini-shaped endpoints. Some SDKs
        and tools only support the `?key=` form. Value is the same as
        `gatewayGeminiKey`.
      x-source:
        from: gateway
        authority: gateway

````