AI DEVELOPMENT
Oct 7, 202611 min read21 reads

How to Add AI Chat to Your Website (Step-by-Step)

VS
Vikash Singh
Likes0
Shares1
How to Add AI Chat to Your Website (Step-by-Step)

TL;DR

There are three ways to add AI chat to your website: a no-code widget (live in an afternoon), a content-aware platform that answers from your own documents using RAG (the sweet spot for most businesses), or a custom build connected to your systems. Start with the simplest method that meets your need and upgrade only if the value justifies it.

How to Add AI Chat to Your Website (Step-by-Step)

Adding AI chat to your website is far easier in 2026 than most business owners expect, and there are three ways to do it, from a no-code tool you can set up in an afternoon to a fully custom assistant trained on your own content. The right path depends on one thing: how much you need the chat to actually know about your business. This guide walks through all three, step by step, so you can pick the one that fits and get it live.

Here is the key decision to make first, because it saves you time and money. A generic chat widget that answers from a script is cheap and fast but limited. An AI chat that answers accurately from your own content, your products, policies, and FAQs, is more powerful and is what most businesses actually want, and it is now very achievable. Knowing which you need before you start is the difference between a quick win and a frustrating one.

This guide covers the three ways to add AI chat, a step-by-step for each, what it costs, and how to choose.

The quick answer: three ways to add AI chat

If you want the options at a glance, here they are, from easiest to most powerful.

A no-code chat tool (easiest). Sign up for a service like a hosted AI chat widget, paste a snippet of code into your site, and you have AI chat live in an afternoon. Best for simple needs and non-technical teams.

A platform with your own content (middle). Use an AI chat platform that lets you upload your documents, website pages, or FAQs, so the chat answers accurately from your actual business content. Still mostly no-code, more useful, modest monthly cost.

A custom AI chat (most powerful). Have a developer build a chat assistant trained on your content, connected to your systems (orders, bookings, accounts), that matches your brand and can actually take actions. Best when chat is important to your business and you want full control.

The honest rule: start with the simplest option that meets your need. Most businesses are well served by option two, a platform that answers from their own content, without the cost of a custom build.

First, decide what you actually need

Before choosing a method, answer two quick questions, because they determine which path fits.

Does the chat need to know your business? If you just want to greet visitors and answer a few generic questions, a basic widget is fine. If you want it to answer accurately about your products, pricing, policies, or services, you need a method that uses your own content, which rules out the most basic widgets. This is the single most important question.

Does the chat need to do things, or just answer? If answering questions is enough, a platform works. If you need the chat to take actions, look up an order, book an appointment, update an account, you are moving toward a custom build, because that requires connecting to your systems. Most businesses start with answering and add actions later.

Your answers point you straight to one of the three methods below.

Method 1: Add a no-code AI chat widget (the fast path)

This is the quickest way to get AI chat live, and it needs no developer. Here is the process.

Step 1: Choose a tool. Pick a hosted AI chat service. Many exist, offering a chat widget you can add to any website, often with a free tier to start.

Step 2: Sign up and configure. Create an account, set the chat's name, greeting, and tone, and choose basic settings like colors to match your brand.

Step 3: Add your knowledge (if supported). Better no-code tools let you paste in FAQs or point the tool at your website so it can answer from your content. Do this if available, it is what makes the chat actually useful.

Step 4: Copy the code snippet. The tool gives you a small snippet of code (usually one line).

Step 5: Paste it into your website. Add the snippet to your site, in your site builder's "custom code" or "footer" section, or, on WordPress, via a plugin or the theme footer. Save, and the chat appears on your site.

Step 6: Test it. Open your site, ask the chat a few real questions, and refine its settings or knowledge based on how it answers.

That is it, AI chat live, often within an afternoon. The limit is that no-code tools offer less control and cannot deeply connect to your systems.

Method 2: Use a platform trained on your content (the sweet spot)

This is where most businesses should land. These platforms are still largely no-code, but they let the chat answer accurately from your own business content, which is what makes AI chat genuinely useful.

Step 1: Choose a content-aware AI chat platform. Pick a service built to ingest your documents and website and answer from them (this uses a technique called RAG, which grounds answers in your real content so the chat does not make things up).

Step 2: Upload your content. Add your FAQs, product and service pages, policies, and any help documents. The platform processes them so the chat can retrieve the right answer.

Step 3: Configure behavior and brand. Set the tone, the greeting, what to do when it does not know (for example, offer to connect to a human), and match your brand.

Step 4: Add it to your site. As with method one, paste the provided snippet into your website.

Step 5: Test with real questions, then refine. Ask the questions your customers actually ask, see where answers fall short, and improve the content you fed it. The quality of your uploaded content largely determines how good the chat is.

This path gives you a chat that answers accurately about your business, usually for a modest monthly fee, without a custom build. For most businesses, it is the best balance of power and effort.

Method 3: Build a custom AI chat (the powerful path)

When AI chat is important to your business, when you need it to match your brand exactly, answer from your full knowledge, and take real actions, a custom build is the answer. This needs a developer, but it gives you complete control.

A custom AI chat typically uses an LLM (like Claude or GPT) connected to your content through RAG, so it answers accurately from your data, and connected to your systems so it can act, look up an order, check availability, update a record. It lives on your site exactly as you design it, with no third-party branding, and you own it.

