perf-lens
Version:
AI-powered frontend performance optimizer
31 lines • 1.53 kB
TypeScript
import { AIModel } from '../ai/models.js';
import type { AIProvider, AIModelConfig } from '../types/config.js';
/**
* Sets the API key for a specific AI provider
* @param {string} key - The API key to set
* @param {AIProvider} provider - The AI provider to set the key for
* @throws {Error} If the provider is not supported
*/
export declare function setApiKey(key: string, provider: AIProvider): void;
/**
* Gets the API key for a specific AI provider from environment variables or config file
* @param {AIProvider} provider - The AI provider to get the key for
* @returns {string | undefined} The API key if found, undefined otherwise
* @throws {Error} If the provider is not supported
*/
export declare function getApiKey(provider: AIProvider): string | undefined;
/**
* Creates an AI model instance based on the provided configuration
* @param {AIModelConfig} config - The configuration for the AI model
* @returns {AIModel} The created AI model instance
* @throws {Error} If the API key is not found or the model creation fails
*/
export declare function createModel(config: AIModelConfig): AIModel;
/**
* Validates an API key for a specific AI provider by testing the connection
* @param {string} key - The API key to validate
* @param {AIProvider} provider - The AI provider to validate the key for
* @returns {Promise<boolean>} True if the key is valid, false otherwise
*/
export declare function validateApiKey(key: string, provider: AIProvider): Promise<boolean>;
//# sourceMappingURL=ai.d.ts.map