type FallbackChain = { primary: string; fallbackChain: string[]; maxRetries?: number; }; interface Fallback { execute(chain: FallbackChain, fn: (model: string) => Promise): Promise; } type GuardConfig = { jsonSchema?: object; banPhrases?: string[]; minGroundingScore?: number; sourceText?: string; }; interface Guard { verify(response: string, config: GuardConfig): { isValid: boolean; errors: string[]; }; } type RouteRule = { maxTokens?: number; keywords?: string[]; complexity: "low" | "medium" | "high"; targetModel: string; }; interface Router { addRule(rule: RouteRule): void; determineModel(prompt: string): Promise<{ model: string; reason: string; }>; } type TrackResult = { requestId: string; durationMs: number; promptTokens: number; completionTokens: number; estimatedCostUSD: number; requestPayload: unknown; responsePayload: unknown; }; type TrackerStorage = "memory" | "sqlite"; type TrackerOptions = { storage?: TrackerStorage; sqlitePath?: string; }; interface Tracker { logExchange(request: unknown, response: unknown): Promise; wrap Promise>(fn: T): T; on(event: "exchange", handler: (data: TrackResult) => void): void; } type AiToolboxOptions = { /** Profile/choice or model id when no router rule matches. @default {@link DEFAULT_TOOLBOX_MODEL} */ defaultModel?: string; apiKey?: string; storage?: TrackerOptions["storage"]; sqlitePath?: string; }; declare class AIToolbox { readonly tracker: Tracker; readonly router: Router; readonly guard: Guard; readonly fallback: Fallback; constructor(options?: AiToolboxOptions); } /** Default profile/choice for toolbox router fallbacks. */ declare const DEFAULT_TOOLBOX_MODEL = "cheap/default"; export { AIToolbox, type AiToolboxOptions, DEFAULT_TOOLBOX_MODEL, type Fallback, type FallbackChain, type Guard, type GuardConfig, type RouteRule, type Router, type TrackResult, type Tracker, type TrackerOptions };