Files
openclaw/extensions/google/gemini-auth.ts
2026-04-18 21:41:54 +01:00

21 lines
516 B
TypeScript

import { parseGoogleOauthApiKey } from "./oauth-token-shared.js";
export function parseGeminiAuth(apiKey: string): { headers: Record<string, string> } {
const parsed = apiKey.startsWith("{") ? parseGoogleOauthApiKey(apiKey) : null;
if (parsed?.token) {
return {
headers: {
Authorization: `Bearer ${parsed.token}`,
"Content-Type": "application/json",
},
};
}
return {
headers: {
"x-goog-api-key": apiKey,
"Content-Type": "application/json",
},
};
}