import type { ModelLimit, ProviderConfig } from '../config.js'; import { UsageTracker } from './usage-tracker.js'; import { type Pricing } from './cost-calculator.js'; /** * 限制检查结果 */ export interface LimitCheckResult { exceeded: boolean; limit?: ModelLimit; current?: number; message?: string; } /** * 错误响应格式 */ export interface RateLimitError { error: { message: string; type: string; param: null; code: string; }; } /** * 限制检查器类 */ export declare class RateLimiter { private logDir; constructor(logDir: string); private get tracker(); /** * 检查所有限制 */ checkLimits(config: ProviderConfig, logDir: string): Promise; /** * 从配置中提取价格信息 */ private extractPricing; /** * 生成错误信息 */ private formatErrorMessage; /** * 创建 429 错误响应 */ createErrorResponse(message: string): RateLimitError; /** * 记录用量(请求成功后调用) */ recordUsage(model: string, entry: import('../logger.js').LogEntry, pricing: Pricing | undefined): void; /** * 获取追踪器实例(用于测试) */ getTracker(): UsageTracker; } //# sourceMappingURL=rate-limiter.d.ts.map