import type { ProviderProtocol, ChatMessageDto, EffortLevel, StreamErrorPayload } from './protocol.js'; import { AIProvider } from './aiProvider.js'; /** Get the provider implementation for a given protocol. */ export declare function getProvider(protocol: ProviderProtocol): AIProvider; /** Resolved provider credentials for AI requests */ export interface ResolvedAIProvider { apiKey: string; baseUrl: string; protocol: ProviderProtocol; model: string; isFreeModel: boolean; } /** Options for sending AI requests */ export interface SendAIRequestOpts { messages: ChatMessageDto[]; stream: boolean; effort?: EffortLevel; webSearch?: boolean; origin?: string; signal?: AbortSignal; modifyPayload?: (payload: Record) => void; } /** * Join an operation path onto a base URL, **preserving the base's path prefix**. * * `new URL(absolutePath, base)` resolves the absolute path against the base's *origin*, so any * path in the base is silently dropped — a prefixed/gateway/proxy base (Azure, a corporate proxy, * an `openai-compat` endpoint) loses its prefix. This keeps the base intact and appends the path * with exactly one `/` between. The OpenAI-SDK model: `baseUrl` is the true API root, the * operation path (from `getPath`) is joined onto it. Trailing slashes on the base are collapsed so * a user-supplied `…/v1/` and `…/v1` behave identically. */ export declare function joinUrl(base: string, path: string): string; /** Send a request to an AI provider */ export declare function sendAIRequest(provider: ResolvedAIProvider, opts: SendAIRequestOpts): Promise; /** Providers report context overflow as a 400 with a telltale message, not a 413 — Anthropic * "prompt is too long", OpenAI "maximum context length" / `context_length_exceeded`, Gemini * "input token count exceeds". Message-match so the promised `context_exceeded` code actually * fires (TB-AI.md Error Handling). */ export declare function isContextExceededMessage(message: string): boolean; /** Parse an upstream error response into our standard error payload */ export declare function normalizeUpstreamError(response: Response, protocol: ProviderProtocol): Promise>; //# sourceMappingURL=aiProviders.d.ts.map