The build process, at a high level: define what the chat should do and answer, connect it to your content and systems, engineer and test its behavior against real questions, and deploy it to your site with a clean handoff to a human when needed. This is real development, and it is what our guide on the cost to build an AI chatbot breaks down in detail, and if the chat needs to complete tasks rather than just answer, that moves into agent territory, which our guide on AI agents vs chatbots explains.

Choose this when chat is a core part of your customer experience and the simpler options have hit their limits.

What it costs

A quick, honest picture so you can budget.

No-code widget: often free to start, then roughly $20 to $100 a month for a small business as you add features and volume.

Content-aware platform: typically $50 to a few hundred dollars a month, depending on volume and features. The sweet spot for most businesses.

Custom build: a one-time development cost (plus ongoing model usage and maintenance), which starts in the low five figures and scales with complexity. Right when chat is important enough to justify owning it.

The pattern: the more the chat needs to know and do, and the more control you want, the more it costs, so match the spend to how much the chat matters to your business.

How to choose your method

A simple way to decide. If you want AI chat live fast, for simple questions, and have no developer, use a no-code widget (method one). If you want the chat to answer accurately about your business without a custom build, which is most businesses, use a content-aware platform (method two). If chat is core to your business and you need full control, brand match, and the ability to take actions, build custom (method three).

And the smart sequence: start simple, prove chat helps your visitors, learn what they actually ask, then upgrade to a more powerful method if the value is there. There is no need to build custom on day one, and often no need to build custom at all.

Ready to add AI chat to your website?

Adding AI chat is one of the highest-return, lowest-friction ways to improve your website in 2026, it answers visitors instantly, around the clock, and captures leads you would otherwise lose. Start with the simplest method that meets your need, ground it in your real content, and upgrade only when the value justifies it.

When you need AI chat that truly fits your business, trained on your content, connected to your systems, matched to your brand, the Craxinno team builds custom AI chat and assistants that work in production. See recent AI work in the Craxinno portfolio, explore our AI development service, or email sales@craxinno.com.

Frequently Asked Questions

How do I add AI chat to my website?+

There are three ways. The fastest is a no-code AI chat widget: sign up for a hosted service, configure it, and paste a code snippet into your site, live in an afternoon. The middle option is a content-aware platform that answers from your own documents using RAG. The most powerful is a custom build connected to your systems. Start with the simplest method that meets your need.

Can I add AI chat to my website without a developer?+

Yes. No-code AI chat tools let you add a chat widget by signing up, configuring it, and pasting one line of code into your site, no developer needed. Content-aware platforms are also largely no-code: you upload your business content and add a snippet. You only need a developer for a fully custom AI chat that connects to your systems and matches your brand exactly.

How much does it cost to add AI chat to a website?+

A no-code widget is often free to start, then roughly $20 to $100 a month for a small business. A content-aware platform that answers from your content typically runs $50 to a few hundred dollars a month. A custom build is a one-time development cost starting in the low five figures, plus ongoing model usage, and is worth it when chat is important to your business.

How do I make AI chat answer questions about my own business?+

Use a method that ingests your content. Content-aware platforms and custom builds use a technique called RAG (Retrieval-Augmented Generation), which lets the chat retrieve and answer from your own documents, FAQs, product pages, and policies, rather than guessing. The quality of the content you provide largely determines how accurate the chat is, so feed it your real, current information.

What is the best way to add AI chat to my website?+

For most businesses, a content-aware platform is the best balance: it answers accurately about your business from your own content, needs little technical work, and costs a modest monthly fee. Use a no-code widget if you only need simple answers fast, and build custom if chat is core to your business and you need full control, brand match, and the ability to take actions.

1 shares
Was this useful?

Technology Used

HTML5HTML5
Node.jsNode.js
TypeScriptTypeScript
Next.jsNext.js
ClaudeClaude

Tags & Keywords

AI ChatbotWebsiteConversational AIRAGNo-CodeCustomer Support AIAI for BusinessHow-ToLead Generation
VS
Written byVikash Singh

Sales and Marketing Team

View all posts

Continue with Blogs.

View all blogs
How to Cut Your OpenAI / LLM API Bill (Practical Guide)
OpenAI API

How to Cut Your OpenAI / LLM API Bill (Practical Guide)

