---
title: Model Registry
description: Model Registry protocol schemas
---

{/* ⚠️  AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}

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.

<Callout type="info">
**Source:** `packages/spec/src/ai/model-registry.zod.ts`
</Callout>

## TypeScript Usage

```typescript
import { ModelCapability, ModelConfig, ModelLimits, ModelPricing, ModelProvider, ModelRegistryEntry, ModelSelectionCriteria, PromptVariable } from '@objectstack/spec/ai';
import type { ModelCapability, ModelConfig, ModelLimits, ModelPricing, ModelProvider, ModelRegistryEntry, ModelSelectionCriteria, PromptVariable } from '@objectstack/spec/ai';

// Validate data
const result = ModelCapability.parse(data);
```

---

## ModelCapability

### Properties

| 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 |


---

## ModelConfig

### Properties

| 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 |


---

## ModelLimits

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **maxTokens** | `integer` | ✅ | Maximum tokens per request |
| **contextWindow** | `integer` | ✅ | Context window size |
| **maxOutputTokens** | `integer` | optional | Maximum output tokens |
| **rateLimit** | `Object` | optional |  |


---

## ModelPricing

### Properties

| 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 |


---

## ModelProvider

### Allowed Values

* `openai`
* `azure_openai`
* `anthropic`
* `google`
* `cohere`
* `huggingface`
* `local`
* `custom`


---

## ModelRegistryEntry

### Properties

| 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 |  |


---

## ModelSelectionCriteria

### Properties

| 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` | ✅ |  |


---

## PromptVariable

### Properties

| 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 |  |


---

