import { type ProxyConfig, type ProxyEvent } from './proxy.js'; export type ProviderProtocol = 'anthropic' | 'openai' | 'google'; export interface ProviderRouteDefinition { /** Stable route id used in `/providers//...`. */ id: string; /** Wire protocol accepted by the configured upstream. */ protocol: ProviderProtocol; /** Existing proxy configuration for this provider. Kept in memory only. */ proxy: ProxyConfig; } export interface ProviderRouterConfig { /** Handles legacy unprefixed routes such as `/v1/messages`. */ defaultProxy: ProxyConfig; /** Explicitly addressable providers. */ providers: readonly ProviderRouteDefinition[]; /** Optional observer invoked after the provider-specific observer. */ onRequest?: (providerId: string, event: ProxyEvent) => void | Promise; } export interface ParsedProviderRoute { providerId: string; upstreamPath: string; } export interface ProviderRouterInspection { defaultRoute: 'legacy'; providers: Array<{ id: string; protocol: ProviderProtocol; prefix: string; }>; } export declare function assertProviderId(id: string): void; /** * Parse an explicit provider-prefixed request path. * * The provider id is never accepted from a header, query string or body. This * keeps routing metadata outside the model payload and prevents an untrusted * client from overriding upstream selection through a forwarded header. */ export declare function parseProviderRoute(pathname: string): ParsedProviderRoute | null; /** * Create one request handler that multiplexes several provider-specific * `createProxy` instances behind one Web-standard request handler. * * Legacy paths continue through `defaultProxy`. Explicit provider paths use: * * /providers// */ export declare function createProviderRouter(config: ProviderRouterConfig): ((request: Request) => Promise) & { inspect(): ProviderRouterInspection; }; //# sourceMappingURL=provider-router.d.ts.map