AI DEVELOPMENT
Oct 13, 202620 min read28 reads

How to Build a Chatbot with the OpenAI API: Step-by-Step Python Tutorial

VS
Vikash Singh
Likes0
Shares1
How to Build a Chatbot with the OpenAI API: Step-by-Step Python Tutorial

TL;DR

Install the openai Python SDK, store your API key in .env, and call client.responses.create() with a system prompt in instructions. Chain turns with previous_response_id or the Conversations API so the bot remembers context, stream replies token by token, then wrap it in FastAPI. On gpt-6-luna, a 10-turn chat costs about $0.002.

How to Build a Chatbot with the OpenAI API: Step-by-Step Python Tutorial

Quick answer: To build a chatbot with the OpenAI API, install the openai Python SDK, save your API key in an environment variable, and send each user message to client.responses.create() with your system prompt in instructions. Pass the previous reply's ID back as previous_response_id so the bot remembers the conversation, then stream the output to a web page through a small backend.

That's the whole idea. The rest of this tutorial turns it into code you can run in about 20 minutes.

One warning first. Search "OpenAI chatbot tutorial" and a good share of the top results still call openai.ChatCompletion.create(). That function was removed when the Python SDK hit version 1.0 back in November 2023, and the SDK is on version 3.29 as of October 2026. Copy that code today and you get an error before your bot says hello. Everything below is written against the current Responses API and tested on openai 3.29.0.

What you'll build

A support assistant called Ava for a made-up coffee subscription brand, Brewly. By the end you'll have:

  1. A terminal chatbot that streams replies word by word and remembers earlier messages.
  2. A FastAPI backend that keeps your API key off the browser.
  3. A plain HTML chat page that talks to that backend.
  4. A clear idea of what each conversation costs you.

Python 3.9 or newer and an OpenAI account with billing enabled are all you need. No frameworks like LangChain. You'll understand every line, which matters the first time something breaks in production.

Responses API vs Chat Completions vs Assistants: which one?

OpenAI has three APIs that can power a chatbot, and older tutorials mix them up.

API

Status (Oct 2026)

Who manages conversation history

Use it for

Responses API

Recommended for all new projects

You, or OpenAI via previous_response_id / Conversations

New chatbots and agents

Chat Completions

Still supported

You (resend the messages array)

Existing apps you don't want to migrate yet

Assistants API

Listed under legacy APIs

OpenAI (threads)

Nothing new

OpenAI's own migration guide says Responses is "recommended for all new projects," and reports 40–80% better cache utilization than Chat Completions in internal tests. Better cache hits mean lower bills on long chats, which is reason enough for a chatbot.

So this tutorial uses the Responses API throughout.

Step 1: Set up the project and your API key

Create a folder, a virtual environment and install four packages:

1 2 3 4
mkdir openai-chatbot && cd openai-chatbot
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install openai python-dotenv fastapi uvicorn

Generate a key at platform.openai.com → API keys, then create a .env file in the project folder:

1 2
OPENAI_API_KEY=sk-proj-your-key-here
OPENAI_MODEL=gpt-6-luna

Add .env to .gitignore right now, before your first commit. Leaked keys get scraped from public GitHub repos within minutes, and the bill lands on your account.

What goes wrong here: if you see OpenAIError: Missing credentials. Please pass an api_key..., the SDK can't find the variable. Check that load_dotenv() runs before OpenAI() is created and that you started Python from the folder containing .env.

Step 2: Send your first request

Create hello.py:

1 2 3 4 5 6 7 8 9
from dotenv import load_dotenv
from openai import OpenAI
load_dotenv()
client = OpenAI() # reads OPENAI_API_KEY from the environment
response = client.responses.create(
model="gpt-6-luna",
input="Explain what an API key is in one sentence.",
)
print(response.output_text)

Run python hello.py. If a sentence comes back, your account, key and billing all work.

response.output_text is a convenience property that joins all the text the model produced. The full response.output list also holds reasoning items and tool calls, which you'll need later for memory.

Which model should a chatbot use?

These are the current text models and their prices per 1 million tokens, from OpenAI's models page:

Model

Input

Output

Good for

gpt-6-luna

$0.10

$0.50

FAQ and support bots, high volume, fastest replies

gpt-6.1-sol

$2

$10

Bots that need to reason over policies, data or code

gpt-6-astra

$10

$50

Hard, high-value queries where accuracy beats cost

Our take: start every chatbot on Luna. Most customer-facing questions ("where's my order?", "can I change my plan?") don't need a frontier model, and Luna costs 1/20th of Sol. Upgrade only the conversations that need it. Because the model name lives in .env, switching is a one-line change.

Step 3: Give the bot a personality and rules with a system prompt

Without instructions, the model answers anything about anything. A support bot needs a job description. In the Responses API, that goes in the instructions parameter:

1 2 3 4 5 6 7 8 9 10 11
SYSTEM_PROMPT = """You are Ava, the support assistant for Brewly, an online coffee subscription.
- Only answer questions about orders, subscriptions, shipping and coffee.
- Keep replies under 80 words unless the user asks for more detail.
- If you are not sure, say so and point the user to help@brewly.example.
- Never invent order numbers, prices or delivery dates."""
response = client.responses.create(
model="gpt-6-luna",
instructions=SYSTEM_PROMPT,
input="Can I pause my subscription for a month?",
)
print(response.output_text)

A few things we've learned writing system prompts for client bots:

  • Rules beat adjectives. "Keep replies under 80 words" works. "Be concise" gets interpreted loosely.
  • Tell it what to do when it doesn't know. The fallback line (email support) is what stops a bot from making up a refund policy.
  • Ban the specific lies. Order numbers and delivery dates are what support bots most love to invent, so the prompt names them.

If you want to go deeper on wording, our guide to prompt engineering covers structure and testing.

Step 4: Add conversation memory (three ways)

Ask the bot from Step 3 "Can I pause my plan?", then follow up with "What about two months?" It has no idea what you mean. Every API call starts with a blank slate, because the model is stateless.

You have three ways to fix that.

Approach

How it works

Where history lives

Best for

A. Manual history

Append every message and reply to a list, send the whole list each time

Your app

Full control, store=False for sensitive data

B. previous_response_id

