LIVV Logo
01Home
02About
03Work
04Services
05Products
06Blog
Get in touch
01Home
02About
03Work
04Services
Custom Software DevelopmentAI IntegrationCreative EngineeringProduct Strategy & UIMotion & Narrative
05Products
06Blog
Get in touch
Home/Blog/AI Integration
AI Integration

How to Build a Custom AI Chatbot for Your Website

Widget-based chatbots answer general questions. A chatbot built on a model API and connected to your actual knowledge base answers questions about your specific product, policies, and workflows. Here is how to build the latter.

L
Eneas Aldabe
August 24, 202613 min read
AI chatbotCustom chatbot developmentClaude APIRAGAI integrationChatbot for websiteAI development

Key takeaways

  • A custom AI chatbot built on a model API (Claude, OpenAI) outperforms widget-based tools on any knowledge base specific to your business, because the widget tools answer general questions while a custom build answers from your specific documentation.
  • The architecture that determines chatbot quality has two layers: a retrieval layer that finds relevant content from your knowledge base, and a generation layer where the model produces an answer. Most chatbot failures are retrieval failures, not model failures.
  • Model API costs for a typical business chatbot: a system handling 200 conversations per day at an average of 3,000 input tokens and 400 output tokens per exchange costs approximately $160 to $220 per month using Claude Sonnet 5, or approximately $40 to $55 using Claude Haiku 4.5 at the same volume.
  • Build cost from a US boutique studio: $15,000 to $35,000 for a focused implementation with a clean knowledge base and a contact-form escalation path. A system with CRM integration, cross-session memory, and conversation analytics runs $35,000 to $70,000.
  • The most common post-launch failure is a chatbot without a defined escalation path. When users hit a question the chatbot cannot answer well and find no route to a human, the conversation ends badly and recovery is difficult.

Most businesses that add a chatbot to their website use a hosted widget. The widget connects to a generic AI model, takes a URL or two as context, and handles simple questions from the homepage. This works adequately for FAQs, pricing tables, and office hours.

The approach stops working when questions get specific. A user asks how your product handles a particular edge case. A prospect asks whether your service covers their geography. A support request references a transaction from three weeks ago. Widget-based chatbots answer these questions with confident-sounding approximations or fall back to generic suggestions that do not address what was asked.

A chatbot built on a model API, connected to your actual knowledge base, answers those same questions accurately. The reference material is your documentation, not a generic training corpus. This piece covers how to build that system, what it costs, and where the common mistakes happen.

What a custom AI chatbot is, and what it is not

A custom AI chatbot is an application layer sitting between your website visitor and a large language model API. The application manages the conversation flow and retrieves relevant content from your document store. It passes that retrieved content to the model as context and displays the model's response in your site's interface.

This differs from an embedded widget in one structural way: the model holds no proprietary knowledge of your business from its training data. Every response it generates is grounded in documents your team controls. When your product changes, you update the document. The chatbot's answers adjust accordingly.

The term chatbot covers quite different implementations. A scripted chatbot follows a decision tree and cannot go off script. An AI chatbot with a retrieval layer can answer questions the script never anticipated, as long as the answer exists somewhere in the knowledge base. An AI agent goes further: it can take actions, look up live data, and complete multi-step tasks on behalf of the user.

This piece covers the middle case, the knowledge-retrieval chatbot, which is the right scope for most website implementations and the correct starting point before adding agentic capabilities. For a clear breakdown of where chatbots and agents differ in scope, the what-is-an-ai-agent-does-your-business-need-one piece covers the distinction with a decision framework.

The two-layer architecture: retrieval and generation

A production AI chatbot for a website has two layers. The quality of the system depends far more on the first layer than most teams expect.

The retrieval layer is responsible for finding the right content from your knowledge base in response to a user's question. The standard implementation uses vector search. Your documents are split into chunks, each chunk is converted to a numerical embedding using an embedding model, and those embeddings are stored in a vector database. When a user submits a question, that question is also converted to an embedding, and the database returns the chunks closest to it in meaning. Those chunks become the context the generation layer works from.

The generation layer is where the large language model operates. It receives the user's question plus the retrieved context, and produces an answer. The quality of the answer depends almost entirely on whether the retrieved context was relevant. When the retrieval layer returns good context, even a mid-tier model produces accurate, specific answers. When retrieval fails, a more expensive model either hallucinates or acknowledges ignorance.

Most chatbot failures are retrieval failures. The model confidently answers a question using the wrong document chunk, or the chunk retrieved contains the right topic but not the specific detail the user asked about. Improving a misbehaving chatbot almost always means improving how the knowledge base is organized, how the chunks are sized, or how the retrieval query is formed, not switching to a more expensive model.

The standard architectural pattern for this system is called retrieval-augmented generation, or RAG. The embedding step typically uses a low-cost embedding API, while the vector database can be Pinecone, Weaviate, pgvector on Postgres, or any number of alternatives depending on infrastructure preferences and scale. If your website chatbot will draw on more than two or three source documents, a RAG architecture is the correct foundation.

