/** * OpenAI SDK Wrapper for EthicalZen * * Wrap your OpenAI client to automatically route all calls through EthicalZen. * * @example * ```typescript * import OpenAI from 'openai'; * import { protectOpenAI } from '@ethicalzen/sdk'; * * const openai = protectOpenAI( * new OpenAI({ apiKey: process.env.OPENAI_API_KEY }), * 'your-ethicalzen-api-key' * ); * * // Use normally - all calls go through EthicalZen! * const response = await openai.chat.completions.create({ * model: 'gpt-4', * messages: [{ role: 'user', content: 'Hello' }] * }); * ``` */ import { EthicalZen, EthicalZenOptions } from '../ethicalzen'; /** * Options for OpenAI wrapper */ export interface OpenAIWrapperOptions extends EthicalZenOptions { /** OpenAI API key (if not already set in OpenAI client) */ openaiApiKey?: string; } /** * Wrap an OpenAI client to route all calls through EthicalZen * * @param openaiClient - Existing OpenAI client instance * @param ezApiKey - Your EthicalZen API key * @param options - Optional configuration * @returns Wrapped OpenAI client * * @example * ```typescript * const openai = protectOpenAI(new OpenAI({ apiKey: '...' }), 'ez-api-key'); * * // All calls now go through EthicalZen gateway * const response = await openai.chat.completions.create({ * model: 'gpt-4', * messages: [{ role: 'user', content: 'Hello' }] * }); * ``` */ export declare function protectOpenAI(openaiClient: T, ezApiKey: string, options?: OpenAIWrapperOptions): T; /** * Create a new protected OpenAI client from scratch * * @param openaiApiKey - Your OpenAI API key * @param ezApiKey - Your EthicalZen API key * @param options - Optional configuration * @returns Object with common OpenAI methods * * @example * ```typescript * const ai = createProtectedOpenAI( * process.env.OPENAI_API_KEY, * process.env.ETHICALZEN_API_KEY * ); * * const response = await ai.chat({ * model: 'gpt-4', * messages: [{ role: 'user', content: 'Hello' }] * }); * ``` */ export declare function createProtectedOpenAI(openaiApiKey: string, ezApiKey: string, options?: EthicalZenOptions): { /** * Create a chat completion */ chat: (params: { model: string; messages: Array<{ role: string; content: string; }>; temperature?: number; max_tokens?: number; [key: string]: any; }) => Promise; /** * Create a completion (legacy) */ complete: (params: { model: string; prompt: string; max_tokens?: number; [key: string]: any; }) => Promise; /** * Create embeddings */ embed: (params: { model: string; input: string | string[]; [key: string]: any; }) => Promise; /** * Moderate content */ moderate: (params: { input: string | string[]; model?: string; }) => Promise; /** * Generate images */ image: (params: { prompt: string; model?: string; n?: number; size?: string; [key: string]: any; }) => Promise; /** * Transcribe audio */ transcribe: (params: { file: any; model: string; [key: string]: any; }) => Promise; /** * Text to speech */ speak: (params: { model: string; input: string; voice: string; [key: string]: any; }) => Promise; /** * Get the underlying EthicalZen instance */ getEthicalZen: () => EthicalZen; }; export default protectOpenAI; //# sourceMappingURL=openai.d.ts.map