UNPKG

call-ai

Version:

Lightweight library for making AI API calls with streaming support

30 lines (29 loc) 1.04 kB
import { type CallAIEnv } from "./env.js"; export interface EnvLike { readonly CALLAI_API_KEY?: unknown; readonly CALLAI_REFRESH_ENDPOINT?: unknown; readonly CALL_AI_REFRESH_TOKEN?: unknown; readonly CALLAI_DEBUG?: unknown; } export interface KeyMetadata { key: string; hash: string; created: Date; expires: Date; remaining: number; limit: number; } export declare function keyStore(): { current: string | undefined; refreshEndpoint: string; refreshToken: string | 0 | false | null | undefined; isRefreshing: boolean; lastRefreshAttempt: number; metadata: Record<string, Partial<KeyMetadata>>; }; declare let globalDebug: boolean; declare function initKeyStore(env?: CallAIEnv | EnvLike): void; declare function isNewKeyError(ierror: unknown, debug?: boolean): boolean; declare function getHashFromKey(key: string): string | null; declare function storeKeyMetadata(data: KeyMetadata): void; export { globalDebug, initKeyStore, isNewKeyError, getHashFromKey, storeKeyMetadata };