// ── OpenAI wire format (pass-through) ── // // These types deliberately mirror the OpenAI Chat Completions schema and stay // open ([key: string]: unknown) so new fields LiteLLM/OpenAI add flow through // without a library change. Do NOT wrap or rename fields here — the whole // point of the gateway (LiteLLM) is that we speak the standard format. export interface OpenAiMessage { /** 'system' | 'user' | 'assistant' | 'tool' — open so provider-specific roles pass through. */ role: string; content: string | null; tool_calls?: OpenAiToolCall[]; tool_call_id?: string; [key: string]: unknown; } export interface OpenAiToolCall { id: string; type: string; function?: { name: string; arguments: string; }; [key: string]: unknown; } /** * One entry of `choices[]`. `finish_reason` is 'stop', 'length' (hit the * completion-token limit), 'tool_calls', or 'content_filter'. */ export interface OpenAiChoice { message: OpenAiMessage; finish_reason?: string | null; [key: string]: unknown; } /** One `chat.completion.chunk` of a streamed response: `choices[].delta` fragments. */ export interface OpenAiChunk { choices?: Array<{ delta?: { role?: string; content?: string | null; tool_calls?: Array<{ index?: number; id?: string; type?: string; function?: { name?: string; arguments?: string; }; [key: string]: unknown; }>; [key: string]: unknown; }; finish_reason?: string | null; [key: string]: unknown; }>; [key: string]: unknown; } export interface OpenAiToolDefinition { type: 'function'; function: { name: string; description?: string; parameters?: Record; [key: string]: unknown; }; [key: string]: unknown; } /** OpenAI-compatible gateway (udp-ai-gateway / LiteLLM). */ export interface GatewayConfig { /** e.g. https:// — endpoints live under /v1 */ baseUrl: string; /** * Extra headers, e.g. { 'udp-product-id': '83' }. Authorization and * currentTenantId are added by the transport (same helper apiMutate uses). */ headers?: Record; } /** One-line description of a failed gateway call: `HTTP — `, else the error message. */ export declare const describeRequestError: (err: unknown) => string; /** * POST /v1/chat/completions, streamed. `body` is the raw OpenAI request body — * model, messages, tools, and any additional params the caller passes through * (the gateway runs LiteLLM with drop_params, so unsupported params are * silently dropped per provider). `onDelta` receives assistant text as it * arrives; the resolved choice is the fully accumulated message, identical in * shape to a non-streamed response. A gateway that ignores `stream` and * answers with one JSON completion is handled too. */ export declare const chatCompletion: (gateway: GatewayConfig, body: Record, onDelta?: (text: string) => void) => Promise; /** GET /v1/models — returns the model ids the (tenant, product) cell is entitled to. */ export declare const listModels: (gateway: GatewayConfig) => Promise; //# sourceMappingURL=openai.d.ts.map