Skip to content
Anton GoncharovAI systems developer

Web app · AI economics · vanilla JS

AI bot cost calculator

Before launching a bot, the client asks: “How much will it cost per month?” The answer depends not on the number of customers but on tokens: the length of the instructions, the retrieved knowledge base fragments, the conversation history and the answers. The calculator breaks the bill into these parts and shows what prompt caching, a shorter context or routing simple questions to a cheap model gives you.

Scenario: Three typical scenarios: a knowledge base support bot, a lead qualification bot and an agent with tools. You can set your own numbers.

Demo screenshot: AI bot cost calculator

Open the demo

The calculation is saved in the page URL — you can send the link to a colleague. Prices can be edited right in the table.

The app runs in your browser: nothing is sent to a server.

What the demo shows

  • Bot parameters: conversations per month, messages per conversation, system prompt, knowledge base fragments, answer length, cache and history

  • The cost of a conversation and a month in rubles for each part: instructions, context, history, answer

  • All models on one chart: GPT, Claude, YandexGPT, GigaChat and an open model on a rented GPU

  • A price table with dates and sources; your own prices go into the calculation and the link

  • Tips with recalculation: prompt caching, fewer fragments, shorter history, simple questions to a cheap model

  • An o200k tokenizer, as in GPT-4o and newer, runs in the browser in a background thread and matches the reference tiktoken

  • Russian vs. English text: in Russian the same meaning takes more tokens

How to try it

  1. Choose a scenario

    “Support”, “Lead qualification” or “Agent with tools” — the parameters are filled in automatically.

  2. Compare models

    The chart shows a month on each model, and the selected model shows what the bill is made of.

  3. Count your own text

    Load the o200k vocabulary (3 MB) and paste a system prompt — the calculator counts the tokens and puts them into the calculation.

  4. Send the link

    The page URL keeps all parameters and price edits: a colleague opens the same calculation.

No paid neural networks

The calculator sends nothing to neural networks: tokens are counted by its own tokenizer in the browser. Prices were collected on October 10, 2026, with dollar prices converted at the Central Bank rate on the same date. Prices change — check them on the providers’ websites before budgeting. For Claude, YandexGPT and GigaChat the token count is estimated with o200k plus a correction: they have their own tokenizers.

The demo runs without OpenAI, YandexGPT or GigaChat API keys. Wherever a production system calls a model, there’s a local stub with the same interface — so the demo is free, always available and never makes things up.

What a production project adds

  • Budget calculation before development: scenarios, load, model choice and headroom for growth
  • Tracking actual tokens in a running bot and a spending report by day and scenario
  • Prompt caching, history compression and routing questions between a cheap and a strong model
  • Comparing cloud models with your own on a rented server by price and answer quality

Stack

  • JavaScript without frameworks
  • BPE tokenizer
  • Web Worker
  • SVG
  • URLSearchParams
  • JSDoc
  • Vite

Based on

Books and university courses whose ideas are at work in this demo.

  • Book · John Berryman, Albert Ziegler

    Prompt Engineering for LLMs

    The calculation shows what the context is made of — instructions, knowledge base fragments, history, answer — and what each part costs in tokens.

  • Book · George S. Clason

    The Richest Man in Babylon

    Before launching a bot I calculate what it will cost per month and show how to pay less: prompt caching, fewer fragments, a cheaper model for simple questions.

Developer’s comment

Anton Goncharov

AI systems developer · Python

For business

  • The model budget is known before development — and you can see what it’s made of.
  • Often the better deal isn’t a cheap model but a short context and prompt caching: the advice is recalculated instantly.
  • The estimate lives in the URL — you can send it to the CFO.

For developers

  • A custom byte-level BPE with the o200k vocabulary in a Web Worker; a test against a reference checks it matches tiktoken.
  • All parameters are in the page URL, so the estimate survives reloads and forwarding.
  • Charts are plain SVG without libraries; types are JSDoc checked by tsc.

Tips

  • Tip 01

    Count tokens with a real tokenizer on your own texts: Russian takes noticeably more tokens than you’d expect.

  • Tip 02

    Put the unchanging part of the prompt first — then prompt caching kicks in.

Want the same for your business?

Tell me about your task — I’ll tell you what from the demo fits, how long it will take and what I’ll need from you.

Other demos in this section