Choosing a model: Claude and OpenAI in 2026

Two providers are the practical default for custom chatbot development in 2026: Anthropic's Claude API and OpenAI's API. Both are production-grade, well-documented, and available through standard HTTP integrations that most developers are familiar with.

For a customer-facing website chatbot, Claude Sonnet 5 and GPT-4o are the relevant mid-tier options. Both handle multilingual input, maintain coherent reasoning over moderate context lengths, and produce responses that read naturally without post-processing. The practical differences appear at specific task edges rather than in general quality.

Claude performs better than GPT-4o on long-context document reasoning, instruction-following with detailed system prompts, and tone consistency across a long conversation. OpenAI has broader third-party tool integrations and more client library support in languages outside Python and JavaScript.

For a chatbot grounded primarily in written documentation, retrieval augmentation matters more than base model capability. Either model produces similar output quality when given good retrieved context. The choice matters more when the system needs to reason across multiple retrieved documents simultaneously, or when the system prompt defines specific response constraints the model must maintain throughout the conversation.

On cost: Claude Sonnet 5 charges approximately $3.00 per million input tokens and $15.00 per million output tokens. Claude Haiku 4.5 charges approximately $0.80 per million input tokens and $4.00 per million output tokens. For a typical website chatbot handling 200 conversations per day at an average of 3,000 input tokens and 400 output tokens per exchange, the monthly API cost is approximately $160 to $220 using Claude Sonnet 5, or approximately $40 to $55 using Claude Haiku 4.5. If your chatbot's questions are mostly factual lookups against a clean knowledge base, Haiku is often sufficient and cuts API cost by roughly 75 percent.

Building the knowledge base

The knowledge base determines what the chatbot can and cannot answer accurately. Its quality matters more than the model selection, the prompt design, or the choice of vector database.

A useful knowledge base for a website chatbot typically includes product documentation, pricing pages, service territory or availability information, terms and conditions summaries, and any FAQ content already written by the support team. These documents represent the specific questions your site visitors actually ask.

Two practices consistently produce better retrieval quality. First, chunk documents by topic rather than by character count. A 500-character chunk that contains half a pricing table and half a refund policy retrieves poorly for either topic. A chunk covering a single product feature or a single policy retrieves accurately for exactly that question. Second, add metadata to each chunk: document type, date, product line, and geography if relevant. Metadata filters allow the retrieval layer to exclude irrelevant documents before the similarity search runs.

Test the retrieval layer independently before integrating it with the model. Send the ten most common support questions against the retrieval system and check whether the correct chunks come back. This test catches structural problems before they become user-facing errors.

The knowledge base requires ongoing maintenance. When a product changes, the relevant documents need updating. When a frequently-asked question falls outside the current document set, a new document should be added to cover it. Teams that treat the knowledge base as a one-time build consistently produce chatbots that degrade in accuracy over time. For context on what AI integration projects typically cost when a knowledge base is part of the scope, the cost of AI integration in 2026 piece covers RAG implementation ranges from boutique studios through large agency pricing.

Managing conversation state and context

A website chatbot that forgets everything between messages is technically functional but produces a frustrating user experience. The user who says "tell me more about that" gets a confused response because "that" has no referent in a stateless conversation.

Managing conversation state means passing a running summary or the recent transcript of the current session as additional context on each request. The practical implementation usually stores the conversation in the client (browser session storage or a backend session record) and includes the relevant prior turns when calling the model API.

The challenge is context window management. Most production chatbots cap conversation history at eight to fifteen prior messages. Beyond that, the context window fills with old conversation content that dilutes the retrieved document chunks. For most website chatbots, per-session memory with no cross-session retention is the appropriate default. It avoids data retention obligations, reduces infrastructure complexity, and matches user expectations for a help-oriented tool on a public website.

The escalation design: when to hand off to a human

Every chatbot reaches questions it cannot answer well. The escalation path is what happens when that occurs. Its design affects user satisfaction as much as the chatbot's answer quality on the questions it handles correctly.

A chatbot without a defined escalation path produces a predictable outcome: the user realizes the bot cannot help them, has no clear path to a human, and leaves the conversation. In a support context, that user may file a repeat request through another channel or not resolve the issue at all. In a sales context, a prospect who cannot get a specific answer and cannot find a clear path to a human often becomes someone else's customer.

The escalation design should specify: at what point the chatbot offers to connect the user to a human, what the connection mechanism is (a contact form, a live chat handoff, a calendar link, an email), and whether the chatbot's conversation history transfers to the human handling the escalation. A chatbot that passes the full conversation transcript to the support agent who takes over produces a meaningfully better handoff than one that starts the human with no context.

Confidence thresholds offer one way to trigger escalation automatically. When the model's response indicates it could not find relevant information, the response can include a standardized handoff prompt rather than a speculative answer. Some teams implement this as a function the model can call when it determines the answer is outside its knowledge base. Others handle it with a simple end-of-conversation offer. The simpler the escalation, the more likely it is to function correctly in production.

