---
{
  "alternates": {
    "x-default": "ai-chatbot-for-nextjs",
    "en": "ai-chatbot-for-nextjs",
    "de": "ki-chatbot-fuer-nextjs",
    "es": "chatbot-ia-para-nextjs",
    "fr": "chatbot-ia-pour-nextjs",
    "ja": "ai-chatbot-nextjs",
    "pt": "chatbot-de-ia-para-nextjs"
  },
  "title": "AI chatbot for Next.js: 8 ways to add one (2026)",
  "slug": "ai-chatbot-for-nextjs",
  "intent": "icp-broad",
  "locale": "en",
  "date": "2026-11-16",
  "updated": "2026-11-16T03:33:20Z",
  "template": "default",
  "excerpt": "Build with the Vercel AI SDK when chat is your product, or add one lazyOnload script when you just need a support bot. Eight options, with Next.js code and prices.",
  "categories": ["Guides"],
  "tags": ["AI chatbot", "website chat", "developer tools", "open source", "API"],
  "readTime": 28,
  "author": 20,
  "reviewer": 4,
  "seo": {
    "title": "AI chatbot for Next.js: 8 ways to add one (2026)",
    "description": "Build with the Vercel AI SDK when chat is your product. For a support bot that answers from your docs, add one lazyOnload script to app/layout.tsx today.",
    "image": "https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/banners/ai-chatbot-for-nextjs-mwip3jnl-7c7091-20261116.png"
  },
  "coverImage": "https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/banners/ai-chatbot-for-nextjs-mwip3jnl-7c7091-20261116.png",
  "coverImageAlt": "Hand-drawn banner with the Next.js logo on a blue blob, a developer at a laptop and a chat window with a bot avatar, a colleague holding a coffee",
  "coverImageWidth": 1536,
  "coverImageHeight": 1024,
  "cta": {
    "variant": "integration",
    "target": "chat-bubble",
    "headline": "Need a support bot for your Next.js app?",
    "subhead": "eesel's chat bubble is one lazyOnload Script in app/layout.tsx. It answers from your docs, help center and site, and hands off by helpdesk ticket or email.",
    "primary": { "label": "Learn more", "action": "learn-more" },
    "secondary": { "label": "Try for free", "action": "signup" }
  },
  "faqs": {
    "heading": "Frequently Asked Questions",
    "type": "blog",
    "answerType": "html",
    "faqs": [
      {
        "question": "What is the best way to add an AI chatbot to Next.js?",
        "answer": "<p>It depends on the job. If the chatbot is a feature of your product, build it with the Vercel AI SDK (<code>useChat</code> plus a route handler) and a chat UI kit. If you want a support bot that answers customers from your docs, embed a hosted widget with one <code>next/script</code> tag instead of building retrieval and handoff yourself. My guide to an <a href=\"https://www.eesel.ai/blog/ai-chatbot-for-website\">AI chatbot for your website</a> covers the second route in more detail.</p>"
      },
      {
        "question": "How do I add a chat widget script in the Next.js App Router?",
        "answer": "<p>Import <code>Script</code> from <code>next/script</code> and render it once in <code>app/layout.tsx</code> with <code>strategy=\"lazyOnload\"</code>. Next.js loads it once and keeps it across client-side navigations. Put the vendor's key in a <code>NEXT_PUBLIC_</code> environment variable and allow the vendor's domain in your Content Security Policy. My explainer on the <a href=\"https://www.eesel.ai/blog/ai-chat-bubble\">AI chat bubble</a> shows what a working widget looks like.</p>"
      },
      {
        "question": "Which next/script strategy should a chatbot use?",
        "answer": "<p><code>lazyOnload</code>. Next.js's own Script docs list chat support plugins as the example for it, because it loads during browser idle time instead of competing with your page. <code>afterInteractive</code> is the default and fits analytics, <code>beforeInteractive</code> is for bot detectors and consent managers, and <code>worker</code> is experimental and does not work with the App Router. If you are comparing vendors, my roundup of <a href=\"https://www.eesel.ai/blog/best-ai-chatbot-for-customer-service\">AI chatbots for customer service</a> is a good start.</p>"
      },
      {
        "question": "Can I build a ChatGPT-style chatbot with the Vercel AI SDK?",
        "answer": "<p>Yes. <code>useChat</code> streams messages into your React UI and a route handler calls <code>streamText</code> on the server. The Vercel chatbot template adds Auth.js, Neon Postgres history and file storage. What it does not give you is retrieval over your help docs or a handoff to a person, which you write yourself. My explainer on <a href=\"https://www.eesel.ai/blog/rag-vs-llm\">RAG versus a plain LLM</a> shows why that matters for a support bot.</p>"
      },
      {
        "question": "Does a chat widget slow down my Next.js site?",
        "answer": "<p>It can. Developers on Hacker News report widgets as the largest script on a page, and one team measured a Microsoft chat widget at 6MB of JavaScript. Loading it with <code>lazyOnload</code> moves the cost to idle time, and a small loader that fetches the rest on demand helps more. Check your own bundle and Lighthouse numbers before and after. My guide to <a href=\"https://www.eesel.ai/blog/how-to-add-live-chat-to-website\">adding live chat to a website</a> has more on placement.</p>"
      },
      {
        "question": "Is there a free AI chatbot for Next.js?",
        "answer": "<p>The libraries are free: the AI SDK, assistant-ui (MIT) and CopilotKit (MIT) cost nothing, but you pay for the model and for hosting. Among hosted widgets, tawk.to has a free AI Assist tier of 100 credits a month, Crisp's free plan has no AI, and eesel's free plan is a 7-day trial of 100 credits. My list of <a href=\"https://www.eesel.ai/blog/free-ai-chatbot\">free AI chatbots</a> covers the usual limits.</p>"
      },
      {
        "question": "How do I pass the logged-in user to a chatbot in Next.js?",
        "answer": "<p>Sign the identity on your server and hand the widget only the signed result. Chatbase takes a JWT you sign in a route handler, and tawk.to uses Secure Mode with an HMAC hash. Tidio's <code>tidioIdentify</code> is set in the browser with no signature step, so treat it as a hint, not proof. eesel's chat bubble docs do not describe signed identity for the floating bubble. For account data, my notes on <a href=\"https://www.eesel.ai/blog/ai-agent-handoff-best-practices\">AI agent handoff</a> explain what a person needs to see.</p>"
      }
    ],
    "supportLink": null
  }
}
---

