import type { DiscoveredServer } from '../discovery/index.js'; import { HelperModel, type HelperModelDeps } from '../config/helper-model.js'; import { type BenchmarkStore, type ModelBenchmarks, type QualityTier } from './model-benchmarks.js'; import type { CatalogModelPricing, MinimalModelDefinition, SyntheticModelInfo } from './model-catalog.js'; import type { ProviderModelPricing } from './model-limits.js'; import type { ResolvedModelPricing } from './model-pricing.js'; import type { LiveModelDiscoveryResult } from './live-model-discovery.js'; import type { FavoritesStore } from './favorites.js'; import type { LLMProvider, ProviderRuntimeMetadata } from './interface.js'; import type { ModelDefinition } from './registry-types.js'; import { type ProviderRuntimeSnapshot, type ProviderUsageSnapshot } from './runtime-snapshot.js'; export interface ProviderApiModelReference { readonly modelId: string; readonly providerId: string; readonly registryKey: string; } export interface ProviderApiFavoriteState { readonly pinned: boolean; readonly recent: boolean; readonly pinnedAt?: string | undefined; readonly lastUsed?: string | undefined; readonly useCount?: number | undefined; } export interface ProviderApiSyntheticRouting { readonly backendCount: number; readonly keyedBackendCount: number; readonly tier: string; readonly bestCompositeScore: number | null; } export interface ProviderApiModelRouting { readonly kind: 'direct' | 'synthetic'; readonly failoverStrategy: 'none' | 'synthetic-wrapper' | 'same-tier-provider' | 'intra-synthetic'; readonly alternative?: ProviderApiModelReference | undefined; readonly synthetic?: ProviderApiSyntheticRouting | undefined; } export interface ProviderApiCatalogBenchmarkRecord extends ProviderApiModelReference { readonly kind: 'catalog'; readonly available: boolean; readonly displayName?: string | undefined; readonly organization: string; readonly sourceName: string; readonly benchmarks: ModelBenchmarks; readonly compositeScore: number | null; readonly qualityTier: QualityTier; } export interface ProviderApiSyntheticBenchmarkRecord extends ProviderApiModelReference { readonly kind: 'synthetic'; readonly available: boolean; readonly displayName?: string | undefined; readonly backendCount: number; readonly keyedBackendCount: number; readonly tier: string; readonly compositeScore: number | null; readonly qualityTier?: QualityTier | undefined; } export type ProviderApiBenchmarkRecord = ProviderApiCatalogBenchmarkRecord | ProviderApiSyntheticBenchmarkRecord; export interface ProviderApiModelRecord extends ProviderApiModelReference { readonly displayName: string; readonly description: string; readonly selectable: boolean; readonly current: boolean; readonly capabilities: ModelDefinition['capabilities']; readonly contextWindow: number; readonly tier?: ModelDefinition['tier'] | undefined; /** * The selectable reasoning levels for this exact model. A plain list on this * record on purpose: the wire-shape detail lives on `ModelDefinition`'s * `ReasoningEffortSpec`, and consumers of this record only need the choices. */ readonly reasoningEffort?: readonly string[] | undefined; readonly favorite: ProviderApiFavoriteState; readonly benchmark?: ProviderApiBenchmarkRecord | undefined; readonly routing: ProviderApiModelRouting; } export interface ProviderApiFavoriteRecord { readonly registryKey: string; readonly available: boolean; readonly modelId?: string | undefined; readonly providerId?: string | undefined; readonly displayName?: string | undefined; readonly pinnedAt?: string | undefined; readonly lastUsed?: string | undefined; readonly useCount?: number | undefined; } export interface ProviderApiFavoritesSnapshot { readonly pinned: readonly ProviderApiFavoriteRecord[]; readonly recent: readonly ProviderApiFavoriteRecord[]; } export interface ProviderApiModelQuery { readonly providerId?: string | undefined; readonly selectableOnly?: boolean | undefined; readonly favorites?: 'all' | 'pinned' | 'recent' | undefined; } export interface ProviderApiBenchmarkQuery { readonly registryKeys?: readonly string[] | undefined; readonly limit?: number | undefined; } export interface ProviderApiCatalogRefreshResult { readonly modelCount: number; readonly providerCount: number; } export interface ProviderApiLiveModelRefreshReport extends LiveModelDiscoveryResult { readonly providerId: string; } export type ProviderApiRuntimeQuery = { readonly scope: 'all'; } | { readonly scope: 'provider'; readonly providerId: string; } | { readonly scope: 'usage'; readonly providerId: string; }; export type ProviderApiRuntimeQueryResult = { readonly scope: 'all'; readonly snapshots: readonly ProviderRuntimeSnapshot[]; } | { readonly scope: 'provider'; readonly snapshot: ProviderRuntimeSnapshot | null; } | { readonly scope: 'usage'; readonly snapshot: ProviderUsageSnapshot | null; }; export interface ProviderApi { listProviderIds(): readonly string[]; getCurrentModel(): Promise; listModels(query?: ProviderApiModelQuery): Promise; selectModel(registryKey: string): Promise; registerDiscoveredProviders(servers: readonly DiscoveredServer[]): Promise; refreshCatalog(): Promise; /** * Re-check live model discovery for one provider (or all providers that * support it when omitted). This is the registry-level hook a picker-open * handler or an explicit user "refresh models" command calls, routine * background refreshes respect each provider's on-disk TTL cache; * `force: true` bypasses it for an explicit user-triggered check. */ refreshLiveModelDiscovery(providerId?: string, options?: { force?: boolean; }): Promise; refreshBenchmarks(): Promise; refreshModelLimits(): Promise; getFavorites(): Promise; pinModel(registryKey: string): Promise; unpinModel(registryKey: string): Promise; recordModelUsage(registryKey: string): Promise; listBenchmarks(query?: ProviderApiBenchmarkQuery): Promise; queryRuntimeMetadata(query: ProviderApiRuntimeQuery): Promise; createHelperModel(configManager: HelperModelDeps['configManager']): HelperModel; } export interface ProviderApiRegistry { describeRuntime(name: string): Promise; findAlternativeModel(currentRegistryKey: string): ModelDefinition | null; getCostFromCatalog(modelId: string): CatalogModelPricing | null; getPricingForModel(modelId: string, provider: string): ProviderModelPricing | null; resolveModelPricing(modelRef: string, providerId?: string): ResolvedModelPricing; getCatalogModelDefinitions(): readonly MinimalModelDefinition[]; has(id: string): boolean; get?(id: string): LLMProvider | undefined; require(id: string): LLMProvider; tryGet(name: string): LLMProvider | undefined; getCurrentModel(): ModelDefinition; getContextWindowForModel(modelDef: ModelDefinition): number; getForModel(modelId: string, provider?: string): LLMProvider; getRegistered(name: string): LLMProvider; getSelectableModels(): ModelDefinition[]; getSyntheticModelInfoFromCatalog(modelId: string): SyntheticModelInfo | null; listModels(): ModelDefinition[]; listProviders(): readonly LLMProvider[]; registerDiscoveredProviders(servers: DiscoveredServer[]): void; refreshCatalog(): Promise; refreshLiveModelDiscovery(providerId?: string, options?: { force?: boolean; }): Promise>; refreshModelLimits(): Promise; setCurrentModel(registryKey: string): void; } export interface ProviderApiFavoritesStore extends Pick { } export interface ProviderApiBenchmarkStore extends Pick { } export interface ProviderApiDependencies { readonly providerRegistry: ProviderApiRegistry; readonly favoritesStore: ProviderApiFavoritesStore; readonly benchmarkStore: ProviderApiBenchmarkStore; } export declare function createProviderApi(deps: ProviderApiDependencies): ProviderApi; export type { ProviderRuntimeSnapshot, ProviderUsageSnapshot }; //# sourceMappingURL=provider-api.d.ts.map