openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
21 lines (20 loc) • 812 B
JavaScript
import { l as normalizeOptionalString } from "./string-coerce-6kR-86XC.mjs";
import "./string-coerce-runtime-B1b8UNzb.mjs";
import { n as parseGoogleOauthApiKey } from "./oauth-token-shared-LqSy8lwB.mjs";
//#region extensions/google/gemini-auth.ts
function parseGeminiAuth(apiKey) {
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"
} };
}
function resolveGoogleEnvApiKey() {
return normalizeOptionalString(process.env.GEMINI_API_KEY) ?? normalizeOptionalString(process.env.GOOGLE_API_KEY);
}
//#endregion
export { resolveGoogleEnvApiKey as n, parseGeminiAuth as t };