/**
 * OpenRouter Mastery Service
 *
 * Complete implementation of ALL OpenRouter API features and capabilities:
 * - Routing variants (:nitro, :floor, :online, :free)
 * - Streaming responses with real-time progress
 * - JSON mode with schema validation
 * - Function calling integration
 * - Cost tracking and budget enforcement
 * - Intelligent fallback systems
 * - Provider performance monitoring
 * - Advanced error handling and recovery
 */
import { OpenRouterMessage } from './openrouter-client.js';
export interface RoutingVariant {
    variant: ':nitro' | ':floor' | ':online' | ':free' | ':default';
    description: string;
    costMultiplier: number;
    speedMultiplier: number;
    features: string[];
}
export interface StreamingOptions {
    onProgress?: (chunk: string, stage?: string) => void;
    onTokenCount?: (inputTokens: number, outputTokens: number) => void;
    onCostUpdate?: (currentCost: number, budgetRemaining: number) => void;
    onProviderSwitch?: (fromProvider: string, toProvider: string, reason: string) => void;
    enableCancellation?: boolean;
}
export interface BudgetControls {
    maxCostPerCall?: number;
    maxTotalCost?: number;
    costThreshold?: number;
    emergencyFallback?: boolean;
}
export interface OpenRouterCallOptions {
    routingVariant?: ':nitro' | ':floor' | ':online' | ':free' | ':default';
    streaming?: boolean;
    streamingOptions?: StreamingOptions;
    budgetControls?: BudgetControls;
    jsonMode?: boolean;
    jsonSchema?: any;
    functionCalling?: boolean;
    tools?: any[];
    retryStrategy?: 'exponential' | 'immediate' | 'none';
    fallbackProviders?: string[];
    performanceTargets?: {
        maxLatencyMs?: number;
        minSuccessRate?: number;
    };
}
export interface OpenRouterResponse {
    content: string;
    model: string;
    provider: string;
    cost: number;
    tokens: {
        input: number;
        output: number;
    };
    performance: {
        latencyMs: number;
        successRate: number;
    };
    metadata: {
        routingVariant: string;
        fallbacksUsed: number;
        providerSwitches: number;
        features: string[];
    };
}
export interface ProviderPerformance {
    provider: string;
    model: string;
    variant: string;
    latencyMs: number;
    successRate: number;
    costPerToken: number;
    uptime24h: number;
    lastUpdated: string;
}
export declare const ROUTING_VARIANTS: Record<string, RoutingVariant>;
export declare class OpenRouterMastery {
    private apiKey;
    private baseUrl;
    private performanceCache;
    private circuitBreaker;
    constructor(apiKey: string);
    /**
     * Master function that calls OpenRouter with ALL advanced features
     */
    callWithMastery(model: string, messages: OpenRouterMessage[], options?: OpenRouterCallOptions): Promise<OpenRouterResponse>;
    /**
     * Apply OpenRouter routing variants to model IDs
     */
    private applyRoutingVariant;
    /**
     * Enforce budget controls and cost optimization
     */
    private enforcebudgetControls;
    /**
     * Prepare request with advanced OpenRouter features
     */
    private prepareAdvancedRequest;
    /**
     * Execute streaming call with real-time progress
     */
    private executeStreamingCall;
    /**
     * Execute standard (non-streaming) call
     */
    private executeStandardCall;
    /**
     * Handle errors with intelligent fallback strategies
     */
    private handleErrorWithFallback;
    /**
     * Circuit breaker pattern for provider health management
     */
    private isCircuitBreakerOpen;
    private updateCircuitBreaker;
    /**
     * Update provider performance metrics
     */
    private updatePerformanceMetrics;
    /**
     * Track feature usage for analytics
     */
    private trackFeatureUsage;
    private extractProvider;
    private extractVariant;
    private calculateCost;
    private getModelInternalId;
}
/**
 * Create OpenRouter mastery instance
 */
export declare function createOpenRouterMastery(): Promise<OpenRouterMastery>;
/**
 * Quick call with routing variant
 */
export declare function callWithVariant(model: string, messages: OpenRouterMessage[], variant: ':nitro' | ':floor' | ':online' | ':free' | ':default'): Promise<OpenRouterResponse>;
/**
 * Quick streaming call
 */
export declare function callWithStreaming(model: string, messages: OpenRouterMessage[], onProgress: (chunk: string) => void): Promise<OpenRouterResponse>;
/**
 * Budget-controlled call
 */
export declare function callWithBudget(model: string, messages: OpenRouterMessage[], maxCost: number): Promise<OpenRouterResponse>;
/**
 * JSON mode call with schema
 */
export declare function callWithJsonSchema(model: string, messages: OpenRouterMessage[], schema: any): Promise<OpenRouterResponse>;
export default OpenRouterMastery;
//# sourceMappingURL=openrouter-mastery.d.ts.map