跳轉到主要內容

Documentation Index

Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt

Use this file to discover all available pages before exploring further.

OpenClaw 支援內建 Google Search grounding 的 Gemini 模型,會傳回由即時 Google Search 結果支援、並附有引用的 AI 合成答案。

取得 API 金鑰

1

Create a key

前往 Google AI Studio 並建立 API 金鑰。
2

Store the key

在 Gateway 環境中設定 GEMINI_API_KEY,或透過下列方式設定:
openclaw configure --section web

設定

{
  plugins: {
    entries: {
      google: {
        config: {
          webSearch: {
            apiKey: "AIza...", // optional if GEMINI_API_KEY is set
            model: "gemini-2.5-flash", // default
          },
        },
      },
    },
  },
  tools: {
    web: {
      search: {
        provider: "gemini",
      },
    },
  },
}
**環境替代方式:**在 Gateway 環境中設定 GEMINI_API_KEY。 若是 Gateway 安裝,請將它放在 ~/.openclaw/.env

運作方式

與傳統搜尋提供者傳回連結和摘要片段清單不同,Gemini 會使用 Google Search grounding 產生附有行內引用的 AI 合成答案。結果包含合成答案和來源 URL。
  • 來自 Gemini grounding 的引用 URL 會自動從 Google 重新導向 URL 解析為直接 URL。
  • 重新導向解析會先使用 SSRF 防護路徑(HEAD + 重新導向檢查 + http/https 驗證),再傳回最終引用 URL。
  • 重新導向解析使用嚴格的 SSRF 預設值,因此會封鎖重新導向到 私人/內部目標。

支援的參數

Gemini 搜尋支援 query 為了與共用的 web_search 相容,會接受 count,但 Gemini grounding 仍會傳回一個附有引用的合成答案,而不是 N 筆結果清單。 不支援提供者專屬篩選器,例如 countrylanguagefreshnessdomain_filter

模型選擇

預設模型是 gemini-2.5-flash(快速且具成本效益)。任何支援 grounding 的 Gemini 模型都可以透過 plugins.entries.google.config.webSearch.model 使用。

相關