summaryrefslogtreecommitdiff
path: root/packages/core/src
diff options
context:
space:
mode:
authorSandy Tao <[email protected]>2025-07-15 11:37:14 -0700
committerGitHub <[email protected]>2025-07-15 18:37:14 +0000
commit7b49560265ebbdb9e3b463ea71f2dc0438db4000 (patch)
tree2dd2068e278802d916fe83d57def5f615402c899 /packages/core/src
parent40c40708464f641b2cd5bee119f951453e92f7bd (diff)
Include api key in header instead of in the URL (#4240)
Diffstat (limited to 'packages/core/src')
-rw-r--r--packages/core/src/core/modelCheck.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/core/src/core/modelCheck.ts b/packages/core/src/core/modelCheck.ts
index 807bd5c5..c9078aaf 100644
--- a/packages/core/src/core/modelCheck.ts
+++ b/packages/core/src/core/modelCheck.ts
@@ -28,7 +28,7 @@ export async function getEffectiveModel(
const modelToTest = DEFAULT_GEMINI_MODEL;
const fallbackModel = DEFAULT_GEMINI_FLASH_MODEL;
- const endpoint = `https://generativelanguage.googleapis.com/v1beta/models/${modelToTest}:generateContent?key=${apiKey}`;
+ const endpoint = `https://generativelanguage.googleapis.com/v1beta/models/${modelToTest}:generateContent`;
const body = JSON.stringify({
contents: [{ parts: [{ text: 'test' }] }],
generationConfig: {
@@ -45,7 +45,10 @@ export async function getEffectiveModel(
try {
const response = await fetch(endpoint, {
method: 'POST',
- headers: { 'Content-Type': 'application/json' },
+ headers: {
+ 'Content-Type': 'application/json',
+ 'x-goog-api-key': apiKey,
+ },
body,
signal: controller.signal,
});