/** * AI API Handler interfaces and types * Shared across all Recoder apps */ import { Anthropic } from "@anthropic-ai/sdk"; export { DEFAULT_HYBRID_REASONING_MODEL_MAX_TOKENS, DEFAULT_HYBRID_REASONING_MODEL_THINKING_TOKENS, shouldUseReasoningBudget, shouldUseReasoningEffort, getModelMaxOutputTokens } from './reasoning'; export interface ModelInfo { maxTokens?: number; contextWindow: number; supportsImages?: boolean; supportsTools?: boolean; supportsPromptCache: boolean; supportsComputerUse?: boolean; supportsReasoningBudget?: boolean; maxThinkingTokens?: number; reasoningEffort?: "minimal" | "low" | "medium" | "high"; description?: string; inputPricePerMillion?: number; outputPricePerMillion?: number; inputPrice?: number; outputPrice?: number; cacheWritesPrice?: number; cacheReadsPrice?: number; supportedParameters?: string[]; preferredIndex?: number; requiredReasoningBudget?: boolean; cost?: string | number; pricing?: { input: number; output: number; cacheRead?: number; cacheWrite?: number; }; tiers?: Array<{ contextWindow: number; inputPrice?: number; outputPrice?: number; cacheWritesPrice?: number; cacheReadsPrice?: number; name?: string; maxTokens?: number; }>; } export interface ApiHandlerOptions { apiKey?: string; apiModelId?: string; modelTemperature?: number; anthropicApiKey?: string; openaiApiKey?: string; groqApiKey?: string; geminiApiKey?: string; huggingFaceApiKey?: string; togetherApiKey?: string; openRouterApiKey?: string; ollamaBaseUrl?: string; maxTokens?: number; temperature?: number; topP?: number; openRouterBaseUrl?: string; openRouterModelId?: string; openRouterSpecificProvider?: string; openRouterUseMiddleOutTransform?: boolean; [key: string]: any; } export interface AITokenUsage { inputTokens: number; outputTokens: number; cacheReadTokens?: number; cacheWriteTokens?: number; reasoningTokens?: number; totalCost?: number; } export interface StreamChunk { type: 'text' | 'usage' | 'reasoning' | 'error'; text?: string; usage?: AITokenUsage; error?: string; } export interface AIGenerationResult { text: string; usage?: AITokenUsage; model?: string; provider?: string; finishReason?: string; } export interface ApiHandler { name: string; createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[], metadata?: any): AsyncGenerator; completePrompt?(prompt: string): Promise; getModel(): { id: string; info: ModelInfo; }; } export interface SingleCompletionHandler { completePrompt(prompt: string): Promise; } export interface ModelRecord { [modelId: string]: ModelInfo; } export interface ReasoningParams { include?: boolean; exclude?: boolean; budget?: number; } export interface ApiProviderConfig { name: string; baseUrl: string; apiKeyEnvVar: string; models: ModelRecord; defaultModel: string; supportsStreaming?: boolean; supportsImages?: boolean; supportsTools?: boolean; } export declare class AIApiError extends Error { code?: string | undefined; status?: number | undefined; provider?: string | undefined; constructor(message: string, code?: string | undefined, status?: number | undefined, provider?: string | undefined); } export declare class AIRateLimitError extends AIApiError { retryAfter?: number | undefined; constructor(message: string, retryAfter?: number | undefined); } export declare class AIAuthenticationError extends AIApiError { constructor(message: string); } export type ApiProvider = 'anthropic' | 'openai' | 'groq' | 'gemini' | 'huggingface' | 'together' | 'openrouter' | 'ollama' | 'mistral' | 'deepseek' | 'xai'; export interface ProviderCapabilities { streaming: boolean; images: boolean; tools: boolean; reasoning: boolean; caching: boolean; } export interface ProviderStatus { available: boolean; configured: boolean; models: string[]; lastChecked?: Date; error?: string; } export interface GetModelsOptions { apiKey?: string; baseUrl?: string; timeout?: number; provider?: RouterName; kilocodeToken?: string; } export type RouterName = 'anthropic' | 'openai' | 'groq' | 'gemini' | 'huggingface' | 'together' | 'openrouter' | 'ollama' | 'mistral' | 'deepseek' | 'xai' | 'cerebras' | 'litellm' | 'lmstudio' | 'bedrock' | 'vertex' | 'claude-code' | 'fireworks' | 'chutes' | 'requesty' | 'glama' | 'unbound' | 'human-relay' | 'fake-ai' | 'vscode-lm' | 'kilocode-openrouter'; //# sourceMappingURL=api.d.ts.map