Pass the last reply's ID; OpenAI fills in the earlier turns

OpenAI (responses kept 30 days by default)

Terminal bots, short sessions

C. Conversations API

Create a conversation object once, attach every response to it

OpenAI (no 30-day expiry)

Web apps where users come back later

One thing none of the three changes: you pay for the history every turn. OpenAI's docs say it directly: with previous_response_id, "all previous input tokens for responses in the chain are billed as input tokens." Server-side memory saves you code, not tokens.

Option A: manual history (stateless)

1 2 3 4 5 6 7 8 9 10 11
history = []
def ask(user_text):
history.append({"role": "user", "content": user_text})
response = client.responses.create(
model="gpt-6-luna",
instructions=SYSTEM_PROMPT,
input=history,
store=False, # nothing kept on OpenAI's side
)
history.extend(response.output) # keep ALL output items, not just the text
return response.output_text

Note history.extend(response.output). OpenAI's conversation-state guide says to keep every output item so reasoning items stay intact. Appending only output_text as a string works on simple models and quietly degrades answers on reasoning ones.

Option B: previous_response_id (the terminal chatbot)

This is the full, runnable terminal bot. Save it as chat.py:

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 26 27 28 29 30 31 32 33 34 35 36 37
import os
from dotenv import load_dotenv
from openai import OpenAI
load_dotenv()
client = OpenAI()
MODEL = os.getenv("OPENAI_MODEL", "gpt-6-luna")
SYSTEM_PROMPT = """You are Ava, the support assistant for Brewly, an online coffee subscription.
- Only answer questions about orders, subscriptions, shipping and coffee.
- Keep replies under 80 words unless the user asks for more detail.
- If you are not sure, say so and point the user to help@brewly.example.
- Never invent order numbers, prices or delivery dates."""
def main():
previous_id = None
print("Ava is ready. Type 'quit' to exit.\n")
while True:
user_text = input("You: ").strip()
if user_text.lower() in {"quit", "exit"}:
break
if not user_text:
continue
stream = client.responses.create(
model=MODEL,
instructions=SYSTEM_PROMPT, # resend every turn
input=user_text,
previous_response_id=previous_id,
reasoning={"effort": "low"},
stream=True,
)
print("Ava: ", end="", flush=True)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)
elif event.type == "response.completed":
previous_id = event.response.id
print("\n")
if __name__ == "__main__":
main()

Run python chat.py, ask about pausing, then ask "what about two months?" Ava now knows what "that" refers to.

See the comment # resend every turn? That's the bug that catches almost everyone. The SDK documentation says that with previous_response_id, "the instructions from a previous response will not be carried over to the next response." Send instructions only on the first call and by turn three Ava has forgotten she's a coffee bot and will happily write you a cover letter.

Option C: the Conversations API

For a web app, a user might close the tab and come back tomorrow. A conversation object survives that, and unlike stored responses it isn't subject to the 30-day TTL:

1 2 3 4 5 6 7
conversation = client.conversations.create()
response = client.responses.create(
model="gpt-6-luna",
instructions=SYSTEM_PROMPT,
input="Can I pause my plan?",
conversation=conversation.id,
)

Save conversation.id against your user record and pass it back on every message. We'll use this in the web version.

Step 5: Stream replies instead of waiting

You already saw streaming in chat.py, but it deserves its own section because it changes how the bot feels more than any model upgrade.

Without streaming, the user types a question and stares at nothing for two, three, four seconds while the whole answer generates. Then a wall of text appears. With streaming, the first words show up almost immediately and the reply types itself out. Same total time. Completely different experience.

The mechanics are two lines: pass stream=True, then loop over events and print the ones of type response.output_text.delta. Other events you'll see include response.created, response.completed (which carries the final response object and its ID) and error.

Step 6: Put the chatbot on a web page with FastAPI

Here's where a lot of tutorials go wrong. They call the OpenAI API straight from browser JavaScript, which means shipping your API key to every visitor. Anyone who opens dev tools can copy it and run up your bill.

The fix is a thin backend. The browser talks to your server; only your server talks to OpenAI.

Create app.py:

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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
import os
from dotenv import load_dotenv
from fastapi import FastAPI
from fastapi.responses import FileResponse, StreamingResponse
from openai import OpenAI
from pydantic import BaseModel, Field
load_dotenv()
client = OpenAI(timeout=30, max_retries=3)
MODEL = os.getenv("OPENAI_MODEL", "gpt-6-luna")
SYSTEM_PROMPT = """You are Ava, the support assistant for Brewly, an online coffee subscription.
- Only answer questions about orders, subscriptions, shipping and coffee.
- Keep replies under 80 words unless the user asks for more detail.
- If you are not sure, say so and point the user to help@brewly.example.
- Never invent order numbers, prices or delivery dates."""
app = FastAPI()
class ChatIn(BaseModel):
conversation_id: str
message: str = Field(min_length=1, max_length=2000)
@app.get("/")
def home():
return FileResponse("index.html")
@app.post("/conversations")
def new_conversation():
conversation = client.conversations.create()
return {"conversation_id": conversation.id}
@app.post("/chat")
def chat(body: ChatIn):
def generate():
stream = client.responses.create(
model=MODEL,
instructions=SYSTEM_PROMPT,
input=body.message,
conversation=body.conversation_id,
reasoning={"effort": "low"},
max_output_tokens=800,
stream=True,
)
for event in stream:
if event.type == "response.output_text.delta":
yield event.delta
return StreamingResponse(generate(), media_type="text/plain")

Three small details doing real work here:

  • max_length=2000 on the message stops someone pasting a novel into your bot and charging you for it. FastAPI rejects it with a 422 before OpenAI is ever called.
  • max_output_tokens=800 caps the reply cost. Reasoning tokens count toward this limit, so don't set it too tight or replies get cut off.
  • OpenAI(timeout=30, max_retries=3) raises the SDK's default of 2 automatic retries, which covers most brief rate-limit and network blips.

