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 { ModelCapability, ModelConfig, ModelLimits, ModelPricing, ModelProvider, ModelRegistry, ModelRegistryEntry, ModelSelectionCriteria, PromptTemplate, PromptVariable } from '@objectstack/spec/ai';
import type { ModelCapability, ModelConfig, ModelLimits, ModelPricing, ModelProvider, ModelRegistry, ModelRegistryEntry, ModelSelectionCriteria, PromptTemplate, PromptVariable } from '@objectstack/spec/ai';
// Validate data
const result = ModelCapability.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 | Object | ✅ | |
| limits | Object | ✅ | |
| pricing | Object | optional | |
| endpoint | string | optional | Custom API endpoint |
| apiKey | string | optional | API key (Warning: Prefer secretRef) |
| secretRef | string | optional | Reference to stored secret (e.g. system:openai_api_key) |
| region | string | optional | Deployment region (e.g., "us-east-1") |
| description | string | optional | |
| 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 | integer | optional | Maximum output tokens |
| rateLimit | Object | optional | |
| Property | Type | Required | Description |
|---|
| currency | string | ✅ | |
| inputCostPer1kTokens | number | optional | Cost per 1K input tokens |
| outputCostPer1kTokens | number | optional | Cost per 1K output tokens |
| embeddingCostPer1kTokens | number | optional | 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, Object> | ✅ | Model entries by ID |
| promptTemplates | Record<string, Object> | optional | Prompt templates by name |
| defaultModel | string | optional | Default model ID |
| enableAutoFallback | boolean | ✅ | Auto-fallback on errors |
| Property | Type | Required | Description |
|---|
| model | Object | ✅ | |
| status | Enum<'active' | 'deprecated' | 'experimental' | 'disabled'> | ✅ | |
| priority | integer | ✅ | Priority for model selection |
| fallbackModels | string[] | optional | Fallback model IDs |
| healthCheck | Object | optional | |
| Property | Type | Required | Description |
|---|
| capabilities | string[] | optional | Required capabilities |
| maxCostPer1kTokens | number | optional | Maximum acceptable cost |
| minContextWindow | number | optional | 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 | optional | System prompt |
| user | string | ✅ | User prompt template with variables |
| assistant | string | optional | Assistant message prefix |
| variables | Object[] | optional | Template variables |
| modelId | string | optional | Recommended model ID |
| temperature | number | optional | |
| maxTokens | number | optional | |
| topP | number | optional | |
| frequencyPenalty | number | optional | |
| presencePenalty | number | optional | |
| stopSequences | string[] | optional | |
| version | string | ✅ | |
| description | string | optional | |
| category | string | optional | Template category (e.g., "code_generation", "support") |
| tags | string[] | optional | |
| examples | Object[] | optional | |
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Variable name (e.g., "user_name", "context") |
| type | Enum<'string' | 'number' | 'boolean' | 'object' | 'array'> | ✅ | |
| required | boolean | ✅ | |
| defaultValue | any | optional | |
| description | string | optional | |
| validation | Object | optional | |