import type { ApiServer } from '../ApiServer'; import type { AuthContext } from '../auth/AuthContext'; import type { AiGatewayService } from '../ai-gateway/AiGatewayService'; /** * Chat completion request (OpenAI-compatible) */ export interface ChatCompletionRequest { model: string; messages: Array & { role: string; content?: unknown; }>; temperature?: number; max_tokens?: number; stream?: boolean; tools?: unknown[]; tool_choice?: unknown; [key: string]: unknown; } /** * Chat completion response (OpenAI-compatible) */ export interface ChatCompletionResponse { id: string; object: 'chat.completion'; created: number; model: string; choices: Array<{ index: number; message: { role: 'assistant'; content: string | null; tool_calls?: unknown[]; }; finish_reason: 'stop' | 'length' | 'content_filter' | 'tool_calls' | string | null; }>; usage: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; } export interface ChatHandlerOptions { aiGatewayService?: AiGatewayService; aiGatewayJsonBodyLimitBytes?: number; acceptanceEndpointsEnabled?: boolean; /** * Legacy service type retained only so Task11 can migrate existing internal * callers without forcing unrelated imports to change in this task. */ chatService?: { complete(request: ChatCompletionRequest, auth: AuthContext): Promise; stream(request: ChatCompletionRequest, auth: AuthContext): Promise; responses?(body: any, auth: AuthContext): Promise; messages?(body: any, auth: AuthContext): Promise; listModels(auth?: AuthContext): Promise; }; podBaseUrl?: string; } /** * Register public AI-compatible routes. * * The four `/v1/*` client-facing routes are owned by AiGatewayHandler. Legacy * provider branching remains in VercelChatService until Task11, but it is no * longer installed as a public route implementation here. */ export declare function registerChatRoutes(server: ApiServer, options: ChatHandlerOptions): void;