Interface: IModelRegistryCache
Makaio Framework / services-core / IModelRegistryCache
Interface: IModelRegistryCache
Section titled “Interface: IModelRegistryCache”Defined in: ../../../packages/services/core/src/model-registry/types.ts:45
Storage interface for model registry cache persistence.
Allows for different implementations across environments:
- Browser: localStorage
- Node.js: File system cache
- Testing: In-memory cache
Examples
Section titled “Examples”class LocalStorageRegistryCache implements IModelRegistryCache { async get(): Promise<ModelRegistry | null> { const data = localStorage.getItem('makaio:model-registry'); return data ? JSON.parse(data) : null; }
async set(registry: ModelRegistry): Promise<void> { localStorage.setItem('makaio:model-registry', JSON.stringify(registry)); }}class FileRegistryCache implements IModelRegistryCache { async get(): Promise<ModelRegistry | null> { try { const content = await fs.readFile('~/.makaio/cache/model-registry.json', 'utf-8'); return JSON.parse(content); } catch { return null; } }
async set(registry: ModelRegistry): Promise<void> { await fs.writeFile('~/.makaio/cache/model-registry.json', JSON.stringify(registry)); }}Methods
Section titled “Methods”get():
Promise<{$schema:"makaio/model-registry/v2";labs:Record<string, {models:object[];name:string; }>;providers:Record<string, {models:Record<string, {canonicalModel?:string;contextWindowSize?:number;family?:string;friendlyName?:string;labId?:undefined;metadata?: {capabilities?: {parallelToolCalls?: …;pdfUpload?: …;speechToText?: …;structuredOutput?: …;textToSpeech?: …;toolCalling?: …;vision?: …; };description?:string;includedInSubscription?:boolean;maxOutputTokens?:number;pricing?: {request?: …;token?: …; }; };name?:undefined;supportedReasoningLevels?: {extra-high?:string|number;high?:string|number;low?:string|number;medium?:string|number;none?:string|number; }; }>;name:string; }>;updatedAt:string; } |null>
Defined in: ../../../packages/services/core/src/model-registry/types.ts:50
Get the cached model registry.
Returns
Section titled “Returns”Promise<{ $schema: "makaio/model-registry/v2"; labs: Record<string, { models: object[]; name: string; }>; providers: Record<string, { models: Record<string, { canonicalModel?: string; contextWindowSize?: number; family?: string; friendlyName?: string; labId?: undefined; metadata?: { capabilities?: { parallelToolCalls?: …; pdfUpload?: …; speechToText?: …; structuredOutput?: …; textToSpeech?: …; toolCalling?: …; vision?: …; }; description?: string; includedInSubscription?: boolean; maxOutputTokens?: number; pricing?: { request?: …; token?: …; }; }; name?: undefined; supportedReasoningLevels?: { extra-high?: string | number; high?: string | number; low?: string | number; medium?: string | number; none?: string | number; }; }>; name: string; }>; updatedAt: string; } | null>
The cached registry, or null if not cached
set(
registry):Promise<void>
Defined in: ../../../packages/services/core/src/model-registry/types.ts:56
Save the model registry to cache.
Parameters
Section titled “Parameters”registry
Section titled “registry”The registry to cache
$schema
Section titled “$schema”"makaio/model-registry/v2" = ...
Schema version identifier — must be 'makaio/model-registry/v2'.
Record<string, { models: object[]; name: string; }> = ...
Map of lab identifiers to their canonical model definitions. Key is the lab id (e.g., ‘anthropic’, ‘openai’, ‘google’, ‘meta’).
providers
Section titled “providers”Record<string, { models: Record<string, { canonicalModel?: string; contextWindowSize?: number; family?: string; friendlyName?: string; labId?: undefined; metadata?: { capabilities?: { parallelToolCalls?: boolean; pdfUpload?: boolean; speechToText?: { modes: …; vocabularyBiasing?: …; }; structuredOutput?: boolean; textToSpeech?: { modes: …; outputFormats?: …; voiceInstructions?: …; voiceSelection?: …; }; toolCalling?: boolean; vision?: boolean; }; description?: string; includedInSubscription?: boolean; maxOutputTokens?: number; pricing?: { request?: { multiplier: …; }; token?: { cacheWritePerMillion?: …; inputCachedPerMillion?: …; inputPerMillion: …; outputPerMillion: …; }; }; }; name?: undefined; supportedReasoningLevels?: { extra-high?: string | number; high?: string | number; low?: string | number; medium?: string | number; none?: string | number; }; }>; name: string; }> = ...
Map of provider identifiers to their serving-specific model overrides. Key is the provider id (e.g., ‘anthropic’, ‘z-ai’, ‘openrouter’).
updatedAt
Section titled “updatedAt”string = ...
ISO 8601 timestamp of last registry update.
Returns
Section titled “Returns”Promise<void>