lib/ai/models.ts. The app uses a custom provider built on top of the Vercel AI SDK to group models under stable internal identifiers, decoupling the rest of the codebase from specific upstream model names.
Model registry
ThemyProvider object registers every model the app can use:
lib/ai/models.ts
Language models
| Internal ID | Upstream model | Purpose |
|---|---|---|
chat-model-small | gpt-4o-mini | Default model for everyday conversations. Fast and cost-efficient. |
chat-model-large | gpt-4o | Full-size model for complex, multi-step tasks. |
chat-model-reasoning | deepseek-r1 (via Fireworks) | Step-by-step reasoning for problems that benefit from chain-of-thought. |
title-model | gpt-4-turbo | Auto-generates a short title for each new chat. Not user-selectable. |
artifact-model | gpt-4o-mini | Generates documents and code artifacts in the artifact panel. Not user-selectable. |
chat-model-small, chat-model-large, chat-model-reasoning) are defined in the chatModels array, which drives the model selector component:
lib/ai/models.ts
Image models
| Internal ID | Upstream model | Characteristics |
|---|---|---|
small-model | dall-e-2 | Faster generation, lower cost. |
large-model | dall-e-3 | Higher quality, supports more detailed prompts. |
Reasoning middleware
Thechat-model-reasoning model wraps DeepSeek R1 with extractReasoningMiddleware. This middleware strips the model’s internal <think>...</think> chain-of-thought from the streamed output before it reaches the UI, while still making the reasoning trace available separately.
Using
chat-model-reasoning requires a valid FIREWORKS_API_KEY in your environment. See Environment variables.Changing the default model
TheDEFAULT_CHAT_MODEL constant controls which model is pre-selected when a user starts a new chat:
lib/ai/models.ts
'chat-model-small' with any other user-facing model ID:
'chat-model-small', 'chat-model-large', and 'chat-model-reasoning'.
Swapping to a different upstream model
To point an internal ID at a different upstream model, edit the corresponding entry inmyProvider. For example, to upgrade chat-model-small to a newer OpenAI model: