> ## 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 万上下文模型。

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

**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
  }
}'
```

**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())
```

### OpenAI 兼容 API

**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
}'
```

**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)
```

**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="")
```

## 参数

### 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.