1. Update Model Registry
Purpose: Register a new AI model or change which model backs a quality tier (default/mid/high) by editing the TypeScript model registry directly.
Prerequisites:
- API key for the model's provider set in
.env.local(checkpackages/config/src/index.tsfor the correct env var name, e.g.,GOOGLE_API_KEYnotGOOGLE_GENERATIVE_AI_API_KEY) - Bun installed with
bun installcompleted - Understanding of the model's pricing (input/output per million tokens)
- For tier changes: the target model must already exist in both the code registry and the
ai_modelDB enum
Cost / Duration: ~$1-20 for quality test run | 1-3 hours (including benchmarking)
Prompt
Update the AI model registry in the Eko system.
I need to: [choose one]
A) Add a new model: [specify model ID, provider, and pricing]
B) Change the model for a tier: [specify tier (default/mid/high) and new model ID]
C) Both: add a model and assign it to a tier
Step 1 — Edit the model registry data file:
Open `packages/config/src/model-registry-data.ts`.
For adding a new model:
- Add a new entry to the `MODEL_REGISTRY_DATA` array with:
`model_id`, `provider`, `status`, `input_price`, `output_price`,
and `deprecation_note` (empty string if not deprecated).
- Ensure the entry matches the existing TypeScript type/shape.
Step 1b — Add the model to the `ai_model` DB enum:
The `ai_model` Postgres enum must include the model identifier
before it can be assigned to a tier in `ai_model_tier_config`.
```sql
ALTER TYPE ai_model ADD VALUE IF NOT EXISTS '<model-id>';
```
Apply this via the Supabase MCP `apply_migration` tool or a local
migration file.
For changing a tier assignment:
There are TWO places that control tier-to-model mapping:
- **DB override (authoritative at runtime):** The `ai_model_tier_config`
table. Update directly:
```sql
UPDATE ai_model_tier_config
SET model = '<model-id>'::ai_model
WHERE tier = 'default'; -- or 'mid' or 'high'
```
- **Code fallback:** `DEFAULT_TIER_CONFIG_DATA` in
`packages/config/src/model-registry-data.ts`. This is used when
the DB is unavailable. Update here too for consistency.
Step 2 — Verify TypeScript compiles:
```bash
bun run typecheck
```
Step 3 — Run quality test (for new models):
```bash
bun scripts/seed/llm-fact-quality-testing.ts --all --models <model_id> --limit 50
```
Replace `<model_id>` with the ID you added. This runs 50 fact
extractions to benchmark quality and cost.
Step 4 — Optionally create a ModelAdapter:
If the model needs per-model prompt optimizations, create an adapter at
`packages/ai/src/models/adapters/<model-id>.ts` following the pattern
in existing adapters. Register it in
`packages/ai/src/models/registry.ts` under `ADAPTER_FACTORIES`.
Key references:
- Model registry data: `packages/config/src/model-registry-data.ts`
- Model registry logic: `packages/config/src/model-registry.ts`
- Model router: `packages/ai/src/model-router.ts`
- Adapter interface: `packages/ai/src/models/types.ts`
Verification
- New model entry added to
MODEL_REGISTRY_DATAinpackages/config/src/model-registry-data.ts - Model added to
ai_modelDB enum via migration (for new models) - Tier assignment updated in both
ai_model_tier_config(DB) andDEFAULT_TIER_CONFIG_DATA(code fallback) -
bun run typecheckpasses - Quality test produces a results summary with pass rates and cost per fact (for new models)
- ModelAdapter created and registered (if needed)
- Workers pick up tier change within 60 seconds (DB cache refresh), no restart needed
Related Prompts
- Add New Model Adapter — Scaffold and test a model adapter
- Full Model Adapter Test — Full eligibility pipeline
- Seed the Database — Test new model in a seeding run