## TL;DR

Pick by the job. <mark>If the chatbot is your product, build it with the Vercel AI SDK and a chat UI kit.</mark> If you want a support bot that answers customers from your docs, embed a hosted widget with one `lazyOnload` Script in `app/layout.tsx`, which is the use Next.js's own docs name for chat support plugins. The AI SDK gives you streaming, not retrieval or human handoff, so those stay your job. [eesel](https://www.eesel.ai/integrations/chat-bubble) ships exactly that App Router snippet and answers from your help center and site.

## Build or embed: which AI chatbot does your Next.js app need?

I'm Alicia, a software engineer at eesel. I build the product's features and AI agents, so I spend my time on the part of a chatbot a demo never shows: what streaming, retrieval and handoff actually take once real users arrive. Most Next.js posts say "install a library and you're done." That is true for the chat window and false for almost everything behind it. With the [eesel CLI](https://docs.eesel.ai/apis-and-developer-resources/cli), a coding agent like Claude Code or Cursor can run `npx @eesel/cli init chat-bubble --site https://your-app.com`, take the embed snippet it prints and drop it into `app/layout.tsx`, upload your docs and ask test questions before go-live. Connecting a helpdesk for handoff still needs an admin to approve it.

Two very different jobs hide behind the same search. The first is an AI feature that lives inside your product: a copilot, a document Q&A screen, an assistant that reads the user's own records. The second is a [support bot](https://www.eesel.ai/blog/best-ai-chatbot-for-customer-service) that answers customers from your docs and passes the hard ones to a person. The first is a build. The second is almost always an embed.

![Hand-drawn fork: a box asking what the chatbot is for splits into chat is the product, leading to AI SDK, chat UI kit and your own retrieval, and support bot from your docs, leading to one lazyOnload script](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/blog-gen/generated/asset-1794799619424-wlo4hm-20261116.png)

The reason is where the work sits. A chat window is the small part. A bot that is allowed to speak for your company needs knowledge it can retrieve, a way to stop and call a person, and a way to check it before customers see it. Developers who build one say the same thing:

> "I tried to add a simple chatbot widget to a few Next.js projects and ended up surprised by how much work it took with OpenAI ChatKit for something that, from the outside, feels like 'just a chat bubble'."
>
> -- [jacoblarszon, Show HN, Hacker News](https://news.ycombinator.com/item?id=46737093)

That quote comes from the founder of a competing product, so I read it as a builder's claim, not neutral evidence. The Vercel template story is more balanced. One developer built a screening chatbot for a job posting in a few hours, then listed what was left:

> "I had to swap out the auth provider to Google, add a Postgres database for permanent storage, and write an initial prompt, but other than that - the fastest I ever built and deployed something useful."
>
> -- [pashariger, Hacker News](https://news.ycombinator.com/item?id=38838949)

Hours to a working bot is real. It was also a narrow internal use case, not a public support queue. <mark>My rule: build when the chat is the product, embed when the chat is the support desk.</mark> The rest of this post follows that split. The sections below cover the embed mechanics, what building a support bot takes, eight options side by side, and what each one costs.

## How do you add a chat widget script in the Next.js App Router?

Next.js has a first-party answer, and it is short. The [Script component](https://nextjs.org/docs/app/api-reference/components/script) takes a `src` or inline code and a `strategy`. The docs name chat support plugins as the example for `lazyOnload`, which loads during browser idle time. Render the component in `app/layout.tsx` and, per the [Optimizing Scripts guide](https://nextjs.org/docs/app/guides/scripts), it loads for every route and "will only load once" across navigations.

![The Next.js Script component API reference page, with an app/dashboard/page.tsx example and a props table listing src, strategy, onLoad, onReady and onError, as taken from the [Next.js docs](https://nextjs.org/docs/app/api-reference/components/script)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/nextjs-script-docs-20261116.png)

Here is the pattern. The vendor's own snippet goes inside the tag, and the key comes from an environment variable.

```tsx
// app/layout.tsx
import Script from "next/script";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script id="chat-widget" strategy="lazyOnload">
          {`/* paste the vendor's snippet here, reading its id from process.env.NEXT_PUBLIC_CHAT_ID */`}
        </Script>
      </body>
    </html>
  );
}
```

[eesel's chat bubble docs](https://docs.eesel.ai/integrations/chat-surfaces/chat-bubble) show this same shape for the App Router: an `eesel-chat-bubble` Script with `lazyOnload` in `app/layout.tsx`, the trigger id read from `NEXT_PUBLIC_EESEL_TRIGGER_ID`, and a note that preview and local builds can leave it unset and simply show no bubble. For a strict Content Security Policy, the docs say to allow `https://cdn.eesel.ai` for scripts and connections.

Which strategy you pick matters more than people expect. The four options differ in when they run:

| Strategy | When it loads | What Next.js says it is for | Chat widget? |
| --- | --- | --- | --- |
| `beforeInteractive` | Before page code, root layout only | Bot detectors and cookie consent managers | No |
| `afterInteractive` | After some hydration, the default | Tag managers and analytics | Works, but competes with your page |
| `lazyOnload` | During browser idle time | Chat support plugins and social widgets | Yes |
| `worker` | Off the main thread, experimental | Not stable, `pages/` only, needs the `nextScriptWorkers` flag | No |

![Hand-drawn page-load timeline marking beforeInteractive, afterInteractive, lazyOnload with a chat widget bubble above it, and a dashed experimental worker marker](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/blog-gen/generated/asset-1794799618856-jtzsvg-20261116.png)

Two details trip people up. `onLoad` and `onReady` only work in Client Components, so if you need a callback when the widget is ready, move the Script into a small `"use client"` file. And the Optimizing Scripts guide recommends scoping third-party scripts to the pages or layouts that need them, so if the bot only belongs on your marketing and docs routes, put the Script in that route group's layout instead of the root.

Why bother with `lazyOnload` at all? Because widgets get heavy. One developer posted about a Microsoft chat widget that was a "staggering 6MB of pure javascript code," and another one's advice on speed was blunt:

> "Use 'facade' icons instead of loading the 3rd-party chat widget at page load, etc. Delay loading tracking widgets if possible."
>
> -- [leptons, Hacker News](https://news.ycombinator.com/item?id=44617766)

Idle-time loading is the built-in version of that advice. The same pattern shows up on other platforms, and I wrote it up for [Webflow](https://www.eesel.ai/blog/best-ai-chatbot-for-webflow), [Framer](https://www.eesel.ai/blog/how-to-add-an-ai-chatbot-to-framer) and [Wix](https://www.eesel.ai/blog/how-to-add-an-ai-chatbot-to-wix) if you also ship marketing pages there.

## What does building your own support chatbot in Next.js actually take?

Start with what the building blocks give you, because they are good. The [Vercel AI SDK](https://github.com/vercel/ai) (28.0k GitHub stars, current docs at v7) gives you `useChat` for the browser and `streamText` for the server. [vercel/chatbot](https://github.com/vercel/chatbot) (21.1k stars) wraps that in a full app. Both are free to use. What they do not include is the middle layer a support bot lives on.

![Hand-drawn iceberg: only the useChat UI sits above the waterline; route handler, embeddings and pgvector, retrieval and chunking, handoff to a person, test set and monitoring sit below it](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/blog-gen/generated/asset-1794799619253-z7pnt7-20261116.png)

Here is the list, with what the sources actually say:

1. **Retrieval over your docs.** Vercel's [RAG Agent guide](https://ai-sdk.dev/cookbook/guides/rag-chatbot) uses Postgres with pgvector, Drizzle ORM and a starter repo with a `resources` table. You then write the chunking (by sentence), the embeddings and the retrieval yourself. It also needs a Postgres database. My notes on a [support RAG pipeline](https://www.eesel.ai/blog/building-a-support-rag-pipeline-with-langchain) and on [vector databases](https://www.eesel.ai/blog/rag-vs-vector-database-vs-hybrid-search-for-support-ai) cover the same decisions.
2. **Keeping that knowledge fresh.** The template README lists Next.js, AI Gateway models, shadcn/ui, Neon Postgres for history, Vercel Blob for files and Auth.js. It does not list help-center ingestion, knowledge-base sync or helpdesk integration. That is an absence in the README, not a statement that it can't be built.
3. **Handoff to a person.** The same README does not list human handoff. You decide the trigger, the ticket or email that gets created, and what context travels with it. My piece on [human handoff in chat](https://www.eesel.ai/blog/best-practices-for-human-handoff-in-chat-support) lists what a person needs to see.
4. **Evaluation.** Retrieval bots give odd answers in specific ways, and you only learn which by testing. A practitioner on Hacker News who worked on a big company's support chatbot described it this way:

> "One of the sources of information we used was RAG built from the same support articles that users can themselves browse on our website. Sometimes LLMs get hung up on the wrong details."
>
> -- [QuantumNomad_, Hacker News](https://news.ycombinator.com/item?id=50163090)

That is why eesel's rollouts are simulated against historical tickets before they go live, and why I'd build an equivalent test set before launching anything customer-facing. See also my notes on [preventing hallucinations](https://www.eesel.ai/blog/ai-hallucination-prevention-for-support) in support bots.

Then there is the meter. On Vercel, the Pro plan is $20 a month with $20 of included usage credit. Functions on Fluid compute bill Active CPU from $0.128 per hour, provisioned memory from $0.0106 per GB-hour and invocations from $0.60 per million, per the [Vercel pricing page](https://vercel.com/pricing). Model tokens go through AI Gateway at provider list price with "no markup and no platform fee on tokens," per its [pricing docs](https://vercel.com/docs/ai-gateway/pricing). None of that is a bill per chat. The per-chat model cost depends on the model and the length of the conversation, and Vercel's page does not state it, so you have to measure it.

None of this is a reason not to build. It is a reason to be clear about what you are signing up for.

## The 8 options at a glance

| Option | Type | Next.js install route | Official Next.js or React guide? | Open source | Free plan | Starting paid price | Trains on your docs out of the box? | Human handoff | Signed user identity |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| [Vercel AI SDK + chatbot template](https://github.com/vercel/ai) | Framework | `npm install ai`, route handler at `app/api/chat/route.ts` | Yes, Vercel's own docs | Yes, 28.0k and 21.1k stars | Library free; Vercel Hobby $0 | Vercel Pro $20/mo, plus model tokens | No, you build retrieval | Not in the template README | Auth.js in the template |
| [assistant-ui](https://www.assistant-ui.com/) | Chat UI kit | `npx assistant-ui@latest init`, shadcn components | Yes, docs recommend Next.js or Vite | Yes, MIT | Library free; Cloud Free $0 | Cloud Pro $50/mo | No, bring your backend | Not listed | Yours; Cloud adds user-scoped storage |
| [CopilotKit](https://www.copilotkit.ai/) | UI kit and runtime | `@copilotkit/react-core`, route at `app/api/copilotkit` | Yes, quickstart uses Next.js | Yes, MIT | Library free; hosted 1,000 interactions/mo | $49/mo pay as you go | No, quickstart has no knowledge base | Not in quickstart | Yours |
| [eesel chat bubble](https://www.eesel.ai/integrations/chat-bubble) | Hosted widget | `next/script` in `app/layout.tsx` | Yes, App Router snippet in docs | Hosted service | 7-day trial, 100 credits | $299/mo for 500 credits | Yes: site, help center, Drive, Notion, Confluence, helpdesk | Helpdesk ticket, email or live widget | Not documented for the bubble |
| [Chatbase](https://www.eesel.ai/blog/chatbase) | Hosted widget | Embed script, `next/script` (my inference) | No Next.js page | Hosted service | No, 7-day trial | $120/mo yearly, $150 monthly | Yes: site, files, Notion, tickets | Escalation ticket or live chat | Server-signed JWT |
| [Crisp](https://www.eesel.ai/blog/crisp-ai-chatbot) | Hosted widget | `crisp-sdk-web` in a client component | React guide; Next.js named in SPA guide | Hosted service; SDK on GitHub | Free plan, no AI | Mini $45/mo | Yes: snippets, knowledge base, crawl, files | Escalates to operators | Token id plus client-set email |
| [tawk.to](https://www.eesel.ai/blog/tawk-to-alternatives) | Hosted widget | `@tawk.to/tawk-messenger-react` | React guide, Next.js not named | Hosted service; React package on GitHub | Chat free; AI Assist Hobby 100 credits | AI Assist Growth $29/mo | Yes: knowledge base, docs, crawled pages | Escalation, even on free | Secure Mode HMAC |
| [Botpress webchat](https://www.eesel.ai/blog/botpress) | React library plus hosted bot | `@botpress/webchat` | React guide, Next.js not named | Not checked | Free, 100 conversations | Plus $150/mo billed annually | Knowledge base set up in Studio | Built in Studio, not checked | Not checked |

## 1. Vercel AI SDK + Chatbot template

**Best for:** teams for whom chat is the product and who are happy to own retrieval, history and handoff.

![The AI SDK Chatbot docs page showing the useChat hook, its streaming and managed state features, and the start of an app/page.tsx example, as taken from the [AI SDK docs](https://ai-sdk.dev/docs/ai-sdk-ui/chatbot)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/ai-sdk-usechat-docs-20261116.png)

### How it works in Next.js

`npm install ai`, then a client component with `useChat` from `@ai-sdk/react`. Its default transport posts to `/api/chat`, where a route handler calls `streamText` and returns a UI message stream response. Models go through AI Gateway by a model string like `'anthropic/claude-opus-5.5'`, or you install a provider package.

```tsx
// app/page.tsx (shape taken from the AI SDK docs example)
"use client";
import { useChat } from "@ai-sdk/react";
import { DefaultChatTransport } from "ai";
import { useState } from "react";

export default function Page() {
  const [input, setInput] = useState("");
  const { messages, sendMessage, status } = useChat({
    transport: new DefaultChatTransport({ api: "/api/chat" }),
  });
  // render messages, call sendMessage({ text: input }) on submit
}
```

If you'd rather start from a finished app, [vercel/chatbot](https://github.com/vercel/chatbot) is a free open-source template with the App Router, shadcn/ui and Tailwind, Auth.js, Neon Postgres for chat history and Vercel Blob for files.

![The vercel/chatbot GitHub repository page showing 21.1k stars, 6.8k forks, 88 contributors and the app, components and lib folders, as taken from [GitHub](https://github.com/vercel/chatbot)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/vercel-chatbot-template-20261116.png)

### What I liked

It is the most direct route for an in-app AI feature, and the project is very much alive: the repo's last commit was Nov 3, 2026, and a developer on Hacker News called the AI SDK the middle ground between raw provider APIs and heavy frameworks. One of the first things I'd check on any library is how often it ships, and 88 contributors is a good sign.

### Watch out for

The support-bot parts are yours. The README feature list has no help-center ingestion or human handoff, and the RAG guide leaves chunking, embeddings and retrieval to you. You also pick up the Vercel bill described earlier, on top of model tokens.

### Pricing

| Item | Price |
| --- | --- |
| AI SDK and template | Free, open source |
| Vercel Hobby | $0, usage caps, cannot buy more |
| Vercel Pro | $20/mo with $20 usage credit |
| Active CPU | From $0.128/hour |
| AI Gateway tokens | Provider list price, no markup; free tier $5/month credit |

**Verdict:** build with it when chat is the product. For a support bot, you are signing up to build the part that matters.

## 2. assistant-ui

**Best for:** teams who want a polished, customizable chat UI and already have, or will build, their own backend.

![The assistant-ui homepage with the hero The frontend library for AI agents, 13.2k GitHub stars, 3.2M weekly downloads and a live chat demo, as taken from [assistant-ui](https://www.assistant-ui.com/)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/aui-home-20261116.png)

### How it works in Next.js

Run `npx assistant-ui@latest init`, add an `OPENAI_API_KEY` to `.env`, and `npm run dev`. Components install through the shadcn CLI (`npx shadcn@latest add @assistant-ui/thread @assistant-ui/thread-list`) and the package is `@assistant-ui/react`. The docs recommend Next.js or Vite, with shadcn/ui and Tailwind. It plugs into the Vercel AI SDK, LangGraph, LangChain, Google ADK and a few other backends, or your own server.

### What I liked

MIT license, 13,244 GitHub stars with a push on the day I checked, and a homepage that shows 3.2M weekly downloads. It keeps the backend question separate from the UI question, which is the right split.

### Watch out for

The docs and pricing pages I read list no built-in knowledge base, retrieval or human handoff. That is my reading of what is absent, not a vendor statement. Thread persistence is yours unless you buy the hosted tier, and the hosted tier stores conversations; it is not an answer engine or a support inbox.

![The assistant-ui pricing page with the heading Open source UI, hosted persistence when you need it, and the top of the Free, Pro and Enterprise cards, as taken from the [assistant-ui pricing page](https://www.assistant-ui.com/pricing)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/aui-pricing-20261116.png)

### Pricing

| Plan | Price | Included |
| --- | --- | --- |
| Library | Free, MIT | Use in any product |
| assistant-cloud Free | $0 | 200 MAU, thread persistence, history |
| assistant-cloud Pro | $50/mo | 500 MAU, then $0.10 per extra MAU |
| Enterprise | Custom | SLA, on-premises option |

A MAU here is a monthly active user who sends at least one message.

**Verdict:** the best-looking route to a chat window you fully control. It solves the interface, not the answers.

## 3. CopilotKit

**Best for:** teams building an agent that acts inside the app, such as filling forms or calling tools, rather than a Q&A bot.

![The CopilotKit homepage with the headline Connect any agent to any user and a diagram of React, Vue, Slack and WhatsApp connecting to one runtime, as taken from [CopilotKit](https://www.copilotkit.ai/)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/copilotkit-home-20261116.png)

### How it works in Next.js

The [quickstart](https://docs.copilotkit.ai/quickstart) is written for Next.js because it can host the frontend and runtime in one project. You install `@copilotkit/react-core` and `@copilotkit/runtime`, add an API route at `app/api/copilotkit/[[...slug]]/route.ts` with a `CopilotRuntime` and a `BuiltInAgent`, wrap the app in `CopilotKitProvider` and render `CopilotSidebar`. It needs Node.js 20 or newer and `"moduleResolution": "bundler"` in `tsconfig`.

### What I liked

38,717 GitHub stars, MIT, and a clear way to plug in an agent you already have in LangGraph, CrewAI, Mastra, ADK or Pydantic AI. Development, staging and test usage on the hosted tier "is free," which is rare.

### Watch out for

`BuiltInAgent` "calls the model directly," and knowledge, RAG and helpdesk handoff are not in the quickstart. The company now positions the product as an enterprise agent stack, and the hosted tier is called Intelligence on the pricing page. The free chat-UI path is the open-source library with your own runtime.

### Pricing

| Plan | Price | Included |
| --- | --- | --- |
| Library | Free, MIT | Self-hosted runtime |
| Free hosted | $0 | 1,000 interactions per organization each month |
| Pay as you go | $49/mo | First 10,000 interactions, then graduated rates |
| Annual | Custom | Yearly commitment |

An interaction is one request the agent completes successfully.

**Verdict:** pick it for in-app agents. For a customer support bot, it is a toolkit, not the bot.

## 4. eesel chat bubble

**Best for:** a Next.js SaaS that wants a support bot answering from its docs, help center and site, with no retrieval pipeline to build.

![The eesel Chat Bubble documentation page with its Claude Code, Codex or Cursor callout, the npx @eesel/cli init chat-bubble command and the numbered setup steps, as taken from eesel's [documentation](https://docs.eesel.ai/integrations/chat-surfaces/chat-bubble)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/eesel-nextjs-guide-20261116.png)

### How it works in Next.js

This is the one option with an App Router snippet in the vendor's own docs. Render the loader once in `app/layout.tsx` with `next/script` and `strategy="lazyOnload"`, so it survives a client-side page change, and read the trigger id from `NEXT_PUBLIC_EESEL_TRIGGER_ID`. Underneath it is one async script that loads `https://cdn.eesel.ai/loader.js`; the docs say it reads nothing else from your site's code and that updates ship through the loader so the snippet never changes. From your own code, `window.eesel.open()` opens the bubble and `window.eesel.open({ message })` starts a fresh chat with your text as the first line, which is handy for a "Ask about this page" button.

The knowledge side is the part you'd otherwise build. eesel trains on a website crawl, a help center, Google Drive, Notion, Confluence, Zendesk and Freshdesk articles, uploaded files and more, and answers only from the sources you connect. For handoff, it either opens a live widget (Zendesk Messenger or Freshchat once connected) or follows rules you set, such as creating a helpdesk ticket with the visitor's name and email, or sending an email.

![The eesel dashboard Chat Bubble settings page showing Open preview and Copy code buttons, Welcome Message, Title and Agent name fields, as shown in eesel's [documentation](https://docs.eesel.ai/integrations/chat-surfaces/chat-bubble)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/best-ai-chatbot-for-wix/images/eesel-docs-chat-bubble-settings-top-20261115.jpg)

### What I liked

A real example of the setup is [SamCart](https://www.eesel.ai/customers/samcart): one eesel agent works Freshdesk tickets and another runs the website chat bubble, answering from 280 help center articles. The chat asks for a name and email before it answers, so the team can follow up. The bigger-scale example is [SE Ranking](https://www.eesel.ai/customers/se-ranking), where eesel answered first on about 2,100 live chats in a month (8 Aug to 8 Sep 2026) on Zendesk Messenger, drawing on about 14,100 help center pages and 2,700 site pages. Refunds, requests for a person and harder questions go to the team with the customer's details.

### Watch out for

There is no React component or npm widget package; it is a script. The bubble docs describe no signed identity for logged-in users, so I would not use it to answer account-specific questions from the browser alone. The docs also name no domain allow-list, so I wouldn't rely on one. Ticket handoff needs a connected helpdesk. And there is no always-free tier: the free plan is a 7-day trial. eesel is not SOC 2 certified; the Type II audit is in progress.

### Pricing

| Plan | Price | Credits |
| --- | --- | --- |
| Free | $0 | 100 credits, 7 days, no card |
| Teammate | $299/mo | 500 |
| Teammate | $499/mo | 1,000 |
| Teammate | $1,749/mo | 5,000 |

A chat is 1 credit however long it runs. There is no per-seat price, overage is optional at $0.80 per extra credit up to a cap you set, and credits do not roll over. Pricing is on the [eesel pricing page](https://www.eesel.ai/pricing).

**Verdict:** my pick when the bot is for customer questions. The deciding factor is that retrieval, handoff and testing are already built.

## 5. Chatbase

**Best for:** teams that want a trained support bot and need a vendor-documented route for signing in the logged-in user.

![Chatbase's Identity Verification developer guide, covering JWT and user hash methods and the prerequisite of an installed embed script, as taken from [Chatbase's docs](https://www.chatbase.co/docs/developer-guides/website-integration/identity-verification)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/chatbase-nextjs-guide-20261116.png)

### How it works in Next.js

Chatbase has no Next.js or React guide; its docs index lists guides for Webflow, WordPress, Wix, Framer and Bubble and no React package. The install is an embed script from Channels > Chat Bubble > Deploy > Website widget. On Next.js that maps to a `next/script` in the root layout, which is my inference, not a Chatbase instruction. The docs say the embed "loads asynchronously."

Identity is the detail that stands out. A JWT is signed on your server with the agent's secret key, only `user_id` or `sub` is required, and you call `window.chatbase("identify", { token, name, ... })` in the browser. In Next.js I'd sign the token in a route handler or server action and keep the secret in an environment variable. Identity verification only works with the website widget, not the iframe embed.

### What I liked

Server-signed identity means the bot can safely use account data, and [Chatbase](https://www.eesel.ai/blog/chatbase-review) trains on website pages, files, Notion and closed tickets. Handoff has two routes: an escalation ticket in a connected helpdesk, or live chat in Chatbase's inbox.

### Watch out for

If you turn on "Only allow embedding the agent on specific domains," remember `localhost` and your Vercel preview domains, or the bot won't show up in testing (my inference). Credits are billed per model request, not per conversation, so an agent with Actions uses more than one credit unit per reply. There is no free plan, only a 7-day trial.

### Pricing

| Plan | Monthly | Billed yearly | Credits/mo |
| --- | --- | --- | --- |
| Basic | $150 | $120/mo | 4,000 |
| Business | $500 | $400/mo | 15,000 |
| Enterprise | Custom | Custom | Custom |

Add-ons include removing "Powered by Chatbase" for $99/month. Details are in my [Chatbase pricing](https://www.eesel.ai/blog/chatbase-pricing) breakdown.

**Verdict:** pick it if signed identity is a hard requirement and the budget fits. Skip it if you need a free tier.

## 6. Crisp

**Best for:** teams that want an official React package and a shared inbox, with an AI agent on a paid plan.

![Crisp's help-center article How to Install Crisp Chat Widget on a React.js App, with a walkthrough video and a list of steps from copying your Website ID to using the Web SDK, as taken from [Crisp's help center](https://help.crisp.chat/en/article/how-to-install-crisp-chat-widget-on-a-reactjs-app-fe0eyz/)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/crisp-nextjs-guide-20261116.png)

### How it works in Next.js

Crisp's React guide uses the official `crisp-sdk-web` package, and its SPA guide names Next.js as a recommended case. The package had `207,044` weekly downloads for 2026-11-08 to 2026-11-14, per the npm API. The guide's component calls `Crisp.configure("MY_CRISP_WEBSITE_ID")` in a `useEffect` and returns `null`.

```tsx
// components/crisp-chat.tsx
"use client"; // my addition: the guide doesn't mention it, but hooks need a client component
import { useEffect } from "react";
import { Crisp } from "crisp-sdk-web";

export default function CrispChat() {
  useEffect(() => {
    Crisp.configure(process.env.NEXT_PUBLIC_CRISP_WEBSITE_ID!);
  }, []);
  return null;
}
```

Mount it once near the root. If you need to wait for login or a consent banner, `Crisp.configure("ID", { autoload: false })` followed by `Crisp.load()` defers the chatbox.

### What I liked

The package is by far the most used of the two widget SDKs I checked, and the deferred-load option fits consent flows. Hugo, Crisp's AI agent, trains on snippets, the knowledge base, a site crawl, conversation history and uploaded files.

### Watch out for

Identity is mostly client-set: `Crisp.user.setEmail`, `Crisp.session.setData`, with Crisp warning not to put secrets or private identifiers in frontend session data. Cross-device continuity uses a private `CRISP_TOKEN_ID` your backend generates, and it must be passed at injection time. Hugo is not on the Free plan, and it stops answering when credits run out unless Pay-As-You-Go is on. See my [Crisp pricing](https://www.eesel.ai/blog/crisp-pricing) notes.

### Pricing

| Plan | Price | Hugo credits included |
| --- | --- | --- |
| Free | $0 | None |
| Mini | $45/mo | $5, about 90 conversations |
| Essentials | $95/mo | $25, about 450 conversations |
| Plus | $295/mo | $75, about 1,350 conversations |

Crisp estimates a full Hugo conversation at around $0.05 to $0.10.

**Verdict:** a good fit if you want a mature inbox and an official SDK. The AI is an add-on to a chat product, not the center of it.

## 7. tawk.to

**Best for:** teams that want free live chat and a small, cheap AI tier, and are comfortable with a React component.

![The tawk.to help-center React.js article showing the npm and yarn install commands for @tawk.to/tawk-messenger-react, as taken from [tawk.to's help center](https://help.tawk.to/article/react-js)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/tawkto-nextjs-guide-20261116.png)

### How it works in Next.js

There is an official React package and help article, but no Next.js page. Install `@tawk.to/tawk-messenger-react`, version 2.0.2, which had `13,784` weekly downloads in the same week, about 15 times fewer than Crisp's. The snippet is `<TawkMessengerReact propertyId="property_id" widgetId="default" />`. The component uses React hooks, so in the App Router it needs a client component (my inference).

### What I liked

The core product is free with unlimited team members, and the free AI Assist Hobby tier includes escalation to human agents. For identity, Secure Mode with an HMAC hash is the strongest of the widget routes after Chatbase's.

### Watch out for

The tawk.to guide's example computes the hash client-side with the secret key in the browser. In a Next.js app, compute it on the server so the key is never shipped to the client; that's my advice, not theirs. Credits are billed per reply by model, with the default Auto model at 3 credits per reply, so 1,000 credits is roughly 333 replies (my arithmetic). A bad experience from the Hacker News thread is worth knowing about: one developer said including the tawk.to widget made their page flash white while rendering. That is a single anecdote from 2022, so test your own pages.

### Pricing

| Item | Price | Included |
| --- | --- | --- |
| Live chat, inbox, ticketing, knowledge base | $0 | Unlimited team members |
| AI Assist Hobby | $0 | 100 credits, 1 AI agent, 100 crawled pages |
| AI Assist Growth | $29/mo | 1,000 credits, 3 AI agents |
| AI Assist Business | $99/mo | 5,000 credits, 5 AI agents |
| AI Assist Enterprise | $399/mo | 20,000 credits, 10 AI agents |

Extra credits are $30 per 1,000, and removing the "Powered by tawk.to" branding is a separate $29/month.

**Verdict:** the cheapest way to get a real inbox plus a little AI. Expect to tune credits as chats get longer.

## 8. Botpress webchat

**Best for:** teams who want a React chat component for a bot they design in a visual studio.

![Botpress's React library Get started page with the npm install @botpress/webchat command and a note that the library requires React 18 or higher, as taken from [Botpress's docs](https://botpress.com/docs/webchat/react-library/get-started)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/botpress-react-docs-20261116.png)

### How it works in Next.js

`npm install @botpress/webchat`, which needs React 18 or higher, a published bot and its Client ID from the dashboard's Advanced Settings. You get batteries-included `Webchat` and `Fab` components, or you build manually with the component library. There is also a script path: a `window.botpress.init({...})` snippet with `botId` and `clientId`. The docs say "React app" and do not discuss the App Router or `"use client"`, so treat that part as yours.

### What I liked

The React library is "fully customizable," and the conversation-based billing is easy to reason about. The bot itself, with flows, knowledge base and handoff, lives in Botpress Studio, so you aren't hand-building it in route handlers.

### Watch out for

The library is only the frontend; you still build and maintain the bot in Studio. A conversation is "any exchange with at least two messages from the end user in the billing month." At 95% of quota, a pack of 100 conversations is added automatically and auto-recharge cannot be turned off. See my [Botpress pricing](https://www.eesel.ai/blog/botpress-pricing) notes.

### Pricing

| Plan | Price | Conversations/mo |
| --- | --- | --- |
| Free | $0 | 100, no overages |
| Plus | $150/mo billed annually | 250, packs of 100 for $65 |
| Team | $750/mo billed annually | 1,500, packs of 100 for $50 |
| Enterprise | Custom | Custom |

**Verdict:** a fit if you want to design the bot visually and keep the frontend in React. Check the pack billing before you size a plan.

## Also worth knowing

- **Tidio** is script-only on Next.js; its developer docs cover a REST API, webhooks and a widget SDK, with no React or Next.js page. Identity is client-asserted: you set `document.tidioIdentify = { distinct_id, email, name, phone }` before the chat code loads, and the guide has no signature step. Free plan: 50 conversations, with the Lyro AI add-on from $39/month for 50 conversations. See my [Tidio AI chatbot](https://www.eesel.ai/blog/tidio-ai-chatbot) review and the [Tidio pricing](https://www.eesel.ai/blog/tidio-pricing) page.

  ![Tidio's Visitor Identification developer guide showing the document.tidioIdentify snippet with distinct_id, email, name and phone fields, as taken from [Tidio's developer docs](https://developers.tidio.com/docs/widget-visitor-identification)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/ai-chatbot-for-nextjs/images/tidio-nextjs-guide-20261116.png)

- **Voiceflow** archived its `react-chat` repository on Aug 5, 2025 and says it should not be used as an example going forward. The current path is a widget script from the Widget tab. Pricing shows no dollar figures: a free trial for agencies and a demo request for businesses. See [Voiceflow](https://www.eesel.ai/blog/voiceflow).
- **Chatbot UI** (mckaywrigley) has 33,305 stars and an MIT license, but its last push was 2024-08-03. Good as a reference, risky as a production base.
- **LangChain Next.js template** has 2,551 stars and was pushed on 2026-11-10. It is a template, not a UI kit, so you own the backend, retrieval and handoff. My notes on [LangChain](https://www.eesel.ai/blog/langchain) cover the library.

## What does an AI chatbot cost on a Next.js site?

Numbers mean little without a buyer, so here is one: a SaaS app on Vercel Pro that handles about 500 support chats a month. All prices come from each vendor's own pricing page, checked 2026-11-16. For the hosted widgets I show the arithmetic.

| Option | Monthly cost for ~500 chats | How I got it |
| --- | --- | --- |
| eesel | $299 | 1 credit per chat, so 500 chats fit the 500-credit Teammate plan exactly |
| Chatbase | $150 | Basic plan, 4,000 message credits; fits if a chat averages 8 credits or fewer (my arithmetic), since credits are per model request |
| tawk.to | $99 | Business plan, 5,000 credits; at 3 credits per Auto reply that is about 1,666 replies, roughly 3 per chat (my arithmetic). Growth at $29 covers only about 333 replies |
| Crisp | $65 to $90 | Mini $45 includes $5 of Hugo credits; 500 chats at Crisp's own $0.05 to $0.10 estimate is $25 to $50, so $20 to $45 more with Pay-As-You-Go on (my arithmetic) |
| Tidio | $350 | Lyro add-on, 500 conversations tier |
| Botpress | $345 | Plus $150 for 250 conversations, plus three packs of 100 at $65 for the other 250 (my arithmetic) |

For the build route, the meters are Vercel Pro at $20 a month, Active CPU and memory, a Postgres database for retrieval, and model tokens at provider list price with no Gateway markup. The per-chat model cost depends on the model and how long each chat runs, and Vercel's page does not say, so I won't invent a number. Measure a week of real traffic first. My [chatbot cost](https://www.eesel.ai/blog/chatbot-cost) guide and the [OpenAI API pricing](https://www.eesel.ai/blog/openai-api-pricing) post cover the token side.

Two cautions. These units are not interchangeable: eesel counts a chat, Chatbase counts model requests, tawk.to counts replies, Botpress counts conversations with at least two user messages. And the cheapest line is not the one that includes a human handoff and tested answers, which is what you are really buying.

## How do you add an AI support chatbot to Next.js step by step?

Here is the embed route end to end. It takes about 20 minutes if your docs are already public.

1. **Get the snippet.** Create the agent in your vendor of choice, connect your docs or help center, and copy the embed code. With eesel, `npx @eesel/cli init chat-bubble --site https://your-app.com` creates the bubble and prints the snippet, or you can copy it from the dashboard's Chat Bubble settings.
2. **Put the id in an environment variable.** Add it to `.env.local` as `NEXT_PUBLIC_...` and to your Vercel project settings. Leaving it unset in preview builds is fine; for eesel's snippet that just shows no bubble.
3. **Add the Script to `app/layout.tsx`.** Use `strategy="lazyOnload"`, once, in the root layout. If you only want the bot on some routes, put it in that route group's layout instead.
4. **Allow the vendor in your CSP.** For eesel the docs say to allow `https://cdn.eesel.ai` for scripts and connections. For any other vendor, check which domains it loads from; I only verified eesel's.
5. **Test on a preview deploy.** Open a Vercel preview URL, ask the five questions your support team gets most, and read the answers critically. If you use Chatbase's domain allow-list, add the preview domain first.
6. **Decide on identity.** If logged-in users chat, use a signed route (Chatbase JWT, tawk.to Secure Mode) and compute the signature on the server. If the widget only supports client-set data, don't let it answer questions about a specific account.
7. **Set handoff rules.** Decide when the bot stops, what ticket or email it creates and what the visitor sees. See my guide to [chatbot escalation](https://www.eesel.ai/blog/chatbot-escalation).

### Common mistakes

- Using `beforeInteractive` for a chat widget. Next.js documents it for bot detectors and consent managers, and it only works in a root layout.
- Putting the Script in a page that remounts, so the widget reloads on navigation. Use the root layout.
- Using `onLoad` in a Server Component. It needs a Client Component, and it cannot be combined with `beforeInteractive`.
- Forgetting the CSP. One Hacker News commenter described a chat widget as annoying to allow in their content security policy and slow, and removed it after trying it.

> "It was annoying to allow in my content security policy - It slowed down my site"
>
> -- [u2077, Ask HN thread, Hacker News](https://news.ycombinator.com/item?id=30537236)

- Forgetting Chatbase's domain allow-list for `localhost` and preview URLs.
- Trusting client-asserted identity for account data. If the browser can claim to be anyone, so can a visitor.

## Try eesel on your Next.js app

If you want a support bot, not a project, [Try eesel](https://www.eesel.ai/). It is one `lazyOnload` Script in `app/layout.tsx`, it answers from your docs, help center and site, and it hands off by helpdesk ticket or email. A chat costs 1 credit however long it runs. The free plan is 100 credits for 7 days, and the Teammate plan starts at $299 a month for 500 credits.

![An eesel chat bubble open on a demo store, with a welcome message, three starter questions and a Powered by eesel footer, as shown in eesel's [documentation](https://docs.eesel.ai/integrations/chat-surfaces/chat-bubble)](https://wmeojibgfvjvinftolho.supabase.co/storage/v1/object/public/blog-research/best-ai-chatbot-for-wix/images/eesel-docs-chat-bubble-live-open-20261115.jpg)
