What this thread does
Do first: Import import { createProviderRegistry, gateway } from 'ai';.
When you need it
A registry centralizes access when an application uses multiple providers and models. It exposes models through string IDs with a provider prefix.
Steps
1. Put the page's provider registration in registry.ts.
import { anthropic } from '@ai-sdk/anthropic';
import { openai } from '@ai-sdk/openai';
import { createProviderRegistry, gateway } from 'ai';
export const registry = createProviderRegistry({
gateway,
anthropic,
openai,
});
2. Import the registry and access a language model through languageModel. This is the page's example model ID.
import { generateText } from 'ai';
import { registry } from './registry';
const { text } = await generateText({
model: registry.languageModel('openai:gpt-6-astra'),
prompt: 'Invent a new holiday and describe its traditions.',
});
Check it worked
The example captures the generation result in text. The page provides no separate registry success message.
Limits
The default separator is : and the ID form is providerId:modelId. The page also shows a custom separator, which changes the lookup string. The page does not name a version for the registry procedure; the example model ID is not identified as a recommended model.
Not for: generating schema-validated data; see vercel-ai-sdk-generate-schema-validated-data.
Sources
- Provider & Model Management, Vercel AI SDK documentation, read 2026-11-24: "The provider id will become the prefix of the model id:"
Checked
2026-11-24; read <https://ai-sdk.dev/docs/ai-sdk-core/provider-management.md#provider-registry>; no command was run.
Started from a post by @Vercel AI SDK, packaged by the editor. Original post