import type { LLMProvider, ChatRequest, ChatResponse, ProviderModelSource } from './interface.js'; import type { BenchmarkEntry } from './model-benchmarks.js'; import type { RuntimeEventBus } from '../runtime/events/index.js'; export interface SyntheticBackend { /** Provider name as registered in the provider registry. */ providerName: string; /** Model ID as understood by the provider. */ modelId: string; /** * Compound registry key for this backend: `${providerName}:${modelId}`. * Used for unambiguous routing and provider lookup. */ registryKey?: string | undefined; /** Context window in tokens (used for backend sort order). */ contextWindow?: number | undefined; /** Maximum output tokens (used as tiebreaker in sort order). */ maxOutputTokens?: number | undefined; /** * Environment variable names that gate this backend. * Empty array or undefined means no key required (always available). */ envVars?: string[] | undefined; } export type SyntheticTier = 'free' | 'paid' | 'subscription'; /** * Maps normalised synthetic model IDs to their ordered backend list. * Type annotation used by registry.ts for backend resolution. */ export type SyntheticModelMap = Record; /** * A canonical model offered by the SyntheticProvider. * Groups backends by tier so failover never crosses tier boundaries. */ export interface CanonicalModel { /** Canonical model ID exposed to callers (e.g. 'kimi-k2.5'). */ id: string; /** Pricing tier, determines which backend pool is used for failover. */ tier: SyntheticTier; /** Ordered list of backends to try within this tier. */ backends: SyntheticBackend[]; /** Total number of provider backends offering this model. */ backendCount: number; /** Number of backends for which the user has configured API keys. */ keyedBackendCount: number; } type SyntheticCatalogAccessor = () => readonly CanonicalModel[]; type BenchmarkLookup = (modelId: string) => BenchmarkEntry | undefined; /** * Returns backend count metadata for a synthetic model ID. * Used by the model picker to display provider availability. * * @returns Object with backendCount, keyedBackendCount, and tier, or null if not found. */ export declare function getSyntheticModelInfo(modelId: string, getCatalogModels: SyntheticCatalogAccessor): { backendCount: number; keyedBackendCount: number; tier: SyntheticTier; } | null; export declare class SyntheticProvider implements LLMProvider { readonly name = "synthetic"; readonly credentialAuthority: "anonymous"; /** * The `models` getter below is intentionally secondary, this provider's * real selectable models are sourced from the shared, independently * refreshed model catalog (`getCatalogModels`) plus the `best-free` alias, * exactly the `catalog-backed` case the model-source contract * (`model-source-contract.ts`) documents this provider as the canonical * example of. */ readonly modelSource: ProviderModelSource; private readonly getCatalogModels; private readonly getBenchmarks; private readonly runtimeBus; /** Returns a live snapshot of canonical model IDs each time it is accessed. */ get models(): string[]; private cooldowns; private activeBackend; private readonly resolveProvider; constructor(options: { resolveProvider: (providerName: string) => LLMProvider; getCatalogModels: SyntheticCatalogAccessor; getBenchmarks: BenchmarkLookup; runtimeBus?: RuntimeEventBus | null | undefined; }); chat(params: ChatRequest): Promise; } export {}; //# sourceMappingURL=synthetic.d.ts.map