import { type RouterConfig } from "@velum-labs/routekit-config-core"; import type { ModelCapabilityMetadata, ModelReasoningCapabilities, ModelSelectionSignals } from "@velum-labs/routekit-contracts"; import { Effect } from "effect"; import type { Backend, BackendModelRoute, BackendPorts, BackendRequest, BackendRequestOptions } from "../providers/backend.js"; import type { ApiProviderId, ProviderId, ProviderSource } from "../providers/source.js"; import { SUBSCRIPTION_PROVIDER_IDS } from "../providers/source.js"; import { BackendExecutor, ModelCatalog, ModelResolver, ProviderLifecycle, RoutePlanner } from "./core.js"; export declare class UnknownModelError extends Error { readonly model: string; constructor(model: string); } export declare class NoModelAvailableError extends Error { constructor(); } export type CatalogModelInfo = ModelSelectionSignals & { id: string; provider: ProviderId; nativeModel: string; accountClass: "api-key" | "subscription" | "proxy"; billingMode: "metered-api" | "subscription" | "upstream-managed"; default: boolean; capabilities: Readonly>; metadata?: ModelCapabilityMetadata; reasoning: ModelReasoningCapabilities | null; }; export type RoutingBackendOptions = { config: RouterConfig | unknown; env?: Readonly>; sources?: Partial>; createApiSource?: (provider: ApiProviderId, env: Readonly>) => ProviderSource; signal?: AbortSignal; }; /** Match an anchored model-policy glob where only `*` has special meaning. */ export declare function modelPolicyRuleMatches(rule: string, canonicalModel: string): boolean; /** Apply inclusive allowlist then denylist; a matching deny rule always wins. */ export declare function modelPolicyAllowsModel(policy: RouterConfig["modelPolicy"], canonicalModel: string): boolean; export declare class RoutingBackend implements Backend { #private; readonly ports: BackendPorts; readonly defaultModel: string | undefined; readonly catalog: ModelCatalog; readonly resolver: ModelResolver; readonly planner: RoutePlanner; readonly executor: BackendExecutor; readonly providers: ProviderLifecycle; private constructor(); static create(options: RoutingBackendOptions): Effect.Effect; listModelIds(): readonly string[]; modelInfo(model: string): CatalogModelInfo | undefined; providerStatuses(signal?: AbortSignal): Effect.Effect<({ provider: "anthropic" | "google" | "openai" | "claude-code" | "codex" | "cliproxy" | "openrouter" | "bedrock"; ok: boolean; models: string[]; error: string; } | { provider: "anthropic" | "google" | "openai" | "claude-code" | "codex" | "cliproxy" | "openrouter" | "bedrock"; ok: boolean; models: string[]; error: string; } | { provider: "anthropic" | "google" | "openai" | "claude-code" | "codex" | "cliproxy" | "openrouter" | "bedrock"; ok: boolean; models: string[]; error?: undefined; })[], never, import("effect/unstable/http/HttpClient").HttpClient | import("@effect/platform-node/NodeServices").NodeServices>; servesModel(model: string): boolean; resolveModel(requested: string | undefined): string | undefined; resolveModelRoute(requested: string | undefined, nativeProvider?: string): BackendModelRoute | undefined; capabilities(model: string): Readonly>; modelMetadata(model: string): ModelCapabilityMetadata | undefined; reasoningCapabilities(model: string): ModelReasoningCapabilities | undefined; reasoningWireShape(model: string): string | undefined; supportsResponses(model: string): boolean; chat(body: unknown, signal?: AbortSignal, options?: BackendRequestOptions): BackendRequest; responses(body: unknown, signal?: AbortSignal, options?: BackendRequestOptions): BackendRequest; models(): BackendRequest; embeddings(body: unknown, signal?: AbortSignal, options?: BackendRequestOptions): BackendRequest; close(): Effect.Effect; } export declare function isSubscriptionProvider(provider: ProviderId): provider is (typeof SUBSCRIPTION_PROVIDER_IDS)[number];