import { type GateBase } from './models.js'; import { MODEL_REGISTRY, type ModelId, type ModelEntry, type SupportedModel, type Provider } from './model-registry.js'; /** * Build-time snapshot of the model registry, baked in at publish. * * Use it for compile-time things — it is what `ModelId` is derived from. * Do NOT read its pricing or capabilities at runtime: those are frozen * at publish and drift as the platform changes. `Verlon#models()` * returns the live registry and is the correct source for anything * behavioural. */ export { MODEL_REGISTRY }; export type { SupportedModel, Provider }; /** * A model a gate can point at: any id in the build-time registry, with * autocomplete — or any string. * * `MODEL_REGISTRY` is a snapshot baked in when this package was * published, so it necessarily lags the live platform. A model that * shipped after the last publish is perfectly routable but absent from * the union, and a strict type would reject config for a model the API * happily serves. That is a packaging artifact, not a real constraint, * and it should not block a caller. * * `(string & {})` is the standard trick for this: it widens the type to * `string` for assignability while leaving the literal union intact for * editor suggestions, so known models still autocomplete. * * Deliberately NOT applied to `SupportedModel`, which stays a strict * union — around nineteen files inside this monorepo type against it and * rely on it to catch model-name typos. Use `ModelId` where you want * exhaustiveness. */ export type ModelRef = ModelId | (string & {}); export type { ModelId }; /** * The live registry as returned by `GET /v1/registry`, which is what * `Verlon#models()` resolves to. * * Keyed by model id like the baked-in `MODEL_REGISTRY`, but sourced from * the platform at call time, so it includes models published after this * package was — and carries current pricing rather than a snapshot's. * Entries are typed loosely because the platform may add fields this * package predates; narrow with `ModelEntry` when the build-time shape * is enough. */ export interface ModelRegistrySnapshot { /** Registry version, e.g. `'2026-08-03'`. */ version: string; /** ISO timestamp the platform generated this view. */ generatedAt: string; models: Record>; metadata: { totalModels: number; lastSync: string; }; } /** * The model fields a caller supplies, widened to `ModelRef`. * * Only the REQUEST types are widened. `GateBase`/`Gate` keep the strict * `SupportedModel`, because the platform's own code manipulates those * and relies on the union to catch model-name typos — loosening them * would trade real internal safety for a packaging artifact. */ type ModelFieldsAsRefs = { model: ModelRef; fallbackModels?: ModelRef[]; }; /** * Gate creation request * Uses all fields from GateBase (name and model required, rest optional), * except the model fields accept any id the live platform serves — see * {@link ModelRef}. */ export type CreateGateRequest = Omit & ModelFieldsAsRefs; /** * Gate update request * All fields optional for partial updates (except can't change name) */ export type UpdateGateRequest = Partial & ModelFieldsAsRefs>; export interface GateWithAnalytics { id: string; userId: string; name: string; model: SupportedModel | null; createdAt: Date; updatedAt: Date; requestCount: number; totalCost: number; successRate: number; } //# sourceMappingURL=gates.d.ts.map