How much a WhatsApp AI agent costs

The two bills of a WhatsApp AI agent: model tokens and Meta messages. How to measure, use prompt caching and cut cost without losing quality.

The cost of an AI agent on WhatsApp does not come from one place. There is the model bill, charged by text processed, and the Meta bill, charged by delivered message. Each grows for a different reason, and looking at only one leads to bad decisions. This article separates the two and shows how to measure before optimizing.

What costs make up an AI agent’s bill?

Two: language model tokens, which depend on the size of what you send and what it writes, and Meta service messages, which depend on how many replies go out after a monthly allowance. There are also infrastructure costs (queue, database, hosting) that are not covered here.

BillCharged byWhat makes it grow
ModelInput and output tokensLong history, large prompt, many tools, long replies
MetaDelivered service message, after the allowanceNumber of replies and numbers (allowance is per number)
Transcription, vector searchPer use, by providerAudio, a knowledge base queried on every message

I do not publish per-token prices here: they change, vary by model and live on your provider’s pricing page. What can be stated safely is the structure of the bill and where it tends to grow.

What makes the model bill grow?

What you resend on every reply. Since the model keeps no memory between calls, each reply pays again for the system prompt, the tool definitions and the history sent. A 20-turn conversation does not cost 20 times one reply; it costs much more, because the history grows every turn.

  • System prompt: read on every call. Trim what does not change behavior.
  • Tools: according to Anthropic’s documentation, definitions and tool_use and tool_result blocks become input tokens, and tool use includes its own system prompt, 286 tokens for Claude Sonnet 5.5 with tool_choice on auto.
  • History: limit the window. The Hub AI agent guide uses the last 20 messages.
  • Output: cap with max_tokens and ask for short replies, which also suits WhatsApp better.
  • Retrieval (RAG): retrieved passages enter as input. Few, relevant ones cost less and answer better.

Does prompt caching reduce the bill?

Yes, on the repeated part. Prompt caching stores the request prefix, in the order tools, system and messages, and cache reads cost a fraction of the normal input price. How much of your request repeats between calls decides how much you save.

According to Anthropic’s documentation, caching is enabled with cache_control of type ephemeral, automatically at the top of the request or on specific blocks, with up to 4 breakpoints. The default lifetime is 5 minutes, refreshed on each use at no extra cost, with a 1-hour option at additional cost. Reads and refreshes cost 0.1 times the base input price on most models, and 0.05 times on Opus 5.5 and Sonnet 5.5. Writes cost 1.25 times the base price for 5 minutes and 2 times for 1 hour. Prompts below the minimum, 512 tokens for Sonnet 5.5, are processed without caching and without error.

For a WhatsApp agent this has design consequences. The system prompt and tools are identical across all conversations, so they are the best cache candidate, as long as there is traffic inside the 5-minute window. The history is less favorable: it only enters the cache while its start is identical, and a sliding window changes the start with every new message. If the history is append-only, automatic caching follows the conversation.

// Log the REAL usage of each reply; it is the only honest basis for the bill const r = await claude.messages.create({ model: 'claude-sonnet-5-5', max_tokens: 500, cache_control: { type: 'ephemeral' }, // automatic caching: the breakpoint follows the conversation system: SISTEMA, tools, messages: aparar(historico), }) await metricas.gravar({ conversa: chave, entrada: r.usage.input_tokens, // after the last cache breakpoint leituraDeCache: r.usage.cache_read_input_tokens, // read from cache escritaDeCache: r.usage.cache_creation_input_tokens, // written to cache saida: r.usage.output_tokens, })

The usage fields let you check that caching works: according to the documentation, total input is the sum of cache reads, cache writes and plain input, and if reads and writes both come back zero, the prompt was probably under the minimum. Measure before claiming caching is saving money.

And Meta’s bill?

Since October 1, 2026, a free-form reply inside the 24-hour window is charged per delivered message, after a monthly allowance of 1,000 service messages per number, which do not roll over. Before that, those replies were free. The service rate equals the utility and authentication rate of the market, with no volume discount.

// Meta part: service message (free text inside the window) const FRANQUIA_POR_NUMERO = 1000 // free per month, no rollover const TARIFA = 0.035 // BRL per delivered message (Brazil, table checked on 09/17/2026) function custoMeta(respostasNoMes) { return Math.max(0, respostasNoMes - FRANQUIA_POR_NUMERO) * TARIFA } custoMeta(5000) // (5000 - 1000) * 0.035 = BRL 140.00

This calculation uses the Brazil rate that the Hub calculator adopts, checked on September 17, 2026; confirm it on Meta’s pricing page and simulate your volume in the calculator. Two notes. The allowance is per number, so several numbers split the volume. And a utility template inside the window is charged from the first message, with no allowance. Without a payment method on the account, Meta delivers service messages only until the allowance runs out.

Meta’s bill depends on the number of replies, not their size. An agent that answers in three short messages what fit in one spends more allowance without improving anything. Group the reply into one message when reading it that way is natural.

How do you cut cost without making the agent worse?

By measuring first, optimizing second and checking quality at every cut. The safest savings are those that do not change the reply content: caching the fixed prefix, a lean history and fewer tools.

  • Measure per conversation and per reply: input, output and cache tokens, and how many messages went out.
  • Pick the model by task: simple questions do not need the most capable model. Test a smaller model on your evaluation set before switching.
  • Solve without a model what you can: buttons and menus for fixed choices, and filters for greetings and thanks.
  • Control loops: a tool turn cap and a cap on replies per conversation per minute, which also protects against error 131056.
  • Re-evaluate at every cut: a lower cost with worse replies is not savings. The evaluation article in this series shows how.

See also the webhooks reference for how events reach the worker that logs this usage.

Frequently asked questions

How much does one agent reply cost?

It depends on the tokens used, the model chosen and, on Meta’s side, whether the reply falls within the number’s monthly allowance. There is no single figure: log the real usage of each reply and add both bills.

Does prompt caching work in a WhatsApp conversation?

It works on the repeated part, such as the system prompt and tools, as long as requests arrive within the cache lifetime, 5 minutes by default. The history only helps if its start does not change between calls.

Is the service message allowance per account or per number?

Per business phone number, according to the rule Meta published and the Hub calculator adopts: 1,000 free messages per month, with no rollover.

Can I use a cheaper model for everything?

Only if evaluation shows quality holds. Test the smaller model on your conversation set and compare before switching.

Fontes

Documentação oficial da Meta, conferida em 31 de outubro de 2026.