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

# Gemini 2.5 Flash

> 通过 Gemini API 调用 Google Gemini 2.5 Flash，支持 Google 搜索增强。

Gemini 2.5 Flash 是 Google 的快速高效模型，集成 Google 搜索功能，通过 Anyfast 以原生 Gemini API 提供服务。可以使用实时搜索结果增强回复。

## 核心能力

* **Google 搜索增强** — 使用实时网络搜索增强回复
* **文档处理** — 处理和分析文档
* **多模态输入** — 接受文本和文件输入
* **快速推理** — 针对速度和效率优化

## 快速示例

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://www.anyfast.ai/v1beta/models/gemini-2.5-flash:generateContent?key=YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "contents": [
        {
          "role": "user",
          "parts": [{ "text": "今天有什么AI相关的最新新闻？" }]
        }
      ],
      "tools": [{ "googleSearch": {} }]
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://www.anyfast.ai/v1beta/models/gemini-2.5-flash:generateContent"
  params = {"key": "YOUR_API_KEY"}
  data = {
      "contents": [
          {
              "role": "user",
              "parts": [{"text": "今天有什么AI相关的最新新闻？"}]
          }
      ],
      "tools": [{"googleSearch": {}}]
  }

  response = requests.post(url, params=params, json=data)
  result = response.json()
  print(result["candidates"][0]["content"]["parts"][0]["text"])
  ```
</CodeGroup>

## 参数说明

| 参数         | 类型     | 必填 | 说明                                |
| ---------- | ------ | -- | --------------------------------- |
| `key`      | string | 是  | API 密钥（查询参数）                      |
| `contents` | array  | 是  | `{ role, parts }` 对象数组            |
| `tools`    | array  | 否  | 包含 `{ "googleSearch": {} }` 以启用搜索 |

<Card title="API 参考" icon="code" href="/zh/api-reference/model-api/google/gemini-2-5-flash">
  查看 Gemini 2.5 Flash 的交互式 API Playground。
</Card>

<script src="/feedback.js" />
