You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d3f4530
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/tools/gemini-search.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ read_when:
4
4
- You want to use Gemini for web_search
5
5
- You need a GEMINI_API_KEY or models.providers.google.apiKey
6
6
- You want Google Search grounding
7
+
- Your Gemini gateway requires request headers
7
8
title: "Gemini search"
8
9
---
9
10
@@ -41,6 +42,14 @@ citations.
41
42
webSearch: {
42
43
apiKey:"AIza...", // optional if GEMINI_API_KEY or models.providers.google.apiKey is set
43
44
baseUrl:"https://generativelanguage.googleapis.com/v1beta", // optional; falls back to models.providers.google.baseUrl
45
+
headers: {
46
+
"X-Routing-Target":"staging",
47
+
"X-Gateway-Token": {
48
+
source:"env",
49
+
provider:"default",
50
+
id:"GEMINI_GATEWAY_TOKEN",
51
+
},
52
+
},
44
53
model:"gemini-2.5-flash", // default
45
54
},
46
55
},
@@ -65,6 +74,30 @@ then `models.providers.google.apiKey`. For base URLs, the dedicated
65
74
66
75
For a gateway install, put env keys in `~/.openclaw/.env`.
67
76
77
+
### Request headers
78
+
79
+
Set `plugins.entries.google.config.webSearch.headers` when an operator gateway
80
+
needs extra request metadata. Plain string values use normal config handling;
81
+
they are not automatically treated as secret merely because they are headers.
82
+
When a header contains a secret, use a [SecretRef](/gateway/secrets) value as
83
+
shown above. OpenClaw resolves that value at runtime and applies the existing
84
+
secret redaction path to it.
85
+
86
+
The Gemini request keeps ownership of `Content-Type`, `x-goog-api-key`, and
87
+
`x-goog-api-client`; those values override same-named configured headers.
88
+
`models.providers.google.headers` are not inherited because they belong to the
89
+
model provider endpoint, which can differ from the web-search endpoint.
90
+
91
+
Empty plain-string values are valid. Invalid fields and transport-owned or
92
+
framing names such as `Content-Length`, `Host`, and `Transfer-Encoding` fail the
93
+
current search before cache lookup or network I/O.
94
+
95
+
Effective header names and values partition the in-memory search cache through a
96
+
digest, so two routing targets do not share results. Configured values for the
97
+
provider-owned names above are ignored and do not partition the cache. On a
98
+
cross-origin redirect, the guarded fetch path retains only its standard safe
99
+
redirect headers.
100
+
68
101
## How it works
69
102
70
103
Unlike traditional search providers that return a list of links and snippets,
0 commit comments