UNPKG

@guardaian/sdk

Version:

Zero-friction AI governance and monitoring SDK for Node.js applications

68 lines (58 loc) 1.56 kB
export interface GuardAIanOptions { apiKey: string; baseURL?: string; environment?: 'production' | 'development' | 'staging' | 'test'; debug?: boolean; batchSize?: number; flushInterval?: number; maxRetries?: number; } export interface TrackingData { service: 'openai' | 'anthropic' | 'azure' | 'google' | 'huggingface' | 'other'; model: string; operation: string; inputTokens?: number; outputTokens?: number; totalTokens?: number; cost?: number; duration?: number; requestData?: any; responseData?: any; metadata?: { environment?: string; projectName?: string; userAgent?: string; customTags?: string[]; [key: string]: any; }; tags?: string[]; projectName?: string; } export class GuardAIanClient { constructor(options: GuardAIanOptions); track(data: TrackingData): Promise<TrackingData>; flush(): Promise<void>; calculateCost(service: string, model: string, usage: any): number; destroy(): void; } export class GuardAIan { client: GuardAIanClient; constructor(options: GuardAIanOptions); static init(options: GuardAIanOptions): GuardAIanOptions; static isInitialized(): boolean; static getConfig(): Partial<GuardAIanOptions>; track(data: TrackingData): Promise<TrackingData>; flush(): Promise<void>; destroy(): void; } export default GuardAIan; export const version: string; declare global { namespace NodeJS { interface ProcessEnv { GUARDAIAN_API_KEY?: string; GUARDAIAN_BASE_URL?: string; GUARDAIAN_DEBUG?: string; } } }