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

> ## Agent Instructions
> Public hosts only: console https://omnimux.ai/dashboard · API https://api.omnimux.ai · docs https://docs.omnimux.ai.
> Gateway auth is Authorization: Bearer sk-… on https://api.omnimux.ai/v1 (OpenAI-compatible Chat Completions and related paths).
> Discover pages from /llms.txt; full site dump /llms-full.txt; product skill /skill.md; docs search MCP /mcp. Prefer .md page URLs for Markdown.
> Default docs locale is en; zh mirrors the same relative paths. Do not invent model ids not present on live pricing or the complete API pages.

# Gemini · 原生多模态理解

> 通过原生内容接口提交文字和素材，返回文字或结构化结果。

* 模型放在请求路径中，正文使用 `contents`；无需另加正文 `model`。
* 系统指令使用 `systemInstruction`。素材是输入内容，不应覆盖系统指令。
* 同一条用户消息可包含文字、完整视频和多张参考图片，输出为文字或结构化结果。
* 流式调用见[原生流式理解](https://docs.omnimux.ai/zh/api-reference/text-series/gemini/native-stream.md)。

## 模型

| 模型标识 |
| - |
| `gemini-4-argon` |
| `gemini-4-hydrogen` |
| `gemini-4-neon` |
| `gemini-4-carbon` |

## 素材与结果

通过 `parts[].inlineData` 提交 PNG、MP4 或 PDF；`mimeType` 与实际文件一致，`data` 为不含数据网址前缀的完整文件编码。本页未列出的格式、素材容量和长素材限制，请在接入前确认，勿将请求示例当作服务上限。

通过 `generationConfig.thinkingConfig.thinkingLevel` 指定思考档位：`gemini-4-hydrogen` 与 `gemini-4-neon` 支持 `low`、`medium`、`high`、`xhigh`；`gemini-4-carbon` 支持 `low`、`medium`、`high`；`gemini-4-argon` 文档以 `low` 为例。`maxOutputTokens` 同时覆盖思考与可见输出，示例值不代表最大输出上限。

需要结构化结果时，使用 `generationConfig.responseMimeType: application/json` 与原生 `responseSchema`。这些结构化输出参数会按原生请求转发，但返回内容仍可能带有代码围栏，或出现不符合结构要求的字段类型，例如预期数组的字段返回为对象。调用方须校验实际返回内容和字段类型，再用于后续处理。

检查完整回复的 `finishReason`、返回内容及 `usageMetadata`。收到 `functionCall` 后，由调用方执行函数；本页不承诺多轮工具执行。

## 费用与用量

按已公布的账户价格和实际用量结算；自动切换服务线路不会改变该模型的已公布售价。普通输入包含上游已报告的工具输入，输出包含已报告的思考；已报告缓存属于输入子集，不再重复累加。流式累计快照也不按片段重复计费。缺失的用量字段不代表上游明确报告零。

余额不足应检查错误体：除 `402` 外，原生入口也可能返回 `403` 和 `insufficient_user_quota`；不要将全部 `403` 都归为权限问题。


## OpenAPI

````yaml openapi/ops/gemini/native.json POST /v1beta/models/{model}:generateContent
openapi: 3.1.0
info:
  title: Gemini · Native multimodal text
  version: 1.0.0
  description: >-
    Native Gemini content requests with system instructions, media input, text
    and structured output on OmniMux.
servers:
  - url: https://api.omnimux.ai
security:
  - BearerAuth: []
paths:
  /v1beta/models/{model}:generateContent:
    post:
      summary: Gemini native text generation
      description: >-
        Use native systemInstruction and contents.parts. Send text and media as
        separate parts of user content. Responses contain text, structured data
        or function-call requests.
      operationId: generateGeminiNativeText
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
            enum:
              - gemini-4-argon
              - gemini-4-hydrogen
              - gemini-4-neon
              - gemini-4-carbon
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NativeRequest'
      responses:
        '200':
          description: Native response; inspect finishReason and usageMetadata
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NativeResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientQuota'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '502':
          $ref: '#/components/responses/UpstreamError'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  schemas:
    NativeRequest:
      type: object
      required:
        - contents
      properties:
        systemInstruction:
          type: object
          required:
            - parts
          properties:
            parts:
              type: array
              items:
                $ref: '#/components/schemas/TextPart'
          description: >-
            Task framework and scope; media content is data, not a
            higher-priority instruction
        contents:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/NativeContent'
        generationConfig:
          type: object
          properties:
            thinkingConfig:
              type: object
              properties:
                thinkingLevel:
                  type: string
                  enum:
                    - low
                    - medium
                    - high
                    - xhigh
                  description: >-
                    Thinking effort level: hydrogen and neon support
                    low/medium/high/xhigh; carbon supports low/medium/high;
                    argon reference documents low.
            maxOutputTokens:
              type: integer
              minimum: 1
              example: 2048
              description: >-
                Combined thinking and visible-output budget. This example value
                is not a model maximum.
            responseMimeType:
              type: string
              enum:
                - application/json
            responseSchema:
              type: object
              description: >-
                Native Schema object for structured text, used with
                responseMimeType=application/json.
        tools:
          type: array
          items:
            type: object
            properties:
              functionDeclarations:
                type: array
                items:
                  type: object
                  required:
                    - name
                    - parameters
                  properties:
                    name:
                      type: string
                    description:
                      type: string
                    parameters:
                      type: object
          description: >-
            Function declarations for a single-turn function-call response. The
            returned functionCall asks the client to execute the function; it
            does not run the function.
        toolConfig:
          type: object
          properties:
            functionCallingConfig:
              type: object
              properties:
                mode:
                  type: string
                  enum:
                    - ANY
                allowedFunctionNames:
                  type: array
                  items:
                    type: string
      example:
        systemInstruction:
          parts:
            - text: Respond concisely.
        contents:
          - role: user
            parts:
              - text: Hello.
        generationConfig:
          maxOutputTokens: 2048
    NativeResponse:
      type: object
      properties:
        modelVersion:
          type: string
          description: >-
            Supplier-reported model version; not independent backend identity
            proof
        responseId:
          type: string
        candidates:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              finishReason:
                type: string
              content:
                type: object
                properties:
                  role:
                    type: string
                  parts:
                    type: array
                    items:
                      type: object
                      properties:
                        text:
                          type: string
                        thought:
                          type: boolean
                        functionCall:
                          type: object
                          properties:
                            name:
                              type: string
                            args:
                              type: object
        usageMetadata:
          $ref: '#/components/schemas/UsageMetadata'
    TextPart:
      type: object
      required:
        - text
      properties:
        text:
          type: string
    NativeContent:
      type: object
      required:
        - parts
      properties:
        role:
          type: string
          enum:
            - user
        parts:
          type: array
          minItems: 1
          items:
            oneOf:
              - $ref: '#/components/schemas/TextPart'
              - $ref: '#/components/schemas/InlinePart'
    UsageMetadata:
      type: object
      properties:
        promptTokenCount:
          type: integer
          minimum: 0
        toolUsePromptTokenCount:
          type: integer
          minimum: 0
          description: Additional reported tool-use input, counted in total input once
        candidatesTokenCount:
          type: integer
          minimum: 0
        thoughtsTokenCount:
          type: integer
          minimum: 0
          description: Reported thinking, counted in output once
        cachedContentTokenCount:
          type: integer
          minimum: 0
          description: Cached input subset, not additional input
        totalTokenCount:
          type: integer
          minimum: 0
        promptTokensDetails:
          type: array
          items:
            $ref: '#/components/schemas/ModalityUsage'
        toolUsePromptTokensDetails:
          type: array
          items:
            $ref: '#/components/schemas/ModalityUsage'
      description: >-
        Optional fields remain absent when not supplied; absent is not an
        explicit zero. Do not add modality breakdowns again or treat cumulative
        stream snapshots as separate charges.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              oneOf:
                - type: string
                - type: integer
    InlinePart:
      type: object
      required:
        - inlineData
      properties:
        inlineData:
          type: object
          required:
            - mimeType
            - data
          properties:
            mimeType:
              type: string
              enum:
                - image/png
                - video/mp4
                - application/pdf
            data:
              type: string
              contentEncoding: base64
              description: >-
                Complete original media bytes encoded as base64, without a
                data-URL prefix
    ModalityUsage:
      type: object
      properties:
        modality:
          type: string
        tokenCount:
          type: integer
          minimum: 0
  responses:
    BadRequest:
      description: Invalid or unsupported request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid OmniMux API token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InsufficientQuota:
      description: Insufficient available quota
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >-
        Request/model access is not allowed; this native surface may also return
        insufficient_user_quota as HTTP 403. Inspect the error code and message
        rather than assuming a permission problem.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Requested resource or model is unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit reached
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Gateway error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UpstreamError:
      description: Upstream error or incomplete upstream result
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: No available accepted route
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: OmniMux API token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.