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

# Gemini 3.8 Flash

> Gemini 3.8 Flash：面向長程軟體工程、自主代理和企業工作流程的穩定版 100 萬上下文模型。

<link rel="alternate" hrefLang="en" href="https://mixroute.ai/docs/model-api/google/gemini-3.8-flash" />

<link rel="alternate" hrefLang="zh-Hans" href="https://mixroute.ai/docs/zh-hans/model-api/google/gemini-3.8-flash" />

<link rel="alternate" hrefLang="zh-Hant" href="https://mixroute.ai/docs/zh-hant/model-api/google/gemini-3.8-flash" />

<link rel="alternate" hrefLang="ja" href="https://mixroute.ai/docs/ja/model-api/google/gemini-3.8-flash" />

<link rel="alternate" hrefLang="x-default" href="https://mixroute.ai/docs/model-api/google/gemini-3.8-flash" />

Gemini 3.8 Flash 是 Google 當前智慧水平最高的 Flash 模型，面向長程軟體工程、自主代理與複雜企業工作流程。

可透過 MixRoute 的 Gemini 原生端點呼叫 `gemini-3.8-flash`，同時支援 OpenAI 相容端點。

## 核心能力

* 原生多模態 - 支援文字、圖像、影片、音訊和 PDF 輸入，輸出文字
* 長上下文 - 最大輸入 1,048,576 token，最大輸出 65,536 token
* 可調推理 - 支援 low、medium 和 high 三檔思考強度
* 代理工具 - 支援函式呼叫、結構化輸出、程式碼執行、搜尋增強和預覽版電腦操作
* 雙介面支援 - 可透過 Gemini 原生 generateContent 和 OpenAI 相容 Chat Completions 呼叫

## 快速範例

### Gemini 原生 API

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/models/gemini-3.8-flash:generateContent" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "contents": [
        {
          "role": "user",
          "parts": [
            {
              "text": "Explain quantum entanglement in simple terms."
            }
          ]
        }
      ],
      "generationConfig": {
        "maxOutputTokens": 256
      }
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    response = requests.post(
        "https://api.mixroute.ai/v1/models/gemini-3.8-flash:generateContent",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
        json={'contents': [{'role': 'user',
                            'parts': [{'text': 'Explain quantum entanglement in simple terms.'}]}],
              'generationConfig': {'maxOutputTokens': 256}},
    )

    print(response.json())
    ```
  </Tab>
</Tabs>

### OpenAI 相容 API

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/chat/completions" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "gemini-3.8-flash",
      "messages": [
        {
          "role": "user",
          "content": "Explain quantum entanglement in simple terms."
        }
      ],
      "max_tokens": 256
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    response = client.chat.completions.create(
        model="gemini-3.8-flash",
        messages=[{"role": "user", "content": "Explain quantum entanglement in simple terms."}],
        max_tokens=256,
    )

    print(response.choices[0].message.content)
    ```
  </Tab>

  <Tab title="Streaming">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    stream = client.chat.completions.create(
        model="gemini-3.8-flash",
        messages=[{"role": "user", "content": "Write a short poem about the sea."}],
        max_tokens=256,
        stream=True,
    )

    for chunk in stream:
        print(chunk.choices[0].delta.content or "", end="")
    ```
  </Tab>
</Tabs>

## 參數

### Gemini 原生 API

| 參數 | 類型 | 必填 | 說明 |
| - | - | - | - |
| `contents` | array | 是 | 由 role 與 parts 組成的對話內容。 |
| `systemInstruction` | object | 否 | 包含內容片段的系統指令。 |
| `generationConfig` | object | 否 | 模型支援的輸出與回應生成參數。 |
| `safetySettings` | array | 否 | 內容安全設定。 |

### OpenAI 相容 API

| 參數 | 類型 | 必填 | 說明 |
| - | - | - | - |
| `model` | string | 是 | 固定為 `gemini-3.8-flash`。 |
| `messages` | array | 是 | 包含 role 與 content 的對話訊息。 |
| `max_tokens` | integer | 否 | 最大生成 token 數。 |
| `stream` | boolean | 否 | 啟用 SSE 串流輸出，預設 false。 |
| `stop` | string \| array | 否 | 觸發停止生成的序列。 |
| `tools` | array | 否 | OpenAI 相容工具定義。 |

## 廠商參考

* [Gemini 3.8 Flash 官方文件](https://ai.google.dev/gemini-api/docs/models/gemini-3.8-flash)


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