Guides
AI Shopping Assistant
Learn how to build an AI shopping assistant using Next.js, Vercel AI SDK, and the Subtotal AI Toolkit
Getting started
Let’s build an AI shopping assistant that can analyze real purchases history and make personalized recommendations.
Create an API key for both Subtotal and OpenAI if you haven’t already.
Create a new Next.js project
Create a new Next.js project named with TypeScript and the App Router:
Install dependencies
Install the Subtotal AI Toolkit
and OpenAI AI SDK
packages:
Configure environment variables
Create a .env.local
file and add your API keys:
Create the chat interface
Replace the contents of src/app/page.tsx
with the following code:
Integrate with Subtotal and OpenAI
Create a new file src/app/api/chat/route.ts
and add the following code: