Skip to contentTalk to us
AI fundamentals

What AI features cost to run: tokens, caching and usage limits

How AI running costs work in your app: tokens in and out, why Arabic can cost more, caching tricks, and usage limits that protect your budget.

Fanann Team9 min read
WhatsApp
Quick answer

AI features are usually billed by tokens: what you send the model (instructions, context and the user's message) and what it sends back, multiplied by the provider's price per million tokens, with output usually priced higher than input. The biggest cost driver is long context repeated on every request. Caching, using a smaller model for easy tasks, shorter answers and per-user daily limits keep costs predictable.

People look for this as
  • how much does it cost to run ai in an app
  • what is a token in ai pricing
  • how to reduce llm api costs
  • do arabic prompts use more tokens
  • prompt caching explained

How much does it cost to run AI in your app?

If you are asking what AI features cost to run in your app, the basic rule is simple: you pay the model provider by the number of tokens it reads and writes. Every request your app sends contains fixed instructions, context (products, documents, chat history) and the user's message, and every answer the model returns is billed too. There is no single number that fits everyone, but you can estimate your cost with reasonable accuracy before launch.

This is separate from the cost of building or hosting the app. It is a variable running cost that grows with usage, which is why it needs a plan from day one. For the cost of building itself, see How much it costs to build an app with AI.

Cost componentWhen it appliesNote
Input tokensEvery requestIncludes instructions, context and the user's message
Output tokensEvery answerUsually priced higher than input
EmbeddingsWhen indexing content for semantic searchMostly one-off, then on updates
Vector storageSemantic search and RAGPart of your database cost
Special featuresImages, audio, toolsBilled differently depending on the provider

What is a token, and why can Arabic cost more?

A token is the unit a model splits text into: a whole word, part of a word or a punctuation mark. In English, a common word is often a single token. Arabic words carry prefixes and suffixes (one Arabic word can mean 'and they will write it'), and many tokenizers break them into more pieces, so Arabic text can use more tokens for the same meaning on some models.

The gap varies a lot between models, and newer models have improved on Arabic. So don't rely on a rule of thumb: take ten real messages from your customers, send them to the model you plan to use, and log the actual token counts. That number matters more than any published estimate. For more on Arabic performance, read Arabic language models.

How to estimate your monthly bill before launch

Estimating does not require complicated spreadsheets. You need four numbers from your own tests, plus the price of your chosen provider from its official pricing page:

  1. 1
    Average input tokens per request

    Instructions + context + user message. Measure it from twenty test requests.

  2. 2
    Average output tokens per request

    The real answer length. A three-bullet summary is far shorter than an open chat reply.

  3. 3
    Requests per active user

    A support chat may contain several messages, and each message is a separate request that resends the context.

  4. 4
    Monthly active users

    Use a conservative estimate, then double it to test the worst case, especially for seasons like Ramadan and White Friday.

  5. 5
    Multiply and add a buffer

    (input × input price + output × output price) × requests × users, then add a buffer for testing, errors and retries.

An illustrative example without prices: a 6-message support chat where every message resends an 800-token system prompt plus the full history. By the sixth message, input may be several thousand tokens for a short reply. That shows how accumulated context, not the answer, is what drives the bill.

Seven ways to cut AI costs without losing quality

  1. Cache repeated results: a product's review summary or the answer to a common question (opening hours, return policy) does not need regenerating every time.
  2. Use prompt caching: many providers discount the fixed, repeated part of a request; always put fixed instructions first.
  3. Trim chat history: send the last few messages plus a short summary of earlier ones, not the full log.
  4. Send only relevant context: in RAG, three relevant passages beat a whole document on both quality and cost. Respect the context window; don't fill it just because it is there.
  5. Use a smaller model for easy tasks: classification, extraction and text normalization don't need the strongest model. Keep the big one for hard tasks.
  6. Cap answer length: ask for a fixed format and a max-token limit, since output is usually the pricier part.
  7. Batch non-urgent work: writing 200 product descriptions or tagging yesterday's tickets can run overnight in one go, and some providers offer lower prices for batch processing.
The cheapest token is the one you never sent.

Which limits should you set before launch?

An AI feature with no limits is an open invitation to surprises: one user pastes an entire book, or a bot fires thousands of requests at the chat widget on your site. Limits are not stinginess; they protect your business.

LimitWhat it preventsA sensible starting point
Per-user daily capHeavy use from a single accountA reasonable message count, then a friendly 'come back tomorrow'
Message length capHuge pasted textsTruncate long input or summarize it first
Anonymous visitor capBotsPhone (OTP) sign-in before heavy use
App-wide daily budgetA surprise billAn alert as you approach it, plus a fallback reply once exceeded
Retry capCostly error loopsTwo retries, then a clear error message

What to monitor after launch

Total cost alone tells you little. Tie it to business value so you know whether the feature is worth what you pay:

  • Cost per support conversation compared with an agent handling the same chat.
  • Cost per completed order when the assistant helps sell.
  • Share of requests served from cache: the higher it is, the lower your cost.
  • Top ten users by consumption: real customers or abuse?
  • Response time ([latency](/{lang}/wiki/glossary/latency/)): bigger models are usually slower, and slowness kills the experience on mobile.

Review these numbers weekly in the first month, then monthly. If costs jump suddenly, start by looking for instructions that grew longer or context that started being sent in full after a change.

Build AI features with predictable costs in Fanann

When you build an AI feature in Fanann, ask the agent to include cost controls in the plan itself, not as an afterthought: caching, per-user limits, a usage log in your admin dashboard, and an automatic fallback reply once the budget is exceeded. That way you launch knowing the ceiling.

Prompt to add cost controls to an AI assistant

In my app's chat assistant, add cost controls: store answers to common questions (opening hours, delivery, returns) and reuse them instead of calling the model. Send the model only the last 6 messages plus a short summary of earlier ones. Put the fixed instructions at the start of every request. Cap replies at 150 words. Daily limit of 30 messages per phone-verified user and 5 for anonymous visitors. An app-wide daily budget with an alert to the admin at 80 percent, and once exceeded the assistant replies with a handoff to customer service on WhatsApp. Add an admin page showing daily tokens, requests and the top users by consumption. Show me the plan first.

Try it in Fanann

If you have not built the feature yet, start with Add AI features to your app, then come back to this checklist before launch.

Key takeaways

  • Your bill = input tokens × input price + output tokens × output price, and output usually costs more.
  • Repeated context (long instructions, full chat history, documents) is the biggest consumer in most apps.
  • Arabic text can use more tokens than English for the same meaning, depending on the model; measure it yourself.
  • Caching results and the fixed prompt prefix, and a smaller model for simple tasks, cut costs noticeably.
  • Set per-user and per-day limits, and track cost per conversation or per order as a core metric.

Frequently asked questions

How much does it cost to use ChatGPT or Claude inside my app?
It depends on the model, request volume and text length. Providers bill per million tokens, with one price for input and usually a higher one for output. Measure tokens from real requests and multiply by the official price published on the day you calculate.
Does Arabic text use more tokens than English?
On some models, yes, because Arabic words can be split into more pieces. The gap varies between models and has narrowed in newer ones, so measure it on the model you will use.
What is prompt caching?
A feature offered by several providers that lowers the cost of the fixed, repeated part at the start of requests, such as long instructions. To benefit, keep the fixed part first and the changing part last.
How do I avoid a surprise AI bill?
Set a daily cap per user, a message length limit, and an app-wide daily budget with alerts; require sign-in before heavy use; and watch your top consumers.
Is a smaller model good enough?
For simple tasks like classification, extraction and text cleanup, often yes, and it is cheaper and faster. For complex conversations or analysis, use a stronger model and compare quality on your real examples.

Ask your AI assistant about this

Copy this prompt into the AI assistant you use, then add the details of your own case.

I am reading this guide: “What AI features cost to run: tokens, caching and usage limits” https://fanann.com/en/blog/ai-running-costs-tokens/ My question: how much does it cost to run ai in an app Use that page as a source and explain the answer step by step for my situation, tell me what to check before I start, and cite the page link.

Terms in this article

Your idea deserves to see the light.

Describe it in Arabic or English and Fanann builds, tests and ships it — no coding knowledge needed. Start free, no credit card.