/** * Centralized Tavus configuration * * This module now uses the secure API key management system. * API keys are managed through environment variables and the ApiKeyManager. */ import type { BuzzTrailGlobal } from '@buzztrail/shared-types'; import { getApiKeyManager, getTavusApiKey as getSecureApiKey } from './api-key-manager'; // Legacy fallback for backward compatibility const LEGACY_TAVUS_API_KEY = '8ff39906dd5840a9bca8c6ce4e15135c'; /** * Returns the Tavus API key. * * Uses the secure API key management system first, * then falls back to global override, then legacy key. */ export function getTavusApiKey(): string { try { // Try secure API key management first const secureKey = getSecureApiKey(); if (secureKey) { return secureKey; } // Fall back to global override const global = globalThis as BuzzTrailGlobal; if (global.__BT_TAVUS_API_KEY__) { return global.__BT_TAVUS_API_KEY__; } } catch { // Ignore errors accessing globalThis or secure system } // Final fallback to legacy key return LEGACY_TAVUS_API_KEY; } /** * Returns the Tavus API base URL. */ export function getTavusApiBaseUrl(): string { return 'https://tavusapi.com'; } /** * Get API key manager for advanced operations */ export function getTavusApiKeyManager() { return getApiKeyManager(); }