Documentation
supastarter for Next.jsAI

Overview

Learn how to integrate AI features into your supastarter app.

supastarter is the perfect starting point for building your AI-powered SaaS. It integrates the Vercel AI SDK, which allows you to easily connect to all major AI providers like LangChain, OpenAI, Hugging Face and more.

It also includes a fully working AI chatbot example with a chat history and a context window.

To change the used AI models, simply change the values in the the /packages/ai/index.ts:

import { openai } from "@ai-sdk/openai";
 
export const textModel = openai("gpt-4o-mini");
export const imageModel = openai("dall-e-3");
export const audioModel = openai("whisper-1");

For example, if you want to use Anthropic instead of OpenAI, you can change the textModel variable to:

import { anthropic } from "@ai-sdk/anthropic";
 
export const textModel = anthropic("claude-3-5-sonnet-20240620");

Then when using any of the AI SDK functions, you can pass the model to it:

import { streamText, textModel } from "@repo/ai";
 
const response = streamText({
  model: textModel,
  messages: [
    { role: "user", content: "What is the capital of France?" }
  ]
});

Here are a few guides on how to work with the AI features in your supastarter app:

On this page

No Headings