Now the front end. Create index.html in the same folder:

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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>Brewly Assistant</title></head>
<body>
<div id="log"></div>
<form id="chat-form">
<input id="msg" autocomplete="off" placeholder="Ask about your order...">
<button>Send</button>
</form>
<script>
const log = document.getElementById("log");
let conversationId = null;
function addLine(who, text) {
const p = document.createElement("p");
p.textContent = `${who}: ${text}`; // textContent, never innerHTML
log.appendChild(p);
return p;
}
document.getElementById("chat-form").addEventListener("submit", async (e) => {
e.preventDefault();
const input = document.getElementById("msg");
const text = input.value.trim();
if (!text) return;
input.value = "";
if (!conversationId) {
const res = await fetch("/conversations", { method: "POST" });
conversationId = (await res.json()).conversation_id;
}
addLine("You", text);
const botLine = addLine("Ava", "");
const res = await fetch("/chat", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ conversation_id: conversationId, message: text }),
});
const reader = res.body.getReader();
const decoder = new TextDecoder();
let reply = "";
while (true) {
const { done, value } = await reader.read();
if (done) break;
reply += decoder.decode(value, { stream: true });
botLine.textContent = `Ava: ${reply}`;
}
});
</script>
</body>
</html>

Start the server:

1
uvicorn app:app --reload

Open http://127.0.0.1:8000 and chat. That's a working, streaming, memory-aware chatbot in roughly 130 lines across two files.

