import { openAIErrorResponse } from "../auth-gateway/http.js"; /** * Parsed inbound OpenAI chat-completions request, ready to feed into pi-ai * `stream(model, context, options)`. */ import type { AuthGatewayStreamControl, AuthGatewayParsedRequest as ParsedRequest } from "../auth-gateway/types.js"; import type { AssistantMessage, AssistantMessageEventStream, Context, Model } from "../types.js"; export type { ParsedRequest }; export declare function parseRequest(body: unknown, headers?: Headers): ParsedRequest; /** * Stamp the replayed tool-call turns that carry a Gemini signature as `model`'s own: they came from this gateway * model, and a turn labeled as a foreign model loses its signature in `transformMessages`. Native Gemini * transports replay the raw signature; every other transport keeps the stored envelope. */ export declare function adoptReplayedGeminiSignatures(context: Context, model: Model): void; export declare function encodeResponse(message: AssistantMessage, requestedModelId: string): Record; export declare function encodeStream(events: AssistantMessageEventStream, requestedModelId: string, options?: ParsedRequest["options"], control?: AuthGatewayStreamControl): ReadableStream; /** * OpenAI chat-completions error envelope: * `{ error: { message, type } }` * Matches the shape the official SDK auto-parses into `APIError`. */ export declare const formatError: typeof openAIErrorResponse;