Skip to content

Commit b73c218

Browse files
waleedlatif1claude
andcommitted
fix(knowledge): pass Gemini API key via x-goog-api-key header
URLs end up in server access logs, proxy logs, and APM tools, so embedding the key as a query param risks accidental exposure. Google explicitly recommends the header form for the Gemini REST API. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 5dfaed2 commit b73c218

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/sim/lib/knowledge/embeddings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ function l2Normalize(vector: number[]): number[] {
154154

155155
function buildGeminiProvider(modelName: string, apiKey: string): ResolvedProvider['buildRequest'] {
156156
return (inputs, inputType) => ({
157-
apiUrl: `https://generativelanguage.googleapis.com/v1beta/models/${modelName}:batchEmbedContents?key=${encodeURIComponent(apiKey)}`,
157+
apiUrl: `https://generativelanguage.googleapis.com/v1beta/models/${modelName}:batchEmbedContents`,
158158
headers: {
159159
'Content-Type': 'application/json',
160+
'x-goog-api-key': apiKey,
160161
},
161162
body: {
162163
requests: inputs.map((text) => ({

0 commit comments

Comments
 (0)