What a custom chatbot costs to build in 2026

Build cost for a custom AI chatbot from a US boutique studio depends on the scope of the knowledge base, the complexity of the conversation design, and whether a human escalation path needs to connect to an existing CRM or ticketing system.

A focused implementation covering one primary topic with a clean knowledge base, a system prompt, a basic conversation UI, and a contact-form escalation path runs $15,000 to $35,000 at US boutique studio rates. This scope assumes the knowledge base documents exist and need formatting and chunking, not creation from scratch.

A more complete system with CRM integration for the escalation path, analytics on conversation topics and failure points, and multi-document retrieval runs $35,000 to $70,000. Mid-tier agencies charge $50,000 to $120,000 for comparable scope.

Ongoing costs after launch have two components. The first is API usage: at 200 conversations per day using Claude Sonnet 5, monthly API fees run $160 to $250 depending on average conversation length. The second is infrastructure: vector database hosting runs $50 to $200 per month at typical business chatbot volume, and server costs for the application layer add $20 to $100 per month.

Studio support retainers for chatbot maintenance (knowledge base updates, retrieval tuning, prompt adjustments) typically run $800 to $2,500 per month. Teams that own the knowledge base update process internally and contact the studio only for technical changes pay significantly less. For a broader breakdown of AI integration costs across system types, the how-to-integrate-ai-into-your-existing-business piece covers the full range from simple API additions through complex agentic systems.

Selecting a development partner

A custom AI chatbot is a software project, not a configuration task. The studio or developer building it needs working experience with RAG architecture, model API integration, embedding pipelines, and basic product design for conversation flow and escalation UX. These skills do not overlap entirely with general web development, and a studio that has built many marketing sites may not have built a RAG-based chatbot before.

The most useful evaluation criteria are specific prior work and clarity on what happens after launch. Ask the studio to describe the retrieval architecture they used on a recent chatbot project, and explain how they handle knowledge base updates after handoff. If their plan for knowledge base updates is to rebuild the index manually on request, that is a process problem affecting ongoing cost and reliability.

Also ask who maintains the knowledge base index after handoff. If the answer is that you do, understand the tooling involved before signing a contract. If the studio handles it on retainer, get the retainer terms in writing before the build starts. For a detailed framework on evaluating studios for technical AI work, the hiring-creative-engineering-studio piece covers the selection criteria, the questions to ask in a discovery call, and the engagement structures that produce reliable delivery.

On this page

  • Key takeaways
  • What a custom AI chatbot is, and what it is not
  • The two-layer architecture: retrieval and generation
  • Choosing a model: Claude and OpenAI in 2026
  • Building the knowledge base
  • Managing conversation state and context
  • The escalation design: when to hand off to a human
  • What a custom chatbot costs to build in 2026
  • Selecting a development partner

Talk to us.

Get in Touch→

You might also like

How to Integrate AI Into Your Existing Business
AI Integration14 min read

How to Integrate AI Into Your Existing Business

A practical guide for business owners and operators who want to add AI capabilities to existing workflows. Covers workflow selection, integration patterns, build vs buy AI tooling, and real cost ranges for 2026.

June 1, 2026Read more →
The Cost of AI Integration: What to Budget in 2026
AI Integration13 min read

The Cost of AI Integration: What to Budget in 2026

A pricing guide for founders and product teams scoping their first AI integration. Covers per-token API costs, SaaS tool subscriptions, development work, data infrastructure, and what a realistic first-year budget looks like across four common integration types.

July 27, 2026Read more →
What Is an AI Agent and Does Your Business Need One?
AI Integration12 min read

What Is an AI Agent and Does Your Business Need One?

The phrase has been stretched to cover everything from a chatbot to a fully autonomous reasoning system. Here is the working definition, the decision framework, real cost ranges, and an honest account of where agents fail in production.

June 29, 2026Read more →
✦ From the Journal ✦

Editorial pieces on craft and the studio model.

All writing→
01Creative Engineering

The Argentine Creative Engineering Tradition

A working theory about a category nobody has named, the country that quietly produces a disproportionate share of it, and what comes next.

12 min read·Read
02Platform Comparisons

Webflow vs Framer in 2026: A Practitioner's View

Both tools are excellent. They are not interchangeable. The honest comparison is about defaults and second-order trade-offs, and most writing online avoids both.

17 min read·Read
03Hiring & Agencies

The White-Label Playbook

The white-label model is misunderstood by everyone except the studios that do it well and the agencies that buy it from them. This is the explanation neither side has had a reason to write down.

14 min read·Read
04Hiring & Agencies

Hiring a Creative Engineering Studio: A Buyer's Guide

Practical guidance for founders and heads of design choosing a creative engineering studio. What to look for, what to ignore, real pricing ranges, and the questions to ask before signing.

18 min read·Read
Get in Touch

Let's work together

Goodfirms Badge

Have a project in mind? We'd love to hear about it.

hola@livv.systems

Socials

Designed by LIVVRebuilt in Next.jsBy Antigravity
Privacy PolicyCurrent Status: Online