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 booleanoptional (default: true) Supports text generation textEmbedding booleanoptional (default: false) Supports text embedding imageGeneration booleanoptional (default: false) Supports image generation imageUnderstanding booleanoptional (default: false) Supports image understanding functionCalling booleanoptional (default: false) Supports function calling codeGeneration booleanoptional (default: false) Supports code generation reasoning booleanoptional (default: false) 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 booleanoptional (default: false) recommendedFor string[]optional Use case recommendations
Property Type Required Description textGeneration booleanoptional (default: true) Supports text generation textEmbedding booleanoptional (default: false) Supports text embedding imageGeneration booleanoptional (default: false) Supports image generation imageUnderstanding booleanoptional (default: false) Supports image understanding functionCalling booleanoptional (default: false) Supports function calling codeGeneration booleanoptional (default: false) Supports code generation reasoning booleanoptional (default: false) Supports advanced reasoning
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 stringoptional (default: "USD") inputCostPer1kTokens numberoptional Cost per 1K input tokens outputCostPer1kTokens numberoptional Cost per 1K output tokens embeddingCostPer1kTokens numberoptional Cost per 1K embedding tokens
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 stringoptional (default: "USD") 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 (default: true) 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'>optional (default: "active") priority integeroptional (default: 0) 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 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 (default: "1.0.0") 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 model { id: string; name: string; version: string; provider: Enum<'openai' | 'azure_openai' | 'anthropic' | 'google' | 'cohere' | 'huggingface' | 'local' | 'custom'>; … }✅ status Enum<'active' | 'deprecated' | 'experimental' | 'disabled'>optional (default: "active") priority integeroptional (default: 0) 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 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 booleanoptional (default: false) recommendedFor string[]optional Use case recommendations
Property Type Required Description enabled booleanoptional (default: true) intervalSeconds integeroptional (default: 300) lastChecked stringoptional ISO timestamp status Enum<'healthy' | 'unhealthy' | 'unknown'>optional (default: "unknown")
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 booleanoptional (default: true)
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 (default: "1.0.0") 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'>optional (default: "string") required booleanoptional (default: false) defaultValue anyoptional description stringoptional validation { minLength?: number; maxLength?: number; pattern?: string; enum?: any[] }optional
Property Type Required Description input Record<string, any>✅ Example variable values output string✅ Expected output
Property Type Required Description name string✅ Variable name (e.g., "user_name", "context") type Enum<'string' | 'number' | 'boolean' | 'object' | 'array'>optional (default: "string") required booleanoptional (default: false) defaultValue anyoptional description stringoptional validation { minLength?: number; maxLength?: number; pattern?: string; enum?: any[] }optional