<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-build-an-ai-chat-app-interface-with-the-vercel-ai-sdk-and-shadcn-ui-uvld4e08o" -->

---
title: How to Build an AI Chat App Interface With the Vercel AI...
description: A hands-on tutorial walks through building a streaming AI chat interface with Next.js, the Vercel AI SDK, and shadcn/ui. It covers scaffolding the app,...
canonical: https://daily.dev/posts/how-to-build-an-ai-chat-app-interface-with-the-vercel-ai-sdk-and-shadcn-ui-uvld4e08o
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to Build an AI Chat App Interface With the Vercel AI SDK and Shadcn/ui | daily.dev
og:description: A hands-on tutorial walks through building a streaming AI chat interface with Next.js, the Vercel AI SDK, and shadcn/ui. It covers scaffolding the app,...
og:url: https://daily.dev/posts/how-to-build-an-ai-chat-app-interface-with-the-vercel-ai-sdk-and-shadcn-ui-uvld4e08o
og:image: https://api.daily.dev/og/posts/UVld4e08o.png
og:image:alt: How to Build an AI Chat App Interface With the Vercel AI SDK and Shadcn/ui
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Build an AI Chat App Interface With the Vercel AI SDK and Shadcn/ui

**[freeCodeCamp](https://daily.dev/sources/freecodecamp)** · 15 min read · 1 upvotes · 0 comments

## Summary

A hands-on tutorial walks through building a streaming AI chat interface with Next.js, the Vercel AI SDK, and shadcn/ui. It covers scaffolding the app, installing an OpenAI-compatible provider for multi-model support, wiring up the useChat hook for streaming responses, adding tool calling (a weather function), and prototyping the UI without a live backend using a shadcn AI SDK helper package. It also touches on production concerns like rate limiting, abort handling, error boundaries, and auth, and points to an MCP server and paid Shadcn Space templates/blocks for speeding up development.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.freecodecamp.org/news/how-to-build-an-ai-chat-app-interface-with-the-ai-sdk>

## Questions this post answers

### How do I stream chat responses in Next.js using the Vercel AI SDK?

Create an API route that calls streamText from the ai package with a model provider and convertToModelMessages, then return result.toUIMessageStreamResponse(). On the client, use the useChat hook from @ai-sdk/react with a DefaultChatTransport pointed at that route to render messages as they stream token by token.

_daily.dev surfaces implementation walkthroughs like this for developers wiring up streaming AI chat features._

### How can I support multiple LLM providers like OpenAI, Gemini, and Groq without changing my chat API route code?

Use the @ai-sdk/openai-compatible package's createOpenAICompatible function, which works against any OpenAI-style API by swapping the base URL. Define a map of providers (OpenAI, Gemini, Groq) with their baseURL and model name, then select one at runtime via an AI_PROVIDER environment variable so the route handler itself never changes.

_Developers comparing model providers can track patterns like this through daily.dev when deciding on an AI stack._

### How do I let an AI model call custom functions like a weather lookup in a chat app?

Define a tools object in the streamText call from the Vercel AI SDK, giving each tool a description, an inputSchema built with jsonSchema, and an execute function. The model decides when to call the tool, the SDK routes the call to execute, and the result streams back into the conversation as a message part without extra client-side plumbing.

_daily.dev helps developers solving tool-calling integration issues keep up with AI SDK patterns like this._

## Similar posts on daily.dev

- [Next.js AI Streaming: Building Real-Time Apps with Vercel AI SDK](https://daily.dev/posts/next-js-ai-streaming-building-real-time-apps-with-vercel-ai-sdk-yrhbezzlx) · SitePoint · 1 upvotes · 0 comments
- [Real-time AI in Next.js: How to stream responses with the Vercel AI SDK](https://daily.dev/posts/real-time-ai-in-next-js-how-to-stream-responses-with-the-vercel-ai-sdk-8weaohrh4) · LogRocket · 1 upvotes · 0 comments
- [Launch a Chat UI Agent With Docker & Vercel AI SDK](https://daily.dev/posts/launch-a-chat-ui-agent-with-docker-vercel-ai-sdk-mp5bxmrdb) · Docker · 2 upvotes · 0 comments
- [How to build AI-ready Nuxt apps in 2026](https://daily.dev/posts/how-to-build-ai-ready-nuxt-apps-in-2026-7nz9odq0r) · LogRocket · 0 upvotes · 0 comments
- [Chat SDK brings agents to your users](https://daily.dev/posts/chat-sdk-brings-agents-to-your-users-vikosbqz8) · Vercel · 25 upvotes · 0 comments

---

Tags: [#react](https://daily.dev/tags/react), [#nextjs](https://daily.dev/tags/nextjs), [#mcp](https://daily.dev/tags/mcp), [#shadcn](https://daily.dev/tags/shadcn)

[View this post on daily.dev](https://daily.dev/posts/how-to-build-an-ai-chat-app-interface-with-the-vercel-ai-sdk-and-shadcn-ui-uvld4e08o)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to Build an AI Chat App Interface With the Vercel AI SDK and Shadcn/ui","url":"https://daily.dev/posts/how-to-build-an-ai-chat-app-interface-with-the-vercel-ai-sdk-and-shadcn-ui-uvld4e08o","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-build-an-ai-chat-app-interface-with-the-vercel-ai-sdk-and-shadcn-ui-uvld4e08o"},"datePublished":"2026-09-11T18:23:05.776Z","dateModified":"2026-10-15T02:22:53.650Z","description":"A hands-on tutorial walks through building a streaming AI chat interface with Next.js, the Vercel AI SDK, and shadcn/ui. It covers scaffolding the app,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c88945a39687455302840b38ddfd4ea2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c88945a39687455302840b38ddfd4ea2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"freeCodeCamp","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"freeCodeCamp","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1628412854/logos/freecodecamp","url":"https://daily.dev/sources/freecodecamp"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-build-an-ai-chat-app-interface-with-the-vercel-ai-sdk-and-shadcn-ui-uvld4e08o","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"react,nextjs,mcp,shadcn","timeRequired":"PT15M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"freeCodeCamp","item":"https://daily.dev/sources/freecodecamp"},{"@type":"ListItem","position":3,"name":"How to Build an AI Chat App Interface With the Vercel AI SDK and Shadcn/ui"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-build-an-ai-chat-app-interface-with-the-vercel-ai-sdk-and-shadcn-ui-uvld4e08o#faq","mainEntity":[{"@type":"Question","name":"How do I stream chat responses in Next.js using the Vercel AI SDK?","acceptedAnswer":{"@type":"Answer","text":"Create an API route that calls streamText from the ai package with a model provider and convertToModelMessages, then return result.toUIMessageStreamResponse(). On the client, use the useChat hook from @ai-sdk/react with a DefaultChatTransport pointed at that route to render messages as they stream token by token. daily.dev surfaces implementation walkthroughs like this for developers wiring up streaming AI chat features."}},{"@type":"Question","name":"How can I support multiple LLM providers like OpenAI, Gemini, and Groq without changing my chat API route code?","acceptedAnswer":{"@type":"Answer","text":"Use the @ai-sdk/openai-compatible package's createOpenAICompatible function, which works against any OpenAI-style API by swapping the base URL. Define a map of providers (OpenAI, Gemini, Groq) with their baseURL and model name, then select one at runtime via an AI_PROVIDER environment variable so the route handler itself never changes. Developers comparing model providers can track patterns like this through daily.dev when deciding on an AI stack."}},{"@type":"Question","name":"How do I let an AI model call custom functions like a weather lookup in a chat app?","acceptedAnswer":{"@type":"Answer","text":"Define a tools object in the streamText call from the Vercel AI SDK, giving each tool a description, an inputSchema built with jsonSchema, and an execute function. The model decides when to call the tool, the SDK routes the call to execute, and the result streams back into the conversation as a message part without extra client-side plumbing. daily.dev helps developers solving tool-calling integration issues keep up with AI SDK patterns like this."}}]}
```

