mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:20:44 +00:00
fix(gemini): reuse google provider config for web search
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
summary: "Gemini web search with Google Search grounding"
|
||||
read_when:
|
||||
- You want to use Gemini for web_search
|
||||
- You need a GEMINI_API_KEY
|
||||
- You need a GEMINI_API_KEY or models.providers.google.apiKey
|
||||
- You want Google Search grounding
|
||||
title: "Gemini search"
|
||||
---
|
||||
@@ -20,7 +20,8 @@ citations.
|
||||
API key.
|
||||
</Step>
|
||||
<Step title="Store the key">
|
||||
Set `GEMINI_API_KEY` in the Gateway environment, or configure via:
|
||||
Set `GEMINI_API_KEY` in the Gateway environment, reuse
|
||||
`models.providers.google.apiKey`, or configure a dedicated web-search key via:
|
||||
|
||||
```bash
|
||||
openclaw configure --section web
|
||||
@@ -38,8 +39,8 @@ citations.
|
||||
google: {
|
||||
config: {
|
||||
webSearch: {
|
||||
apiKey: "AIza...", // optional if GEMINI_API_KEY is set
|
||||
baseUrl: "https://generativelanguage.googleapis.com/v1beta", // optional proxy/base URL override
|
||||
apiKey: "AIza...", // optional if GEMINI_API_KEY or models.providers.google.apiKey is set
|
||||
baseUrl: "https://generativelanguage.googleapis.com/v1beta", // optional; falls back to models.providers.google.baseUrl
|
||||
model: "gemini-2.5-flash", // default
|
||||
},
|
||||
},
|
||||
@@ -56,8 +57,13 @@ citations.
|
||||
}
|
||||
```
|
||||
|
||||
**Environment alternative:** set `GEMINI_API_KEY` in the Gateway environment.
|
||||
For a gateway install, put it in `~/.openclaw/.env`.
|
||||
**Credential precedence:** Gemini web search uses
|
||||
`plugins.entries.google.config.webSearch.apiKey` first, then `GEMINI_API_KEY`,
|
||||
then `models.providers.google.apiKey`. For base URLs, the dedicated
|
||||
`plugins.entries.google.config.webSearch.baseUrl` wins before
|
||||
`models.providers.google.baseUrl`.
|
||||
|
||||
For a gateway install, put env keys in `~/.openclaw/.env`.
|
||||
|
||||
## How it works
|
||||
|
||||
@@ -95,8 +101,9 @@ model that supports grounding can be used via
|
||||
## Base URL overrides
|
||||
|
||||
Set `plugins.entries.google.config.webSearch.baseUrl` when Gemini web search
|
||||
must route through an operator proxy or custom Gemini-compatible endpoint. A
|
||||
plain `https://generativelanguage.googleapis.com` value is normalized to
|
||||
must route through an operator proxy or custom Gemini-compatible endpoint. If
|
||||
that is unset, Gemini web search reuses `models.providers.google.baseUrl`. A plain
|
||||
`https://generativelanguage.googleapis.com` value is normalized to
|
||||
`https://generativelanguage.googleapis.com/v1beta`; custom proxy paths are kept
|
||||
as provided after trimming trailing slashes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user