All demos
  • Web app · agent diagram

    live

    AI agent builder

    A support agent is assembled from blocks: intents, a knowledge base, API calls, checks and operator handover. Send a customer message and watch its path light up on the diagram step by step.

    • React
    • TypeScript
  • Web app · question → SQL → chart · PostgreSQL in the browser

    live

    AI data analyst

    A manager asks in plain words — “revenue by channel for Q3”, “which customers stopped ordering” — and gets SQL, a chart, a table and a conclusion. The sales database is real PostgreSQL running right in the browser.

    • React
    • TypeScript
  • Web app · risks against a standard · Word with tracked changes

    live

    Contract review

    A counterparty sent their own contract — the review compares it with the company’s standard, highlights risky clauses, explains why they’re dangerous and suggests wording. The output is a Word file with tracked changes and a disagreement protocol.

    • React
    • TypeScript
  • Web app · tasks from chat · kanban · evening digest

    live

    AI agent in a team chat

    People write in the team chat as usual — “Pete, fix the price list by Friday”. The agent creates a task on the kanban board, moves it through “On it” and “Done”, reschedules and reassigns tasks, reminds about overdue work in the morning and sends a digest in the evening.

    • React
    • TypeScript
  • Web app · shared inbox · CRM · protection against bank detail fraud

    live

    AI inbox triage

    The agent reads the sales team’s shared inbox: it understands what each email is, extracts fields, creates a deal, a ticket or a task in the CRM and drafts a reply. An invoice with new bank details or a phishing email is caught before anyone pays or clicks a link.

    • React
    • TypeScript
  • Web app · marketplaces · moderation check · unit economics

    live

    Product listings for WB and Ozon

    The agent turns a supplier’s text into two listings — for Wildberries and for Ozon: a title within the marketplace limit, a description with search keywords, attributes from the reference lists. Then it checks what listings usually fail moderation on and calculates what’s left from each sale.

    • React
    • TypeScript
  • Web app · meeting transcript · minutes · kanban

    live

    Meeting minutes → kanban tasks

    The agent reads a stand-up transcript and builds the minutes: decisions, tasks with an assignee and deadline taken from live speech, risks and open questions. Tasks go to the kanban board, and at the next meeting the agent moves them through statuses itself.

    • React
    • TypeScript
  • Web app · personal data · healthcare · analytics

    live

    Anonymizing data before it reaches a neural network

    The agent finds full names in any grammatical case, phones, passports, SNILS numbers, cards, addresses and diagnoses in emails and transcripts, replaces them before sending to an external neural network, and restores its answer to the real data on your side. It anonymizes a patient table for analytics so that nobody can be identified.

    • React
    • TypeScript
  • Web app · automation · amoCRM, 1C, Telegram

    live

    An n8n-style automation pipeline

    Three working scenarios of a furniture factory on a canvas, as in n8n: website leads go to amoCRM and to managers by lead temperature, YooKassa payments go to 1C with retries and an error branch, and every morning there’s a digest for the director. Trigger an event and watch records flow from node to node; the workflow can be edited and exported to real n8n.

    • React
    • TypeScript
  • Web app · multi-agent system · content

    live

    A team of AI agents for content

    Six agents prepare a publication from a brief: the editor-in-chief plans, the researcher finds facts in the knowledge base, the writer writes, the fact-checker and editor send the draft back for revision, and the SMM agent adapts the text for Telegram, VK, a newsletter, a blog and a carousel. You see the agents’ entire conversation, every edit and what would have been published without checks.

    • React
    • TypeScript
  • Web app · HR · scoring and chatbot

    live

    CV screening and an interviewer bot

    Twenty CVs for three vacancies are analyzed in seconds: employment periods, experience, salary and city, match with the requirements and a quote from the CV for every “yes” or “no”. What’s missing from the CV is clarified by a bot: it asks only the missing questions, follows up on vague answers and books an interview. Gender, age and family are left out of the assessment.

    • React
    • TypeScript
  • Web app · RAG · neural network in the browser

    live

    Search sandbox

    How a support bot finds an answer in a knowledge base: documents are cut into fragments, search runs by keywords, by meaning or as a hybrid, and every fragment found shows why it ranks above the others.

    • React
    • TypeScript
    • In-browser neural network
  • Web app · metrics · CI thresholds

    live

    Bot quality evaluation

    Before a new bot configuration is rolled out, it’s run against control questions. Here you can see how that works: hit@1, hit@3, the share of correct refusals, a comparison with production and a red banner if CI would block the release.

    • React
    • TypeScript
    • In-browser neural network
  • Web app · AI security · vanilla JS

    live

    Prompt injection defense trainer

    Try to trick a support bot: coax out a secret promo code, extract the system prompt or get a refund without grounds. Six defense levels, direct attacks and attacks via emails, reviews and the knowledge base, and a check log based on the OWASP Top 10 for LLMs.

    • Vanilla JS