Skip to content

Gemini 搜尋

OpenClaw 支援具有內建 Google 搜尋接採 的 Gemini 模型, 該功能會傳回即時 Google 搜尋結果作為參考依據的 AI 綜合回答 並附上引用來源。

  1. 建立金鑰

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

  2. 儲存金鑰

    在 Gateway 環境中設定 GEMINI_API_KEY,或透過以下方式進行設定:

    Terminal window
    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 搜尋接採來產生包含內嵌引用的 AI 綜合回答。結果同時包含綜合回答和來源 URL。

  • 來自 Gemini 接採的引用 URL 會自動從 Google 重新導向 URL 解析為直接 URL。
  • 在傳回最終引用 URL 之前,重新導向解析會使用 SSRF 防護路徑(HEAD + 重新導向檢查 + http/https 驗證)。
  • 重新導向解析使用嚴格的 SSRF 預設值,因此對 私有/內部目標的重新導向會被封鎖。

Gemini 搜尋支援標準的 querycount 參數。 不支援供應商特定的過濾器,例如 countrylanguagefreshnessdomain_filter

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