Quick answer: To cut your OpenAI or LLM API bill, send each task to the smallest model that passes your tests, put the stable part of every prompt first so it gets cached at up to 90% off, move anything that can wait to the Batch API or Flex (50% off), and cap output tokens. Stacked together, these levers routinely remove most of the bill. Most teams overpay for the same reason. They picked one model during the prototype, wired it into every feature, and never looked again. The invoice grows with traffic, someone in finance asks why, and the answer is "we're using AI." That answer stops working around the third month. This guide walks through the levers we actually reach for when an LLM API bill gets out of hand, in the order we reach for them. Prices quoted are OpenAI's published Standard-tier rates as of November 2026. They change often, so treat the ratios as the lesson and check the official pricing page before you plan a budget around them. Where your LLM API money actually goes Before cutting anything, know what you're paying for. Every request bills three things: input tokens, output tokens, and (on newer models) cache writes. Output is the expensive one. Across OpenAI's current lineup, output tokens cost 5x as much as input tokens, and reasoning tokens are billed as output even though you never see them. Model (Standard tier) Input / 1M Cached input / 1M Output / 1M GPT-6 Astra $10.00 $1.00 $50.00 GPT-6.1 Sol $2.00 $0.10 $10.00 GPT-6.1 Terra $1.00 $0.05 $5.00 GPT-6 Luna $0.10 $0.01 $0.50 GPT-5.4 mini $0.75 $0.075 $4.50 Look at the spread. Astra input costs 100x what Luna input costs. If a feature is running on the top model by default, that one decision probably outweighs every prompt tweak you could make. 1. Measure cost per feature before you cut anything You can't fix a number you only see as a monthly total. Log, for every call: the feature or endpoint, the model, input tokens, cached tokens, output tokens, and the user or tenant. The API already returns most of this in the usage object, including usage.prompt_tokens_details.cached_tokens . Then sort by spend. In almost every audit, one or two features own the majority of the bill. Often it's something nobody thinks of as "the AI feature" (a background summarizer, a retry loop, an agent that re-reads the same document on every step). Start there. 2. Route each task to the smallest model that passes your tests If you want to cut your OpenAI API bill fast, this is the biggest lever and the most ignored one. Classification, extraction, tagging, short summaries, routing decisions and formatting don't need a frontier model. A mini or nano tier handles them, and the price difference is an order of magnitude or more. The trick is to make the decision with data instead of vibes: Pull 100 to 200 real requests for the feature, with the outputs you consider correct. Run them through the cheapest candidate model. Score the results the same way you'd score the expensive model. Move up one tier only if the cheap one fails your bar. For mixed traffic, put a small router in front: the cheap model handles the request, and only escalates to the larger one when it's unsure or the task is flagged as hard. Most requests never escalate. (One honest caveat: a cheaper model that needs three retries isn't cheaper. Count retries in your eval.) 3. Structure prompts so they get cached Prompt caching is the closest thing to free money in the API. When the start of a request exactly matches a recent one, the matching tokens bill at the cached rate, which is 90% to 95% below the normal input price on current OpenAI models. OpenAI applies it automatically, but only if your prompts are built for it. Rules that decide whether you get a cache hit: Stable content first, variable content last. System instructions, tool definitions, schemas and few-shot examples go at the top. The user's message and anything dynamic go at the bottom. No timestamps or request IDs near the top. One changed character early in the prompt breaks the match for everything after it. Move that data into the request's metadata field. Keep tool lists identical. If you need to restrict tools per turn, use allowed_tools in tool_choice instead of changing the tools array. Append, don't edit. Rewriting earlier messages in a conversation throws away the cached prefix. Use prompt_cache_key . It groups related requests onto the same machines. In OpenAI's Prompt Caching 201 cookbook , one coding customer raised their hit rate from 60% to 87% just by adding it. On older models, caching only applies once the prompt reaches 1,024 tokens, so a short prompt never benefits. Here's the part most guides skip. On the GPT-5.6 and GPT-6 families, OpenAI now lists a separate cache-write price: 1.25x the input rate for a 30-minute cache and 2.5x for 12 hours. That changes the math. A prefix you write once and never reuse costs more than not caching. On GPT-6.1 Sol, though, one reuse already wins: $2.50 to write plus $0.10 to read, against $4.00 for sending the same million tokens twice uncached. So caching pays off on any prefix that gets hit at least twice inside the window, which describes nearly every chatbot and agent. 4. Move anything that can wait to the Batch API If the user isn't waiting for the answer, you shouldn't pay real-time prices. The Batch API takes a file of requests, returns results within 24 hours, and bills at 50% of the Standard rate on input, cached input and output alike. Good candidates: Nightly summarization or tagging of tickets, reviews or emails Generating embeddings or metadata for a content backlog Running evals and regression tests on new prompts Bulk content generation, translation or data cleanup Requests that don't finish in the window expire, and only completed requests get billed. Anthropic and Google sell the same 50%-off batch deal on their APIs, so this lever travels with you if you switch providers. 5. Use Flex processing for traffic in between Some work is too slow for real time but can't wait a day either. Flex processing sits there. It bills at the same 50% discount as Batch, but you call it synchronously: set service_tier: "flex" on the request. The trade-off is availability. When capacity is tight, Flex can return a 429 error instead of an answer (those failed calls aren't charged). Wrap it in a retry with backoff, and fall back to Standard if a job is getting close to its deadline. The opposite setting deserves a warning too. "Fast" mode (the priority tier) costs 2x Standard on most models, and Ultrafast costs 6x. Turn those on only for the endpoints where latency clearly earns money, never as a global default. 6. Cap output and reasoning tokens Since output costs 5x input, a chatty model is an expensive model. Three fixes: Set max_output_tokens on every call. It includes reasoning tokens, so it also stops a reasoning model from thinking for 20,000 tokens about a yes/no question. Lower reasoning effort for simple tasks. Most extraction and classification work runs fine on low effort. Ask for structured output. A JSON schema with the exact fields you need cuts the preamble, the restated question and the "I hope this helps" at the end. A plain instruction like "Answer in under 80 words" also works better than people expect. Test it against your eval set before trusting it. 7. Send less context Input tokens are cheaper than output, but you send a lot more of them. Common leaks: Full chat history on every turn. After 20 turns you're paying for the whole transcript each time. Too many RAG chunks. Retrieving 20 chunks when the answer lives in 3 multiplies input cost with no quality gain. Tune top-k and add a reranker. (Our RAG chatbot tutorial covers this setup.) Whole documents where a section would do. There's a tension here worth knowing about. We used to summarize old conversation turns aggressively to save input tokens. Then we noticed summarization rewrites the start of the prompt, which kills the cache. Now the default is: keep the prefix stable as long as the conversation is short, and compact only when the history gets long enough that the savings clearly beat the lost cache hits. One more threshold: on current flagship models, requests over 272K input tokens switch to long-context pricing, which doubles the input rate for the entire request. If you're near that line, trim to stay under it. 8. Watch the hidden line items Token counts aren't the whole bill. Check your usage dashboard for these: Web search tool: $10 per 1,000 calls, plus the search content tokens at model rates. File search tool: $2.50 per 1,000 calls, plus storage at $0.10 per GB per day after the first free GB. Containers (Code Interpreter and hosted shell): billed per 20-minute session, from $0.03 to $1.92 depending on memory size. Regional data residency: a 10% uplift on newer models. An agent that runs a web search on every step can quietly spend more on tool calls than on tokens. 9. Put hard limits on agents Agents are where bills explode, because one bad loop can make hundreds of calls before anyone notices. Build the brakes into your own code: A maximum number of steps per task A per-task and per-user token budget, checked before each call A stop rule when the agent repeats the same error or the same tool call twice Separate API projects per environment, so a runaway test in staging can't touch production spend Project budgets in the OpenAI dashboard are useful for alerts, but don't count on them to stop traffic. The hard stop belongs in your application. If you're scoping an agent project, our breakdown of AI agent pricing in 2026 covers how running costs fit into the total. How much can you cut your OpenAI API bill? A worked example Here's the math for a hypothetical support assistant, using OpenAI's list prices. It handles 100,000 requests a month. Each request sends 3,000 input tokens (2,500 of them a fixed system prompt and knowledge snippet) and gets back 400 output tokens. Step Monthly cost Everything on GPT-6 Astra $5,000 Route to GPT-6.1 Sol after it passes evals $1,000 Fixed 2,500-token prefix served from cache ~$531 Output capped at 250 tokens ~$381 That's about a 92% cut, before touching Batch or Flex at all. Your numbers will differ. The order of the savings usually won't: model choice first, caching second, output discipline third. Where to start this week Lever Typical saving Effort Cost logging per feature Shows where to act Low Smaller model for simple tasks Often 80%+ on that feature Medium (needs evals) Cache-friendly prompt order Up to 90% on repeated input Low Batch API for async jobs 50% Low to medium Flex for in-between traffic 50% Low (add retries) Output and reasoning caps Varies, often large Low Agent step and budget limits Prevents blowups Medium If you only do two things to cut your OpenAI API bill, add per-feature cost logging today and reorder your prompts for caching tomorrow. Both take hours, not weeks, and they tell you exactly where the remaining money is going. And if you'd rather have someone do the audit for you, Craxinno builds and tunes production AI features on the OpenAI and Claude APIs. Tell us what you're running and we'll show you where the bill can come down.

Posted 16.11.2026
AI Agent Pricing: What Should You Actually Pay in 2026?
AI Agents

AI Agent Pricing: What Should You Actually Pay in 2026?

AI Agent Pricing: What Should You Actually Pay in 2026? AI agent pricing in 2026 runs from about $0.10 per interaction for off-the-shelf support bots to $200,000+ for enterprise custom builds. Most businesses should expect to pay $0.99 to $2.00 per resolved conversation on a SaaS agent, or a one-time build fee plus $500 to $3,000 a month in model and infrastructure costs for a custom agent. That range is useless on its own, so this guide breaks it apart. You'll see what the big vendors actually charge, how custom-build quotes are put together, the token math most quotes leave out, and the point where building your own agent becomes cheaper than renting one. We build AI agents for clients at Craxinno, and the most common question we get isn't "can you build this?" It's "why did the last agency quote me $90,000 for this?" Let's answer that properly. AI Agent Pricing at a Glance (2026) Option Typical 2026 price Best for No-code agent platforms $29 to $200 per month to start Internal automations, small teams testing ideas Off-the-shelf support agents $0.10 per session to $2.00 per conversation or resolution Customer support on an existing helpdesk Enterprise agent platforms $125+ per user per month, or $30,000 to $300,000+ per year Large orgs already on Salesforce, Zendesk and similar Custom-built agent (agency quotes) $20,000 to $200,000+ one-time Agents tied to your own data, tools and workflows Running costs for a custom agent Model tokens plus roughly $500 to $3,000+ per month in infrastructure Anyone who owns the agent The no-code figure comes from Toolradar's survey of 319 agent tools, where the median cheapest paid plan was $29 a month. The custom-build range matches what agencies such as Cleveroad publish. Vendor prices below are list prices as reported in late 2026, so check the vendor's page before you sign. The 5 AI Agent Pricing Models You'll Run Into Vendors stopped agreeing on how to charge for agents somewhere around 2024. Salesforce alone now sells Agentforce three different ways at the same time. Here's how the models break down. 1. Per conversation You pay every time the agent talks to someone, whether it solves the problem or not. Salesforce launched Agentforce at $2 per conversation in October 2024. Ada reportedly lands between $1.00 and $3.50 per interaction. Simple to understand, but you pay for the failures too. 2. Per resolution (outcome-based) You pay only when the agent closes the ticket without a human. Intercom's Fin charges $0.99 per outcome. Zendesk charges $1.50 per automated resolution on committed volume and $2.00 pay-as-you-go. Gorgias sits around $0.60 to $1.27 depending on plan. This sounds like the fairest deal, and often it is. The catch: the vendor defines "resolved." If a customer gives up and leaves, some systems count that as a win. Read the definition in the contract, not the landing page. 3. Credits or per action Salesforce's Flex Credits (May 2025) bill $0.10 per action, sold in packs of 100,000 credits for $500. Microsoft Copilot Studio sells 25,000 credits for $200 a month. Lindy starts at $29.99 per user per month with 3,000 credits. Credits are flexible, but forecasting them is hard until you've watched real usage for a month or two. 4. Per seat The old SaaS model, bolted onto agents. Agentforce per-user licenses start at $125 per user per month. Microsoft 365 Copilot is $30 per user per month. Fine for copilots that help employees. Strange for an agent that's supposed to replace the work of seats. 5. Platform fee plus usage Common at the enterprise end. Decagon reportedly charges around $50,000 a year as a platform fee, then adds per-conversation or per-resolution fees on top. Sierra quotes custom enterprise pricing only. What Off-the-Shelf AI Agents Cost in 2026 If you want a support agent and already use one of these helpdesks, here's the real comparison. Vendor Pricing model Reported price Intercom Fin Per outcome $0.99 per outcome (helpdesk seats from $29/month) Zendesk AI Per resolution $1.50 committed, $2.00 pay-as-you-go Salesforce Agentforce Conversation, credits or seat $2/conversation, $0.10/action, or $125/user/month Freshdesk Freddy AI Per session $0.10 per session ($100 per 1,000) Gorgias Per resolution About $0.60 to $1.27 Ada Custom About $30,000+ yearly minimum (reported) Decagon Platform fee plus usage About $50,000/year plus usage (reported) Don't stop at the per-resolution number. Agentforce implementations reportedly run $50,000 to $150,000, with ongoing consulting at $10,000 to $25,000 a month. A cheap unit price on a platform that needs a six-figure rollout isn't cheap. How Much Does It Cost to Build a Custom AI Agent? Published agency ranges look like this, using Cleveroad's 2026 breakdown: Reactive agent (answers questions, no memory): $20,000 to $35,000+ Contextual agent (remembers the conversation, uses your data): $40,000 to $70,000+ Autonomous agent (plans steps, calls tools, takes actions): $80,000 to $120,000+ Domain-specific enterprise agent (compliance, deep integrations): $100,000 to $200,000+ Those numbers are real quotes from real agencies. But they mostly reflect agency rates, not the difficulty of the work. Every custom quote comes down to one formula: Build cost = hours × hourly rate A US or UK agency billing $120 to $200 an hour gets to $80,000 fast. The same scope at a $25 an hour studio (our standard rate at Craxinno) costs a fraction of that. So the first question to ask about any quote is simple: how many hours is this, and what's the breakdown? Where do the hours actually go? In the agents we've shipped, the LLM call itself is the easy part. The time disappears into four places: Integrations. Connecting the agent to your CRM, helpdesk, database or payment gateway. Every API has its own auth, rate limits and weird edge cases. Knowledge setup. Cleaning your docs, chunking them and building retrieval (RAG) so the agent answers from your data instead of guessing. We wrote a full walkthrough in our guide to building a RAG chatbot with the OpenAI API . Guardrails and fallbacks. What happens when the agent isn't sure? When a tool call fails? When a user tries to make it say something it shouldn't? Testing against real conversations. This is the step that's skipped in cheap builds and the reason many agents look great in a demo and fall apart in week two. If a quote doesn't show hours against these items, you can't compare it with anything. If you're weighing offshore options, our post on how to hire AI developers in India covers what to check before you sign. The Token Math Most AI Agent Quotes Leave Out Here's the cost that keeps running after the build invoice is paid. Every time your agent thinks, it spends tokens. Cost per task = (input tokens × input price) + (output tokens × output price) Take a simple inbox-triage agent that reads 20,000 tokens and writes 2,000 per task. On a mid-tier model priced at $2 per million input tokens and $10 per million output tokens (OpenAI list pricing as of October 2026, per Dupple's breakdown): Input: 20,000 × $2 ÷ 1,000,000 = $0.04 Output: 2,000 × $10 ÷ 1,000,000 = $0.02 Total: $0.06 per task Now look at what model choice does to the same workload, per 1,000 tasks: Agent type Budget model Mid-tier model Flagship model Inbox triage (20k in, 2k out) $3 $60 $300 Research, 5 lookups (60k in, 6k out) $9 $180 $900 Coding/ops with cached context $11.70 $222 $1,170 That's a 100x spread for the same job. And this is where most of the waste we see comes from: teams pick the flagship model for everything because it won the demo, then get a shock at month-end. Route the easy 80% of requests to a cheap model and save the expensive one for the hard cases. It's usually the single biggest saving available. Two more things on tokens. Prices move. Dupple reports Google's Gemini Argon doubling on December 1, 2026, and Gemini 3.8 Flash doubling on January 1, 2027, so lock your budget to a model you can swap out. And if a job can wait, OpenAI's Batch processing halves standard prices. Hidden Monthly Costs of Running an AI Agent The model bill is rarely the biggest line once you're in production. Budget for these too: Vector storage and memory: roughly $500 to $2,500+ a month depending on traffic and data size Logging pipeline: $300 to $800 a month Monitoring integrations: $300 to $1,000 a month, plus $100 to $500 for error tracking Prompt tuning and testing: $1,000 to $5,000 a month if you keep improving the agent (and you should) Search grounding: on Gemini, 5,000 requests a month are free, then $14 per 1,000 Hosting: your servers or serverless functions. If you're on AWS, plan this before launch, not after Those ranges come from Cleveroad's and Dupple's 2026 breakdowns. A small agent with modest traffic will land at the low end of each. You won't need every line on day one, but you'll need most of them by month three. Buy vs. Build: When Does a Custom AI Agent Pay for Itself? This is the question that actually decides your budget, so let's do the math with real list prices. Say your support agent resolves 5,000 tickets a month. On Intercom Fin at $0.99 per outcome: about $4,950 a month, or roughly $59,400 a year. On Zendesk at $1.50 per resolution: about $7,500 a month, or $90,000 a year. On a custom agent: 5,000 tasks on a mid-tier model at a triage-sized prompt costs about $300 a month in tokens. Add $1,000 to $2,000 for infrastructure and monitoring, and you're at roughly $1,300 to $2,300 a month before the build cost. At that volume, the gap is roughly $2,600 to $6,200 a month. A custom build in the $15,000 to $30,000 range can pay for itself inside a year. At 300 tickets a month, it won't. Fin would cost you about $300 a month, and no custom build beats that. So our honest rule of thumb: Under about 1,000 resolutions a month: buy. Use the agent built into your helpdesk. Thousands of resolutions a month, or the agent needs to take actions in your own systems: build, or at least get a quote. The agent is the product you sell: build. You can't rent your core feature from a vendor who sets the price. So, What Should You Actually Pay for an AI Agent in 2026? Here's where we'd land for most small and mid-sized businesses: Testing an idea: $0 to $200 a month on a no-code platform. Spend a month proving people will use it. Customer support on a standard helpdesk: $0.99 to $2.00 per resolution. Negotiate committed-volume pricing once you know your numbers. A custom agent tied to your systems: a build fee based on clear hours at a fair rate, then a monthly running cost you can predict from token math plus infrastructure. Paying $90,000 for a first agent with no hour breakdown and no running-cost estimate is the thing to avoid. Not because the agency is dishonest, but because you can't tell whether the price matches the work. Red Flags in an AI Agent Quote No hour breakdown, just a single number. No estimate of monthly token and hosting costs. Locked to one model provider with no way to switch. No test plan using your real past conversations. No answer to "what happens when the agent is wrong?" A per-resolution contract that doesn't define "resolution." If a quote has two or more of these, ask for a revised one before you compare prices. For a wider view of how development pricing works, see our breakdown of what a dedicated development team costs in 2026 and our best tech stack picks for SaaS startups . Get a Clear AI Agent Quote from Craxinno Craxinno is an AI-first design and development studio. We've been building software since 2017, and we price AI agent work the way this article recommends: hours you can see, at $25 an hour, with a running-cost estimate before you commit. If you want a second opinion on a quote you've already received, send it over. We'll tell you if it's fair. Talk to us about your AI agent project → Sources Fin: AI Agent Pricing Comparison 2026 SaaStr: Salesforce now has 3 pricing models for Agentforce Dupple: How Much Does It Cost to Build an AI Agent in 2026? Cleveroad: AI Agent Development Cost in 2026

Posted 12.11.2026
How to Build a RAG Chatbot with the OpenAI API (Tutorial)
RAG

How to Build a RAG Chatbot with the OpenAI API (Tutorial)

How to Build a RAG Chatbot with the OpenAI API (Tutorial) A RAG chatbot answers questions from your documents instead of from whatever the model memorised during training. You split your content into chunks, turn each chunk into an embedding, store them, retrieve the closest chunks for every question, and pass them to the model as context. With the OpenAI API you can do this in two ways: the managed file_search tool, or a do-it-yourself pipeline with embeddings. This tutorial builds both in Python, then shows what changes when you take it to production. What is a RAG chatbot (and why not just fine-tune)? RAG (retrieval-augmented generation) is a pattern where the app looks up relevant passages from your own data at question time and gives them to the language model as context, so the answer is grounded in those passages rather than in the model's training data. Picture a support bot asked, "Do you offer refunds after 30 days?" A plain LLM will guess. It sounds confident, and it may be wrong. A RAG bot first pulls the refund section of your policy PDF, then answers from that text and can point to the source. Fine-tuning changes how a model writes. It is a poor way to teach it facts that change every month. If your pricing page, product docs or HR policy gets edited, RAG picks up the change the moment you re-index the file. A fine-tuned model needs another training run. For a chatbot that has to be correct about your business , retrieval is almost always the first thing to build. How a RAG chatbot works: the 5-step pipeline Ingest your sources (PDFs, Markdown, help-centre pages, database rows). Chunk them into passages of a few hundred tokens with some overlap. Embed each chunk into a vector with an OpenAI embedding model and store it. Retrieve the top-k chunks closest to the user's question. Generate an answer with the model, using only the retrieved chunks, and cite them. Everything else (re-ranking, hybrid search, query rewriting, evaluation) is a refinement of one of these five steps. Two ways to build it with the OpenAI API Option A: Managed file_search Option B: DIY embeddings Setup time Minutes A few hours Chunking & embedding Handled by OpenAI You control it Where vectors live OpenAI vector store Your database (pgvector, Qdrant, Pinecone, etc.) Metadata filters, custom ranking Limited Full control Best for Prototypes, internal tools, small to medium document sets Multi-tenant SaaS, strict data residency, large or fast-changing data Our view after shipping both: start with Option A to prove the bot is useful, then move to Option B only when you hit a concrete limit (tenant isolation, filtering, cost at scale, or data that cannot leave your infrastructure). Prerequisites Python 3.10 or newer An OpenAI API key stored as the OPENAI_API_KEY environment variable A folder of documents to test with (a product manual or FAQ export works well) 1 pip install openai numpy tiktoken In the code below, the chat model is read from an OPENAI_MODEL environment variable. Set it to a current model from OpenAI's models page, since model names change more often than this tutorial will. Option A: Build a RAG chatbot with the Responses API and file_search This is the fastest route. OpenAI's file search tool parses your files, chunks them, embeds them and runs the search for you. You get a working bot in roughly 40 lines. Step 1: Upload files and create a vector store 1 2 3 4 5 6 7 8 9 10 11 12 13 from pathlib import Path from openai import OpenAI client = OpenAI ( ) vector_store = client . vector_stores . create ( name = "company_knowledge_base" ) for path in Path ( "docs" ) . glob ( "*.pdf" ) : with open ( path , "rb" ) as f : uploaded = client . files . create ( file = f , purpose = "assistants" ) result = client . vector_stores . files . create_and_poll ( vector_store_id = vector_store . id , file_id = uploaded . id , ) print ( path . name , result . status ) # expect "completed" print ( "Vector store ID:" , vector_store . id ) What goes wrong: scanned PDFs with no text layer index as almost nothing. If a file "completes" but the bot never finds anything in it, run OCR on it first. Step 2: Ask questions with the file_search tool 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 import os MODEL = os . environ [ "OPENAI_MODEL" ] VECTOR_STORE_ID = "vs_..." # from step 1 SYSTEM = ( "You are the support assistant for our company. " "Answer only from the provided files. " "If the files do not contain the answer, say you don't know " "and suggest contacting support. Keep answers short." ) def ask ( question , previous_id = None ) : response = client . responses . create ( model = MODEL , instructions = SYSTEM , input = question , tools = [ { "type" : "file_search" , "vector_store_ids" : [ VECTOR_STORE_ID ] , "max_num_results" : 5 , } ] , include = [ "file_search_call.results" ] , previous_response_id = previous_id , ) return response r1 = ask ( "What is the refund window?" ) print ( r1 . output_text ) include=["file_search_call.results"] returns the matched chunks, so you can log them and show sources in your UI. max_num_results trades quality for cost: fewer chunks means fewer input tokens and faster replies, but a higher chance of missing the right passage. Five is a sensible starting point. Step 3: Keep the conversation going 1 2 r2 = ask ( "And does that apply to annual plans?" , previous_id = r1 . id ) print ( r2 . output_text ) Passing previous_response_id lets the API carry the chat history, so the follow-up "that" resolves to the refund window. No manual message list needed. That is a complete RAG chatbot. Wrap ask() in a FastAPI endpoint, put a chat widget on top, and you have an MVP. Option B: Build RAG from scratch with OpenAI embeddings Build it yourself when you need control: per-customer filtering, your own database, custom chunking for tables or code, or a hard rule that documents never leave your servers except as embedding requests. Step 1: Chunk your documents Chunking decides retrieval quality more than any other setting. Too large and each chunk mixes topics; too small and it loses the context needed to answer. 1 2 3 4 5 6 7 8 9 10 import tiktoken enc = tiktoken . get_encoding ( "cl100k_base" ) def chunk_text ( text , source , size = 400 , overlap = 60 ) : tokens = enc . encode ( text ) chunks = [ ] step = size - overlap for start in range ( 0 , len ( tokens ) , step ) : piece = enc . decode ( tokens [ start : start + size ] ) chunks . append ( { "text" : piece , "source" : source } ) return chunks Start around 300 to 500 tokens with 10 to 15% overlap. Better still, split on headings first (one H2 section per chunk), and only fall back to token windows for long sections. Structured splits keep a question and its answer in the same chunk. Step 2: Create embeddings 1 2 3 4 5 6 7 8 9 10 11 12 13 import numpy as np EMBED_MODEL = "text-embedding-3-small" def embed ( texts ) : resp = client . embeddings . create ( model = EMBED_MODEL , input = texts ) return np . array ( [ d . embedding for d in resp . data ] , dtype = np . float32 ) chunks = [ ] for path in Path ( "docs" ) . glob ( "*.md" ) : chunks += chunk_text ( path . read_text ( ) , source = path . name ) vectors = [ ] for i in range ( 0 , len ( chunks ) , 100 ) : # batch requests vectors . append ( embed ( [ c [ "text" ] for c in chunks [ i : i + 100 ] ] ) ) matrix = np . vstack ( vectors ) matrix /= np . linalg . norm ( matrix , axis = 1 , keepdims = True ) text-embedding-3-small returns 1,536-dimension vectors, accepts up to 8,192 input tokens, and is listed at $0.02 per million tokens ($0.01 with the Batch API) at the time of writing. Embedding a few thousand pages of docs usually costs cents, not dollars. Check OpenAI's pricing page before you quote a client. If retrieval quality on your data is weak, try text-embedding-3-large (3,072 dimensions) before rewriting anything else. Step 3: Retrieve the top-k chunks 1 2 3 4 5 6 def retrieve ( question , k = 5 ) : q = embed ( [ question ] ) [ 0 ] q /= np . linalg . norm ( q ) scores = matrix @ q # cosine similarity top = np . argsort ( - scores ) [ : k ] return [ ( chunks [ i ] , float ( scores [ i ] ) ) for i in top ] NumPy is fine for a few thousand chunks. Past that, move the vectors into a vector database: pgvector if you already run Postgres, or Qdrant, Weaviate or Pinecone if you want a dedicated service. The retrieval function stays the same shape; only the storage changes. Step 4: Generate a grounded answer with citations 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 def answer ( question , history = None ) : hits = retrieve ( question ) context = "\n\n" . join ( f "[{n}] ({c['source']})\n{c['text']}" for n , ( c , _ ) in enumerate ( hits , 1 ) ) prompt = ( "Answer the question using ONLY the context below. " "Cite sources like [1]. If the answer is not in the context, " "reply: \"I don't have that information.\"\n\n" f "Context:\n{context}\n\nQuestion: {question}" ) response = client . responses . create ( model = MODEL , input = ( history or [ ] ) + [ { "role" : "user" , "content" : prompt } ] , ) return response . output_text , hits text , sources = answer ( "How do I reset my password?" ) print ( text ) The "I don't have that information" line is the single most useful instruction in the prompt. Without it, the model fills gaps with plausible guesses, which is exactly the failure RAG is meant to stop. Step 5: Add memory for follow-up questions Follow-ups like "what about on mobile?" retrieve badly because the question alone has no subject. Fix it by rewriting the question before retrieval: 1 2 3 4 5 6 7 def standalone ( question , history ) : r = client . responses . create ( model = MODEL , input = history + [ { "role" : "user" , "content" : f "Rewrite this as a standalone question: {question}" } ] , ) return r . output_text Retrieve with the rewritten question, answer with the original one. This small step fixes a large share of "the bot forgot what we were talking about" complaints. Taking your RAG chatbot to production The demo works on day one. The work is in the next four weeks. These are the points we check on every RAG build at Craxinno: Build an evaluation set first. Write 30 to 50 real questions with known correct answers and the source they should come from. Re-run them after every change to chunk size, model or prompt. Without this you are tuning by vibes. Use hybrid search for names and codes. Embeddings are weak on exact strings like SKU numbers, error codes and people's names. Combine vector search with keyword (BM25) search and merge the results. Re-rank before you generate. Retrieve 20 candidates, re-rank them, and pass the best 5. Answers get sharper and you send fewer tokens. Filter by tenant and permission. In a multi-customer product, every chunk needs metadata (customer ID, role, document date) and every query must filter on it. One leaked chunk from another customer is a serious incident. Re-index on change. Hook ingestion to your CMS or storage events so edited documents are re-embedded automatically. Stale answers erode trust faster than "I don't know". Log retrieved chunks with every answer. When a user reports a wrong answer, you need to see whether retrieval or generation failed. They need different fixes. Stream responses. Use stream=True so text appears as it is generated. Perceived speed matters more than total latency in a chat UI. Common RAG mistakes (and quick fixes) Symptom Likely cause Fix Bot says "I don't know" when the answer exists Chunks too small or question phrased differently from the docs Larger chunks, heading-based splits, query rewriting Answers mix two unrelated topics Chunks too large Split by section, reduce chunk size Wrong product or SKU in the answer Pure vector search on exact identifiers Add keyword search (hybrid) Confident but invented answers Prompt allows answering outside context Explicit "only from context" rule and a fallback reply Costs climbing Too many chunks per query, long histories Lower top-k, re-rank, trim history How much does a RAG chatbot cost to run? Two meters run. Embeddings are cheap and mostly one-off: you pay once to index and again only for changed documents. The bigger, recurring cost is the chat model, because every question sends the retrieved chunks as input tokens. Five chunks of 400 tokens add about 2,000 input tokens per question before history. Cut top_k , trim history and pick a smaller model for simple FAQ traffic, and costs stay predictable. With managed file_search , also budget for vector storage and tool calls, which OpenAI prices separately on its built-in tools pricing page. Need a production-ready RAG chatbot? A tutorial gets you a working prototype. A chatbot your customers trust needs evaluation, permissions, monitoring and a UI people actually use. Craxinno designs and ships AI products end to end, from RAG pipelines and agentic workflows in Python (FastAPI, Django) to the web and mobile apps that sit on top. If you want a RAG chatbot built on your data, talk to our team .

Posted 10.11.2026
Connect With Us

Have something in mind?

We take on a handful of new custom-software engagements every quarter. If your problem is interesting and your timeline is real — let’s talk.

Let’s ConnectAvg. response · under 4 hours
01
Ideate · 1 weekWorkshops, scoping, success metrics agreed.
02
Design + Build · 8–14 weeksBi-weekly demos. Production code from week one.
03
Ship + Support · ongoingDeployment, observability, and a long-tail retainer.