mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:10:43 +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.
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ API-backed providers first:
|
||||
|
||||
1. **Brave** -- `BRAVE_API_KEY` or `plugins.entries.brave.config.webSearch.apiKey` (order 10)
|
||||
2. **MiniMax Search** -- `MINIMAX_CODE_PLAN_KEY` / `MINIMAX_CODING_API_KEY` or `plugins.entries.minimax.config.webSearch.apiKey` (order 15)
|
||||
3. **Gemini** -- `GEMINI_API_KEY` or `plugins.entries.google.config.webSearch.apiKey` (order 20)
|
||||
3. **Gemini** -- `plugins.entries.google.config.webSearch.apiKey`, `GEMINI_API_KEY`, or `models.providers.google.apiKey` (order 20)
|
||||
4. **Grok** -- `XAI_API_KEY` or `plugins.entries.xai.config.webSearch.apiKey` (order 30)
|
||||
5. **Kimi** -- `KIMI_API_KEY` / `MOONSHOT_API_KEY` or `plugins.entries.moonshot.config.webSearch.apiKey` (order 40)
|
||||
6. **Perplexity** -- `PERPLEXITY_API_KEY` / `OPENROUTER_API_KEY` or `plugins.entries.perplexity.config.webSearch.apiKey` (order 50)
|
||||
@@ -213,8 +213,10 @@ error prompting you to configure one).
|
||||
```
|
||||
|
||||
Provider-specific config (API keys, base URLs, modes) lives under
|
||||
`plugins.entries.<plugin>.config.webSearch.*`. See the provider pages for
|
||||
examples.
|
||||
`plugins.entries.<plugin>.config.webSearch.*`. Gemini can also reuse
|
||||
`models.providers.google.apiKey` and `models.providers.google.baseUrl` as lower-priority
|
||||
fallbacks after its dedicated web-search config and `GEMINI_API_KEY`. See the
|
||||
provider pages for examples.
|
||||
|
||||
`web_fetch` fallback provider selection is separate:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user