Best practices for building an AI chatbot with Next.js and Vercel AI SDK

Hi everyone! I’m planning to build a full-featured AI chatbot application using Next.js, the Vercel AI SDK, and maybe LangChain or custom model integration. I’d love to hear from folks who’ve done this before.

Questions

  • What architecture works best for chatbots on Vercel (Serverless Functions vs Edge)?
  • Performance-optimization tips for streaming responses?
  • How do you handle conversation history and persistence?
  • Suggestions for reducing API costs?

Thanks in advance!

We have a whole set of guides including chatbot examples here that answer all of your questions