parseGeminiAuth (utils/gemini-auth.ts)

deepbot · src/main/utils/gemini-auth.ts · typescript · MIT
auth

Utility that builds Gemini API key auth headers for HTTP requests.

// Source: https://github.com/kevinluosl/deepbot | License: MIT | Copyright 2024 Kevin Luo
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Gemini 认证工具
 * 
 * 简化版本,只支持 API Key 认证
 */

/**
 * 解析 Gemini API Key 并返回适当的认证头
 * 
 * @param apiKey - Google AI Studio API Key
 * @returns 认证头对象
 */
export function parseGeminiAuth(apiKey: string): { headers: Record<string, string> } {
  return {
    headers: {
      "x-goog-api-key": apiKey,
      "Content-Type": "application/json",
    },
  };
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key