Model Registry Model Registry protocol schemas
AI Model Registry Protocol
Centralized registry for managing AI models, prompt templates, and model versioning.
Enables AI-powered ObjectStack applications to discover and use LLMs consistently.
Source: packages/spec/src/ai/model-registry.zod.ts
import { ModelCapabilitySchema, ModelConfigSchema, ModelLimitsSchema, ModelPricingSchema, ModelProviderSchema, ModelRegistrySchema, ModelRegistryEntrySchema, ModelSelectionCriteriaSchema, PromptTemplateSchema, PromptVariableSchema } from '@objectstack/spec/ai' ;
import type { ModelCapability, ModelConfig, ModelLimits, ModelPricing, ModelProvider, ModelRegistry, ModelRegistryEntry, ModelSelectionCriteria, PromptTemplate, PromptVariable } from '@objectstack/spec/ai' ;
// Validate data
const result = ModelCapabilitySchema. parse (data);
Property Type Required Description textGeneration boolean✅ Supports text generation textEmbedding boolean✅ Supports text embedding imageGeneration boolean✅ Supports image generation imageUnderstanding boolean✅ Supports image understanding functionCalling boolean✅ Supports function calling codeGeneration boolean✅ Supports code generation reasoning boolean✅ Supports advanced reasoning
Property Type Required Description id string✅ Unique model identifier name string✅ Model display name version string✅ Model version (e.g., "gpt-4-turbo-2024-04-09") provider Enum<'openai' | 'azure_openai' | 'anthropic' | 'google' | 'cohere' | 'huggingface' | 'local' | 'custom'>✅ capabilities { textGeneration: boolean; textEmbedding: boolean; imageGeneration: boolean; imageUnderstanding: boolean; … }✅ limits { maxTokens: integer; contextWindow: integer; maxOutputTokens?: integer; rateLimit?: object }✅ pricing { currency: string; inputCostPer1kTokens?: number; outputCostPer1kTokens?: number; embeddingCostPer1kTokens?: number }optional endpoint stringoptional Custom API endpoint apiKey stringoptional API key (Warning: Prefer secretRef) secretRef stringoptional Reference to stored secret (e.g. system:openai_api_key) region stringoptional Deployment region (e.g., "us-east-1") description stringoptional tags string[]optional Tags for categorization deprecated boolean✅ recommendedFor string[]optional Use case recommendations
Property Type Required Description maxTokens integer✅ Maximum tokens per request contextWindow integer✅ Context window size maxOutputTokens integeroptional Maximum output tokens rateLimit { requestsPerMinute?: integer; tokensPerMinute?: integer }optional
Property Type Required Description currency string✅ inputCostPer1kTokens numberoptional Cost per 1K input tokens outputCostPer1kTokens numberoptional Cost per 1K output tokens embeddingCostPer1kTokens numberoptional Cost per 1K embedding tokens
openai
azure_openai
anthropic
google
cohere
huggingface
local
custom
Property Type Required Description name string✅ Registry name models Record<string, { model: object; status?: Enum<'active' | 'deprecated' | 'experimental' | 'disabled'>; priority?: integer; fallbackModels?: string[]; … }>✅ Model entries by ID promptTemplates Record<string, { id: string; name: string; label: string; system?: string | object; … }>optional Prompt templates by name defaultModel stringoptional Default model ID enableAutoFallback booleanoptional Auto-fallback on errors
Property Type Required Description model { id: string; name: string; version: string; provider: Enum<'openai' | 'azure_openai' | 'anthropic' | 'google' | 'cohere' | 'huggingface' | 'local' | 'custom'>; … }✅ status Enum<'active' | 'deprecated' | 'experimental' | 'disabled'>✅ priority integer✅ Priority for model selection fallbackModels string[]optional Fallback model IDs healthCheck { enabled: boolean; intervalSeconds: integer; lastChecked?: string; status: Enum<'healthy' | 'unhealthy' | 'unknown'> }optional
Property Type Required Description capabilities string[]optional Required capabilities maxCostPer1kTokens numberoptional Maximum acceptable cost minContextWindow numberoptional Minimum context window size provider Enum<'openai' | 'azure_openai' | 'anthropic' | 'google' | 'cohere' | 'huggingface' | 'local' | 'custom'>optional tags string[]optional excludeDeprecated boolean✅
Property Type Required Description id string✅ Unique template identifier name string✅ Template name (snake_case) label string✅ Display name system string | { dialect: Enum<'cel' | 'cron' | 'template'>; source?: string; ast?: any; meta?: object }optional System prompt — supports {{var}} interpolation user string | { dialect: Enum<'cel' | 'cron' | 'template'>; source?: string; ast?: any; meta?: object }✅ User prompt template — supports {{var}} interpolation assistant stringoptional Assistant message prefix variables { name: string; type?: Enum<'string' | 'number' | 'boolean' | 'object' | 'array'>; required?: boolean; defaultValue?: any; … }[]optional Template variables modelId stringoptional Recommended model ID temperature numberoptional maxTokens numberoptional topP numberoptional frequencyPenalty numberoptional presencePenalty numberoptional stopSequences string[]optional version stringoptional description stringoptional category stringoptional Template category (e.g., "code_generation", "support") tags string[]optional examples { input: Record<string, any>; output: string }[]optional
Property Type Required Description name string✅ Variable name (e.g., "user_name", "context") type Enum<'string' | 'number' | 'boolean' | 'object' | 'array'>✅ required boolean✅ defaultValue anyoptional description stringoptional validation { minLength?: number; maxLength?: number; pattern?: string; enum?: any[] }optional