AI Models
The supported models, how to switch models per agent, and how to add new providers.
The Model Registry
All supported models are defined in lib/ai/models.ts. Models are resolved via the Vercel AI SDK using the @ai-sdk/openai and @ai-sdk/anthropic provider packages.
export const SUPPORTED_MODELS = [
{ id: "gpt-4o", label: "GPT-4o", provider: "openai" },
{ id: "gpt-4o-mini", label: "GPT-4o mini", provider: "openai" },
{ id: "claude-sonnet-4-6", label: "Claude Sonnet", provider: "anthropic" },
{ id: "claude-haiku-4-5-20251001", label: "Claude Haiku", provider: "anthropic" },
] as const;
export const DEFAULT_MODEL_ID = "gpt-4o";resolveModel(modelId?)
Used by all agents that accept a modelId parameter:
export function resolveModel(modelId?: string): LanguageModel {
const found = SUPPORTED_MODELS.find((m) => m.id === modelId);
const safe = found ?? SUPPORTED_MODELS[0]; // fallback to gpt-4o
if (safe.provider === "anthropic") {
return anthropic(safe.id as string);
}
return openai(safe.id as string);
}If modelId is undefined or not found in the registry, it falls back to gpt-4o.
Per-Request Model Selection
The chat route accepts a modelId in the request body:
POST /api/assistant/router
{ messages, conversationId, agentId, modelId: "claude-sonnet-4-6" }executeAgent() passes modelId to agents that support it (reel-generator, script-writer, thumbnail-creator, receipt-scanner, legal-analyzer).
The content-creation agent and orchestrator always use hardcoded models and ignore modelId.
The Orchestrator Model
The orchestrator always uses openai("gpt-4o-mini") hardcoded — this is intentional. Routing calls need to be sub-100ms and cost near nothing. Do not change this to a larger model.
Adding a New Model
Add to SUPPORTED_MODELS
{ id: "gpt-4.1", label: "GPT-4.1", provider: "openai" }Add the API key (if new provider)
Install the provider SDK (@ai-sdk/google, etc.) and add the key to env.mjs and .env. See the Vercel AI SDK provider list for all supported providers.
Update resolveModel() (if new provider)
if (safe.provider === "google") {
return google(safe.id as string);
}The Anthropic API key (ANTHROPIC_API_KEY) is optional — only required if you enable Claude models. OpenAI is always required. Get your keys at platform.openai.com and console.anthropic.com.