(The textContent comment isn't decoration. Model output rendered with innerHTML is an XSS hole: a user can talk the bot into returning a <script> tag. If you later want Markdown formatting, run it through a sanitizer such as DOMPurify first.)

For a production widget with a launcher bubble, mobile layout and analytics, see our walkthrough on how to add AI chat to your website.

How much does an OpenAI chatbot cost to run?

Less than most people expect, if you pick the model deliberately.

Take a typical support chat: a 300-token system prompt, 10 back-and-forth turns, user messages around 50 tokens and replies around 150. Because earlier turns are re-billed as input each time, the 10 turns add up to roughly 12,500 input tokens and 1,500 output tokens.

Model

Cost per 10-turn conversation

Cost per 10,000 conversations

gpt-6-luna

~$0.002

~$20

gpt-6.1-sol

~$0.04

~$400

gpt-6-astra

~$0.20

~$2,000

These are estimates from list prices. They leave out reasoning tokens (billed as output) and cached-input discounts, which push in opposite directions. Measure your real numbers from response.usage after a week of traffic.

The pattern that matters: cost grows with conversation length, not just count, because every turn re-sends the history. Two ways to keep long chats in check:

  • Trim manual history. With Option A, keep the system prompt plus the last 10–20 items.
  • Turn on server-side compaction. Pass context_management=[{"type": "compaction", "compact_threshold": 200000}] and OpenAI compresses older context once the conversation crosses that token count.

Our full playbook on reducing LLM API costs covers caching, routing and batching in more depth. If you're budgeting a whole project rather than API calls, see what an AI chatbot costs to build in 2026.

Common mistakes (and the fix for each)

AttributeError: module 'openai' has no attribute 'ChatCompletion' You copied pre-2023 code. Use client = OpenAI() and client.responses.create().

400 Bad Request mentioning temperature GPT-6 models don't accept temperature, top_p or top_logprobs while reasoning is switched on. Remove them. Control tone through the system prompt instead. (On Luna you can set reasoning={"effort": "none"} if you really need sampling controls.)

The bot forgets its role after a few messages You only sent instructions on the first call. With previous_response_id, resend them every turn.

Replies stop mid-sentence max_output_tokens is too low. Reasoning tokens eat into it before visible text does. Raise the cap or lower the reasoning effort.

RateLimitError (429) under load The SDK retries automatically, but sustained traffic needs a queue or per-user rate limit on your side. Check your usage tier in the OpenAI dashboard.

Before you go live: a short production checklist

The tutorial bot works. A public bot needs a bit more:

  1. Authenticate users and rate-limit per user. An open /chat endpoint is a free LLM for the whole internet.
  2. Send a safety_identifier. It's a stable per-user ID (OpenAI recommends hashing the email or username) that helps OpenAI detect abuse coming through your app without flagging your whole account.
  3. Decide on data retention. Responses are stored for 30 days by default. For health, finance or other sensitive data, use manual history with store=False.
  4. Log every conversation on your side. You can't improve a prompt you can't read. Review 20 real chats a week and you'll find the gaps fast.
  5. Write a test set. Twenty questions with expected answers, run after every prompt change, catches regressions before customers do.
  6. Give the bot real knowledge. A system prompt can't hold your entire help center. That's what retrieval is for.

Where to go next: from chatbot to something useful

Right now Ava is polite but knows nothing about Brewly's actual policies or orders. The next two upgrades fix that:

  • Retrieval-augmented generation (RAG) lets the bot answer from your own documents. Upload them to a vector store and give the model the file_search tool, or build your own pipeline. Start with how RAG works, and if you're weighing it against training a custom model, read RAG vs fine-tuning.
  • Function calling lets the bot do things: look up an order, pause a subscription, book a call. At that point it stops being a chatbot and starts being an agent. Here's the difference in practice: AI agents vs chatbots.

Need a chatbot built for your business?

This tutorial gets you a working prototype in an afternoon. Getting from prototype to a bot that knows your products, connects to your CRM or order system, and holds up under real traffic is where most of the work lives.

That's the work our AI development team does: RAG chatbots, support agents and LLM integrations built in Python and FastAPI and shipped to production. Tell us what you're building and we'll tell you honestly whether you need us or this tutorial is enough.

Frequently Asked Questions

Is the OpenAI API free to use?+

No. The API is pay-as-you-go and billed separately from a ChatGPT subscription. You add credit or a payment method at platform.openai.com and pay per token. A small test chatbot on gpt-6-luna costs fractions of a cent per conversation.

Should I use the Responses API or Chat Completions for a new chatbot?+

Use the Responses API. OpenAI recommends it for all new projects. Chat Completions is still supported, but Responses adds server-side conversation state, built-in tools and better cache use.

Which OpenAI model is best for a chatbot?+

Start with gpt-6-luna for support and FAQ bots: it's the cheapest and fastest at $0.10 per 1M input tokens. Move to gpt-6.1-sol if answers need more reasoning, and keep gpt-6-astra for hard, high-value queries.

How does an OpenAI chatbot remember previous messages?+

The model itself is stateless. You either resend the history on every call, pass previous_response_id from the last reply, or attach a Conversation object that OpenAI stores for you. All three bill earlier turns as input tokens.

Can I put my OpenAI API key in frontend JavaScript?+

No. Anyone can open dev tools and copy it. Keep the key on a backend (like the FastAPI server in this tutorial) and let the browser talk only to your server.

How do I make the chatbot answer from my own documents?+

Add retrieval (RAG): store your documents in a vector store and give the model the file_search tool, or run your own retrieval and pass the matching passages into the prompt.

1 shares
Was this useful?

Technology Used

HTML5HTML5
JavaScriptJavaScript
Open AIOpen AI

Tags & Keywords

OpenAI APIChatbotAI ChatbotPythonFastAPIResponses APITutorial
VS
Written byVikash Singh

Sales and Marketing Team

View all posts

Continue with Blogs.

View all blogs
Best Tech Stack for a SaaS Startup in 2026 (Our Picks)
SaaS Development

Best Tech Stack for a SaaS Startup in 2026 (Our Picks)

Best Tech Stack for a SaaS Startup in 2026 (Our Picks) Short answer: the best tech stack for a SaaS startup in 2026 is TypeScript end to end. Next.js and React on the frontend, PostgreSQL for data, a managed auth provider, Stripe for billing, and Vercel or AWS for hosting. Add Python (FastAPI) only when your product does real AI or data work. Pick boring, popular tools, because your team and your AI coding assistant already know them. That's the whole recommendation. The rest of this guide explains why, where each piece breaks, and what we'd swap for different kinds of SaaS products. We've been building web apps , payment integrations and AI products at Craxinno since 2017, so the opinions below come from projects we've shipped, not from a vendor pitch. The Best SaaS Tech Stack for 2026 at a Glance Layer Our default pick Good alternative Switch when Language TypeScript Python (for AI/data services) You run models, RAG or heavy data pipelines Frontend Next.js + React SvelteKit, Remix Your team already ships fast in something else UI Tailwind CSS + shadcn/ui Material UI, Mantine You need a heavy enterprise data-grid look Backend / API Next.js route handlers or NestJS FastAPI, Hono A mobile app or third parties need a public API Database PostgreSQL (Supabase, Neon or AWS RDS) MySQL Almost never ORM Drizzle Prisma Your team prefers a schema-file workflow Auth Supabase Auth or Better Auth Clerk, Auth0 You need enterprise SSO out of the box Payments Stripe Paddle, Polar, Razorpay You want a Merchant of Record, or you bill in INR Hosting Vercel AWS, Railway, Coolify on a VPS Bills climb, or compliance needs a private cloud Email / analytics / errors Resend, PostHog, Sentry Postmark, Mixpanel, Better Stack Personal preference Why a "Boring" Tech Stack Wins in 2026 Two years ago the argument for popular tools was hiring. That still holds. But in 2026 there's a bigger reason: most of your code will be written or reviewed with an AI assistant, whether that's Cursor, Claude Code or GitHub Copilot. AI tools are very good at Next.js, PostgreSQL and Stripe. There are millions of public examples to learn from. They are noticeably worse at a niche framework that shipped a breaking change last quarter. So a mainstream stack now buys you speed twice: from humans and from machines. We see this on client projects every week. A founder arrives with an MVP built on an exotic combination (a new edge database, a beta auth library, a custom state manager). Each piece looked clever on its own. Together, nobody can debug them, and the AI assistant keeps suggesting code for the wrong version. The rule we follow: spend your novelty budget on the product, not the plumbing. Frontend: Next.js, React, TypeScript and Tailwind Next.js is the default SaaS frontend in 2026 for practical reasons. It handles your marketing site, blog, docs and logged-in dashboard in one codebase. Server rendering keeps your public pages fast and indexable, which matters if you plan to get customers from Google instead of only paid ads. Pair it with: TypeScript everywhere. Shared types between frontend and backend remove a whole class of bugs. Tailwind CSS for styling, and shadcn/ui for components you own and can edit, instead of a locked library. TanStack Query for data fetching on client-heavy screens. When would we skip Next.js? If your SaaS is a pure internal dashboard with no public pages and no SEO needs, a plain React + Vite single-page app is simpler to host and reason about. And if your team is already fast in Vue or Svelte, stay there. Switching frameworks to follow a blog post is a bad trade. Backend: Keep It in One Codebase as Long as You Can For most early SaaS products, the backend can live inside Next.js as route handlers and server actions. One repo, one deploy, one language. That's the fastest setup for a team of one to five developers. Split out a separate API when one of these becomes true: You're shipping a mobile app or browser extension that needs the same endpoints. Customers or partners need a documented public API. Long-running jobs (imports, reports, video or AI processing) start timing out serverless functions. At that point, NestJS or Hono keep you in TypeScript. If the heavy lifting is AI or data, use Python with FastAPI . It's where the AI libraries live, and FastAPI gives you typed, documented endpoints with very little code. We often run a TypeScript product app next to a small FastAPI service that only handles model calls, embeddings and data pipelines. It's a clean split that keeps each side in the language it's best at. Database: PostgreSQL, and Stop Worrying About It Use PostgreSQL. It handles relational data, JSON columns, full-text search, and vector embeddings through the pgvector extension . That last one matters: in 2026 most SaaS products add some AI search or retrieval feature, and Postgres lets you do it without a second database. Managed options that work well: Supabase if you want database, auth, storage and realtime in one place . Neon if you want serverless Postgres with database branching for preview environments. AWS RDS or Aurora if you're already on AWS or a client's security team requires it. Add Redis for caching, rate limits and sessions once you actually need it. Not on day one. What about MongoDB? It's fine for some products. But SaaS data is almost always relational: users belong to organizations, organizations have subscriptions, subscriptions have invoices. Forcing that into documents usually ends in painful joins written by hand. Pick MongoDB only if your core data really is schemaless. For the ORM, Drizzle is our current default because it stays close to SQL and is light on serverless. Prisma is still a solid choice with a gentler learning curve. Authentication: Don't Build It Yourself Login looks like a weekend task. Then come password resets, email verification, Google sign-in, magic links, two-factor auth, team invites, roles, and session security. Every hour on that is an hour not spent on the thing customers pay for. Supabase Auth is the easy pick if you're on Supabase already. Better Auth is an open-source TypeScript library that runs in your own app and database, with organizations and roles built in. Good for B2B SaaS. Clerk or Auth0 give you polished hosted UI and enterprise SSO, at a per-user price that grows with you. Check their pricing pages against your expected user count before you commit. Whichever you choose, design for multi-tenancy from the start: every row that belongs to a customer carries an organization ID, and every query filters by it. Retrofitting this later is one of the most expensive rewrites we see. Payments and Billing: Stripe, or a Merchant of Record Stripe is still the default for SaaS billing . Subscriptions, usage-based pricing, trials, coupons, invoices and the customer portal are all there. In the US its standard card fee is 2.9% + 30¢ per transaction . The real decision is whether you need a Merchant of Record like Paddle, Polar or Lemon Squeezy. They charge a higher fee, but they become the legal seller and handle global sales tax and VAT for you. For a solo founder selling to customers in dozens of countries, that's often worth it. For founders in India billing Indian customers, Razorpay handles UPI, cards and recurring payments in INR . Plenty of our clients run Razorpay for domestic customers and Stripe for international ones. It's more setup, but it covers both markets properly. One rule regardless of provider: treat webhooks as the source of truth for subscription status. Never trust the redirect after checkout alone. The AI Layer: What a 2026 SaaS Actually Needs Almost every SaaS brief we received this year had an AI feature in it . Smart search, a chat assistant over the customer's own data, document extraction, content generation. Here's the minimal setup that works: LLM APIs from Anthropic, OpenAI or Google, called through a thin wrapper so you can switch models without touching product code. pgvector in your existing Postgres for embeddings and retrieval (RAG) . You probably don't need a dedicated vector database until you're storing many millions of vectors. A job queue for anything slower than a few seconds. Trigger.dev or Inngest are simple for TypeScript teams. RabbitMQ or Celery fit Python-heavy pipelines. GPU hosting such as RunPod only if you run open-source or fine-tuned models yourself, for example image generation. Start with hosted APIs. Self-hosting models makes sense later, once you know your volume and the API bill is a real line item . Hosting and DevOps: Vercel First, AWS When It Pays Off Deploy to Vercel at the start. Git push, preview URLs for every branch, zero server management. For a pre-revenue startup that's the right trade. Move parts of the system to AWS (or GCP or Azure) when: Your hosting bill grows faster than your revenue. Enterprise customers ask for data residency, a VPC or specific compliance controls. You run background workers, queues or GPU jobs that don't fit serverless. A middle path that's grown popular: Coolify or Railway on top of a cheap VPS, which gives you a Vercel-like workflow at server prices. What to skip early: Kubernetes and microservices. A modular monolith with clear folders for billing, auth and each product area will carry you far further than most founders expect. You can split services when a real scaling problem shows up, and you'll know exactly where the seams are by then. The Supporting Tools Every SaaS Needs Before Launch Email: Resend or Postmark for transactional email, with React Email for templates. Product analytics: PostHog. It covers events, funnels, session replay and feature flags in one tool. Error tracking: Sentry. You want to hear about a failed checkout before the customer emails you. File storage: any S3-compatible bucket, such as AWS S3 or Cloudflare R2. CI: GitHub Actions running type checks, tests and migrations on every pull request. Most of these have free tiers. Before launch, your monthly stack bill can be close to zero beyond a domain name. Best Tech Stack by SaaS Type Type of SaaS Recommended stack B2B dashboard / workflow tool Next.js, NestJS or route handlers, PostgreSQL, Better Auth with organizations, Stripe, Vercel AI-first SaaS Next.js frontend, FastAPI service, PostgreSQL + pgvector, job queue, LLM APIs, AWS or Railway for workers Mobile-first SaaS React Native (Expo) + Next.js web , shared TypeScript API, Supabase, RevenueCat or Stripe Marketplace Next.js, PostgreSQL, Stripe Connect, Redis, background jobs for payouts and notifications Data / analytics SaaS Next.js, Python ETL pipelines, PostgreSQL plus a warehouse or Parquet files for heavy queries India-focused SaaS Next.js, PostgreSQL, Razorpay subscriptions, AWS Mumbai region for data locality Six Tech Stack Mistakes We See SaaS Founders Make The Frankenstein stack. Auth from one vendor, database from another, a third tool syncing users between them. Pick tools that work together. Microservices at ten users. You'll spend months on infrastructure that a single app handles easily. Building auth and billing from scratch. Use the services above and ship the product. Skipping multi-tenancy. Adding organization IDs to every table after launch is slow and risky. Choosing by hype. A framework trending this month is not a reason to bet your company on it. No monitoring until something breaks. Sentry and PostHog take an afternoon to set up. Do it before launch. Need Help Picking or Building Your SaaS Stack? The best tech stack for a SaaS startup is the one your team can ship and maintain without a fight. If you're planning a SaaS product and want a second opinion on architecture, or a team to build the MVP , Craxinno designs and ships full-stack web apps, AI features and payment integrations for startups worldwide. Browse more engineering guides on the Craxinno blog .

Posted 05.11.2026
What Does It Cost to Hire a Dedicated Development Team? (2026)
Dedicated Development Team

What Does It Cost to Hire a Dedicated Development Team? (2026)

Short answer: a dedicated development team costs between $10,000 and $200,000+ per month in 2026. The spread comes down to two things: where your engineers sit and how many of them you need. A small MVP team of 3–4 people runs roughly $9,000–$26,000 a month offshore (India, Ukraine, Poland) and $30,000–$45,000 in the US. That range is wide enough to be useless on its own. So below you'll find the actual hourly rates by region and role, three real team configurations priced out, the hidden costs that quietly add 20–30% to most quotes, and a simple formula to calculate your own budget before you talk to a single vendor. We run a dedicated-team practice at Craxinno , a Jaipur-based studio that has been building software since 2017. We'll show you our own pricing too, so you have one number in the market that isn't hidden behind a "contact us" button. Dedicated Development Team Cost at a Glance (2026) Here's the monthly cost of one full-time engineer (about 160 billable hours) by region. These figures come from 2026 market surveys published by outsourcing vendors including N-iX/Ncube and Integrio . Region Hourly rate Monthly cost per developer North America $100–$175 $16,000–$28,000 Western Europe $75–$120 $12,000–$20,000 Eastern Europe $45–$80 $7,500–$13,000 Latin America $35–$65 $6,000–$11,000 South & Southeast Asia (India, Vietnam) $25–$50 $4,000–$8,500 Notice the gap. A senior engineer in San Francisco and a senior engineer in Jaipur can ship the same React app. One costs you roughly four times more per month. That's the whole reason the dedicated team model exists. What Is a Dedicated Development Team, Exactly? A dedicated development team is a group of engineers, designers, and QA specialists hired through a vendor who work only on your product, full-time, for months or years. You direct the work. The vendor handles hiring, payroll, office, equipment, HR, and replacements. Here's how it compares with the other ways to hire: Fixed-price project: you agree on a scope and a price up front. Good for a defined MVP . Painful when requirements change (and they always change). Staff augmentation: you rent one or two engineers to plug gaps in your existing team. Dedicated team: you get a full, stable unit (developers, QA, often a PM) that behaves like your own in-house department. In-house hiring: you recruit and employ everyone yourself , with salaries, benefits, recruiting fees, and months of hiring time. If your product will need continuous development for six months or longer, the dedicated model is usually the cheapest way to get a team that actually knows your codebase. Hourly Rates by Role (2026) Not every seat costs the same. A DevOps engineer is priced very differently from a junior front-end developer. Here are typical 2026 hourly rates across the three most popular outsourcing regions: Role Asia Latin America Eastern Europe Junior developer $12–$22 $15–$25 $20–$35 Mid-level developer $22–$38 $30–$50 $40–$65 Senior developer $38–$60 $55–$80 $65–$100 QA engineer $15–$30 $20–$40 $25–$55 DevOps engineer $30–$55 $45–$75 $55–$90 Project manager $25–$45 $35–$60 $45–$75 One practical tip: you rarely need an all-senior team. A ratio of roughly one senior to two mid-level developers keeps code quality high and can bring your blended rate down by as much as 20%. The senior reviews, the mid-levels build. It works. How Much Does a Dedicated Team Cost Per Month? 3 Real Configurations Rates are abstract. Teams are what you actually pay for. Here's how the monthly bill looks for three common setups. 1. Small MVP team (3–4 people) Who's on it: 2–3 developers (say, one React and one Node.js), a QA engineer (often part-time), and a part-time PM. Region Monthly cost USA $30,000–$45,000 Eastern Europe (Poland, Ukraine) $9,000–$18,000 Asia (India) $10,000–$26,000 This is the team for getting a first version in front of users in 3–4 months. You'll want your own product owner or tech lead making decisions; the team executes. 2. Mid-size SaaS team (6–9 people) Who's on it: a PM, a business analyst, 2 front-end developers, 1–2 back-end developers, a UI/UX designer, manual and automation QA, and a DevOps engineer. Region Monthly cost USA $80,000–$120,000 Canada $65,000–$95,000 Poland $35,000–$50,000 Asia $24,000–$56,000 At this size you're running a real product : weekly releases, a proper CI/CD pipeline, and someone whose whole job is making sure nothing breaks in production. 3. Enterprise team (10+ people) Who's on it: a tech lead or architect, PM, BA, 5–6 developers across stacks, UI/UX, 2 automation QA, DevOps, and a cloud engineer. Often split into pods per product area. Region Monthly cost USA $150,000–$220,000 Eastern Europe $45,000–$95,000 Asia $55,000–$120,000+ What We Charge at Craxinno (Real Numbers) Most agency articles on this topic end with "contact us for a quote." We'd rather just tell you. Craxinno bills dedicated engineers at $25 per hour . At a standard 160-hour month, that's $4,000 per full-time team member . So: 2 developers (starter pod): about $8,000/month 3 developers + 1 QA (MVP team): about $16,000/month 5 developers + QA + designer (growth team): about $28,000/month Same rate across web, mobile, AI/GenAI, and cloud work . No AI premium, no separate line for the account manager. If you're comparing quotes, put this number next to the others and ask each vendor what's included. That question alone tells you a lot. What Drives the Cost Up (or Down)? Location is the biggest lever. It isn't the only one. Tech stack. Common stacks like React, Node.js, Laravel, or Python/Django have deep talent pools and stable rates. Niche skills (Rust, blockchain, computer vision, LLM fine-tuning) cost more because fewer people can do them well. Some vendors add a 20–30% premium for AI/ML pods . Seniority mix. Covered above. An all-senior team is a luxury most products don't need. Engagement length. Commit to 6–12 months and many vendors drop their monthly rate by 10–15%. Month-to-month flexibility costs extra. Who leads. A vendor that provides a CTO-level architect who makes technical decisions charges 15–25% more than an execution-only team. Worth it if you don't have a technical co-founder. Wasted money if you do. Time-zone overlap. Want your offshore team online for your entire US workday? Expect to pay for night-shift coverage. A 3–4 hour overlap window is usually enough, and it's free. The Hidden Costs Most Founders Miss You get a quote of $16,000/month. You budget $16,000/month. Three months later you've spent closer to $20,000 a month and you're not sure where it went. A safe rule: add 20–30% to any quote to cover these. Ramp-up time. Expect 2–4 weeks at full cost before the team hits full speed. They're reading your code and learning your domain. Your own management time. Someone on your side (founder, PM, or tech lead) will spend 3–8 hours a week on reviews, priorities, and answering questions. That time isn't free. Tooling and infrastructure. Jira, GitHub seats, Figma, staging servers, AWS bills, monitoring. These add up on long projects. Roles billed separately. Some vendors quote developer rates only , then add QA, DevOps, and PM on top. A vendor PM alone can add $2,000–$5,000/month. Get it in writing. Replacement fees. If an engineer leaves, some vendors charge to replace them. Good ones don't. Legal and compliance. Contract review, NDAs, IP assignment, and security audits if you're in healthcare, fintech, or another regulated space. Dedicated Team vs. In-House Hiring: The Real Comparison A senior software engineer in the US commonly earns well into six figures. Then add benefits, payroll taxes, equipment, office space, and a recruiter fee that's often 15–25% of first-year salary. And you'll wait 2–3 months to fill each seat. A dedicated team skips most of that. No recruiting fees, no benefits, no severance. You can usually start within 1–3 weeks and scale up or down with a month's notice. The trade-off is control and context. Your in-house engineers sit in your Slack all day and absorb the business. A dedicated team needs clear documentation, regular calls, and a single point of contact on your side. Give them that and the gap closes fast. Factor In-house team Dedicated team Freelancers Time to start 2–4 months 1–3 weeks Days Hiring & HR overhead You Vendor You Scaling up/down Slow, costly ~1 month notice Fast, unstable Long-term product knowledge High High Low Replacement if someone leaves You re-hire Vendor replaces Start over How to Calculate Your Dedicated Team Budget Use this formula before you request any quotes: Monthly budget = (number of team members × hourly rate × 160) × 1.25 The 1.25 covers the hidden costs above. Example: a team of 4 at $25/hour = 4 × 25 × 160 = $16,000, times 1.25 = $20,000/month all-in . Multiply by your expected timeline ( an MVP usually takes 3–6 months ) and you have a real number to take to your board, your co-founder, or your bank. Then work backwards: Define the first milestone. Not the full product. Just the first version real users can touch . List the roles that milestone needs. A mobile app needs a mobile developer. A data dashboard needs a back-end developer who's comfortable with SQL. Don't hire roles you won't use for 3 months. Pick your region based on budget, time-zone needs, and language. Run the formula. If the number's too high, cut scope before you cut seniority. How to Reduce Costs Without Hurting Quality Start smaller than you think. Two good engineers for the first month will tell you more about the vendor than any sales call. Use a blended seniority mix. One senior for every two mid-level developers. Sign a longer commitment once the trial month goes well, to unlock a 10–15% discount. Write things down. Clear tickets and a short product spec cut ramp-up time in half. Vague tickets are the most expensive thing in outsourcing. Own the repo and cloud accounts from day one. It costs nothing and saves you a painful handover later. Red Flags When Choosing a Dedicated Team Provider They won't share hourly rates until after three calls. You can't interview the actual engineers who'll work on your project. The contract doesn't clearly assign IP and source code to you. There's no trial period or a very long notice period to exit. They quote a fixed "team price" but won't say which roles it includes. Every portfolio project looks like a template . The single best question to ask any vendor: "Who reviews the code and makes architecture decisions on my project?" If the answer is vague, the price doesn't matter . So, What Should You Budget? If you're a startup building an MVP, plan for $9,000–$26,000 a month with an offshore team in India, Southeast Asia, or Eastern Europe. If you're scaling an existing SaaS product , plan for $25,000–$60,000 offshore. And if you're hiring in the US, multiply those numbers by three or four. Want an exact figure for your project? Talk to the Craxinno team . Tell us what you're building and we'll send you a team plan with roles, timeline, and a monthly cost based on our $25/hour rate. You can also browse more guides on our blog .

Posted 04.11.2026
Headless CMS vs Traditional CMS: Which Is Right for You? (2026)
Next.js

Headless CMS vs Traditional CMS: Which Is Right for You? (2026)

Quick answer: Choose a traditional CMS (like WordPress, Wix or Shopify) if you need a marketing site or store live fast, on a modest budget, managed by non-technical editors. Choose a headless CMS (like Sanity, Contentful, Strapi or Storyblok) if you publish the same content to several channels — website, mobile app, kiosks, AI assistants — need top-tier performance, or want full control over the front end with a developer team to support it. If you're somewhere in between, a hybrid setup (such as headless WordPress with a Next.js front end) often gives you the best of both. The rest of this guide explains the trade-offs in plain terms, shows real 2026 numbers, and ends with a five-question test you can use to make the call in minutes. What is a traditional CMS? A traditional (or "monolithic" / "coupled") CMS keeps everything in one system: the database where content lives, the admin panel where editors write, and the theme that renders pages for visitors. You write a post, pick a template, press publish — and the CMS builds the page. WordPress, Drupal, Joomla, Wix, Squarespace and Shopify all work this way by default. Traditional CMSs still run a huge share of the web. According to W3Techs (October 2026), WordPress powers about 39.5% of all websites and 58.3% of sites using a known CMS , followed by Shopify (5.3%) and Wix (4.2%). That popularity matters: it means a large talent pool, thousands of themes and plugins, and answers to almost any problem a quick search away. Strengths Fast to launch — themes and page builders get a site live in days. Editor-friendly — what you see in the editor is close to what visitors see. Low starting cost — cheap hosting and free or low-cost plugins. Huge ecosystem — SEO, forms, e-commerce and analytics plugins out of the box. Weaknesses Front end and back end are tied together, so big design changes often mean fighting the theme. Plugin sprawl slows sites and adds risk. Patchstack's State of WordPress Security report counted roughly 8,000 new vulnerabilities in the WordPress ecosystem in 2024, with the vast majority in plugins , not WordPress core ( SecurityWeek coverage ). Content is shaped around pages , which makes reusing it in an app, a smartwatch or an AI chatbot awkward. What is a headless CMS? A headless CMS removes the "head" — the presentation layer. It stores and organises content, then serves it through an API (REST or GraphQL). Developers build the front end separately, usually with frameworks like React or Next.js , and pull content from the API. Think of it like a restaurant kitchen that no longer has its own dining room. The kitchen (your content) can now deliver to a website, a mobile app, a digital signboard and a voice assistant — all from one source. Popular options in 2026 include Sanity, Contentful, Strapi, Storyblok, Payload and Hygraph. Strengths Omnichannel by design — write once, publish everywhere. Front-end freedom — use any framework and design without theme limits. Performance — static generation, edge caching and modern frameworks make very fast pages achievable. Smaller attack surface — the public site doesn't expose an admin panel or plugin layer. Structured content — clean, typed fields that are easy to feed into search, personalisation and AI tools. Weaknesses Needs developers to build and maintain the front end. Higher upfront cost and longer build time. Editors can lose live visual preview unless the team sets it up (most leading platforms now offer visual editing, but it takes configuration). More moving parts — hosting, API, front end and build pipeline to manage. Headless vs traditional CMS: side-by-side comparison Factor Traditional CMS Headless CMS Architecture Content + presentation in one system Content backend only; front end built separately via API Time to launch Days to a few weeks Several weeks to months Upfront cost Low Medium to high Editor experience Visual, familiar, WYSIWYG Form-based by default; visual editing needs setup Design flexibility Limited by theme/builder Unlimited Performance Good with tuning; plugin bloat is common Excellent potential with static/edge delivery Security Larger attack surface (plugins, admin exposed) Smaller public attack surface Multi-channel delivery Difficult Built in Scalability Needs caching and hosting upgrades Scales well via CDN and decoupled services SEO Easy via plugins Excellent, but developers must implement meta, sitemaps, schema Developer dependency Low High Best for Blogs, brochure sites, small stores Products, apps, multi-brand, high-traffic platforms Is a headless CMS better for SEO? Not automatically. A headless CMS gives you the potential for better SEO because you control every line of HTML and can ship very fast pages — and page experience and Core Web Vitals do matter. But a traditional CMS gives you SEO basics for free : plugins handle meta titles, XML sitemaps, canonical tags, redirects and schema markup. In a headless build, developers must build each of these. Teams that skip this step often launch a beautiful, fast site that ranks worse than the old WordPress one. Rule of thumb: headless wins on SEO when your team implements server-side rendering or static generation, plus metadata, sitemaps, structured data and redirects from day one. If no one owns that work, stay traditional. What does each option really cost in 2026? Exact numbers depend on scope, but here's how the costs are shaped differently: Traditional CMS Build: theme customisation and plugin setup — lowest upfront cost. Running costs: hosting, premium plugins/themes, and regular updates. Hidden cost: plugin maintenance, security patching and performance clean-ups as the site grows. Headless CMS Build: content modelling, a custom front end and integrations — higher upfront cost. Running costs: CMS subscription (many have free tiers; paid plans rise with users, locales and API usage), front-end hosting (e.g. Vercel, Netlify or AWS) and developer time. Hidden cost: every new page type or feature usually needs developer work. The honest takeaway: a traditional CMS is cheaper to start . A headless CMS can be cheaper to scale when you're serving multiple channels or high traffic, because you avoid rebuilding content for each platform. When should you choose a traditional CMS? Pick a traditional CMS if most of these sound like you: You need a website live in weeks, not months. Your content team is non-technical and wants to publish without help. You only publish to one website. Your budget is limited and you don't have in-house developers. You need a standard blog, company site, portfolio or small online store. Example: A local clinic, restaurant or consultancy that needs a fast, good-looking site with a blog and contact form. WordPress or Wix will do the job well at a fraction of the cost. When should you choose a headless CMS? Pick a headless CMS if most of these sound like you: You publish to a website and a mobile app (or more channels). You run multiple brands, regions or languages from one content hub. Performance and design control are business-critical — for example, high-traffic marketing or e-commerce. You have (or can hire) developers comfortable with React, Next.js or similar. You want to feed structured content into search, personalisation or AI assistants. Example: A SaaS company with a marketing site, docs, in-app help and a mobile app — all pulling the same product content from one headless CMS so every channel stays in sync. The middle path: hybrid and headless WordPress You don't have to pick an extreme. Two popular in-between options: Headless WordPress — keep WordPress as the editing backend your team already knows, and build the front end in Next.js using the WordPress REST API or WPGraphQL. You keep the familiar editor and gain speed and design freedom. Hybrid CMS — platforms that offer both a traditional page-building experience and content APIs, so marketers get visual editing while developers get API access. This is often the smartest route for businesses already invested in WordPress who want a faster, more modern front end without retraining their editors. The 5-question test: which CMS is right for you? Answer yes or no: Will your content appear on more than one channel (site, app, kiosk, AI assistant) in the next 12–24 months? Do you have, or plan to hire, front-end developers ? Is page speed or custom design a direct revenue driver for you? Do you manage multiple brands, regions or languages ? Is your budget and timeline flexible enough for a longer build? 0–1 yes → Traditional CMS. Speed and simplicity win. 2–3 yes → Hybrid / headless WordPress. Keep your editors happy and modernise the front end. 4–5 yes → Headless CMS. You'll grow into its flexibility. Thinking about migrating? A quick checklist Moving from a traditional to a headless CMS is where many projects lose traffic. Protect yourself: Audit content first — remove what's outdated before you migrate it. Design the content model — turn pages into reusable fields and content types. Map every URL and set up 301 redirects for any that change. Rebuild SEO essentials — metadata, sitemaps, canonicals and schema. Set up previews so editors can see changes before publishing. Migrate in phases — start with one section, measure, then expand. Benchmark before and after — compare rankings, traffic and Core Web Vitals. Frequently asked questions Is WordPress a headless CMS? Not by default — it's a traditional CMS. But it can be used headlessly through its REST API or WPGraphQL, with a separate front end built in a framework like Next.js. Is a headless CMS more secure? Generally, yes, for the public site. Because the content backend isn't directly exposed to visitors and there's no plugin-heavy theme layer, the attack surface is smaller. You still need to secure API keys, user roles and hosting. Is headless CMS good for small businesses? Usually not as a first website. Most small businesses get better value from a traditional CMS. Headless makes sense once you need multiple channels, very high performance or custom experiences. Does a headless CMS help with AI search and chatbots? It can. Structured, well-labelled content is easier to feed into AI assistants, RAG systems and personalisation tools than page-based HTML. That said, no CMS guarantees visibility in AI search results — content quality still matters most. How long does a headless CMS project take? It depends on scope, but expect longer than a theme-based site because the front end is built from scratch. A focused marketing site can take a few weeks; a multi-channel platform can take months. Can I switch from a traditional CMS to headless later? Yes. Many teams start on WordPress and later move to headless WordPress or a dedicated headless CMS. Planning a clean content structure early makes that move much easier. Final verdict There's no universal winner in the headless CMS vs traditional CMS debate — there's only the right fit for your team, budget and growth plans. Need speed, simplicity and a low budget? Go traditional. Need omnichannel delivery, performance and design control? Go headless. Want both? Go hybrid or headless WordPress. Not sure which path fits your project? Craxinno's web development team designs and builds both — fast WordPress and Shopify sites, and custom headless builds with React and Next.js. Talk to our team and we'll help you pick the right architecture before you commit to a build.

Posted 29.10.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.