/** * OpenRouter API data types * Based on OpenRouter API specification */ import type { ToolDefinition, ToolCall } from './tools.js'; export interface ChatCompletionRequest { model: string; messages: APIMessage[]; stream?: boolean; max_tokens?: number; temperature?: number; top_p?: number; tools?: ToolDefinition[]; tool_choice?: 'auto' | 'none' | { type: 'function'; function: { name: string; }; }; } export interface APIMessage { role: 'user' | 'assistant' | 'system' | 'tool'; content: string | null; tool_calls?: ToolCall[]; tool_call_id?: string; name?: string; } export interface ChatCompletionResponse { id: string; object: 'chat.completion'; created: number; model: string; choices: ChatCompletionChoice[]; usage?: TokenUsage; } export interface ChatCompletionChoice { index: number; message: { role: 'assistant'; content: string | null; tool_calls?: ToolCall[]; }; finish_reason: 'stop' | 'length' | 'content_filter' | 'tool_calls'; } export interface TokenUsage { prompt_tokens: number; completion_tokens: number; total_tokens: number; } export interface ChatCompletionChunk { id: string; object: 'chat.completion.chunk'; created: number; model: string; choices: ChatCompletionChunkChoice[]; } export interface ChatCompletionChunkChoice { index: number; delta: { role?: 'assistant'; content?: string; tool_calls?: ToolCall[]; }; finish_reason: null | 'stop' | 'length' | 'content_filter' | 'tool_calls'; } export interface ModelsListResponse { data: ModelInfo[]; } export interface ModelInfo { id: string; name: string; description?: string; context_length: number; pricing: { prompt: string; completion: string; image?: string; request?: string; }; architecture?: { modality: 'text' | 'text+image' | 'text+audio'; tokenizer: string; instruct_type?: string; }; top_provider?: { max_completion_tokens?: number; is_moderated: boolean; }; } export interface ErrorResponse { error: { message: string; type?: string; code: string; param?: string | null; }; } export interface ApiKeyValidationResponse { data: { label: string; usage: number; limit: number | null; is_free_tier: boolean; rate_limit: { requests: number; interval: string; }; }; } //# sourceMappingURL=openrouter.d.ts.map