CertBrain
CoursesBlog
Sign in
← Back to decks
Sign in to save your progress, vote, and build your own decks.Sign in

Token-Based Pricing

Most foundation models are paid for by the token, so the length of what you send and what the model sends back drives both the bill and the wait. This lesson explains how token-based pricing works, why input and output are priced separately, and the levers a team can pull to lower cost and speed…

9 cards
Study this deck

Token-Based Pricing

Most foundation models are paid for by the token, so the length of what you send and what the model sends back drives both the bill and the wait. This lesson explains how token-based pricing works, why input and output are priced separately, and the levers a team can pull to lower cost and speed up responses.

How you're charged

With on-demand use of a model in Amazon Bedrock, you pay for the tokens each request uses, with no upfront commitment. Every request has two sides:

  • Input tokens: everything sent to the model, including the system instructions, the user's question, any retrieved documents and earlier conversation turns.
  • Output tokens: everything the model generates in reply.

Input and output are counted and billed separately, at rates set per model. For most models an output token costs more than an input token, because generating text takes more work than reading it. Rates vary widely between models, so a small model can be many times cheaper per token than a large one.

What drives cost and latency

Cost is roughly the number of tokens times the rate, summed across every request. That means hidden tokens add up: a long system prompt or a stack of retrieved documents is billed again on every single request, and in a chat, each new turn usually resends the conversation so far.

Latency follows a similar pattern. The model reads the input quickly, but it writes output one token at a time, so long responses take noticeably longer to finish. Asking for a 50-word answer instead of a 500-word one cuts both the output bill and the waiting time.

Ways to lower token costs

LeverEffect
Shorter, focused promptsFewer input tokens on every call
Retrieve only relevant chunksFewer input tokens than pasting whole documents
Limit response lengthFewer output tokens and faster replies
Choose a smaller model for simple tasksLower rate per token
Prompt cachingRepeated prompt prefixes are read from cache at a lower rate and with lower latency
Batch inferenceLower price for supported models when results aren't needed right away

Prompt caching suits workloads that send the same long content, such as a large document or a fixed set of instructions, with many different questions. Bedrock also offers a token-counting operation so teams can estimate a prompt's size before sending it.

Beyond on-demand

On-demand pricing fits variable or unpredictable traffic. For large, steady workloads, Amazon Bedrock also offers Provisioned Throughput, where you pay by the hour for reserved model capacity instead of per token. The trade-offs between these options are covered later in this domain.

On the exam

If a question asks why a GenAI bill is higher than expected, look for long prompts repeated on every call, whole documents pasted in, long outputs, or an oversized model. If it asks how to cut cost without changing the model, the usual answers are shorter prompts, sending only relevant context, capping output length, prompt caching for repeated content, and batch inference for work that can wait.

Quiz me on this
A company's chatbot built on Amazon Bedrock uses on-demand pricing. What is the company charged for on each request?
  1. The number of users and the number of AWS Regions used
  2. ✓ Input tokens sent and output tokens generated
  3. The size of the model in parameters and the hours it is idle
  4. The number of API keys and the number of prompts stored
A support chatbot sends a 3,000-token block of product policies with every customer question, followed by the customer's short message. The finance team wants to cut input costs without changing models or removing the policies. Which feature fits BEST?
  1. Raising the temperature so answers come back faster
  2. Switching to Provisioned Throughput for a small, spiky workload
  3. Removing the system prompt and relying on the model's general knowledge
  4. ✓ Prompt caching for the repeated block of policies
A news app's generative AI feature writes 600-word article summaries, but users only read the first few lines, and they complain about the wait. Which change reduces BOTH cost and response time?
  1. ✓ Ask for much shorter summaries and cap the output length
  2. Add more background articles to every prompt for better context
  3. Move from on-demand pricing to buying a larger model
  4. Repeat the instructions twice in each prompt
A research firm needs a foundation model to classify 2 million archived documents. Results are needed by the end of next week, not in real time, and the firm wants the lowest cost. Which option should it choose?
  1. On-demand real-time requests sent one by one as fast as possible
  2. Provisioned Throughput with a six-month commitment
  3. ✓ Batch inference for the archived documents
  4. A larger model so each document takes fewer requests
Input tokens vs output tokens
Input is everything sent to the model; output is what it generates. They are billed separately per model.
Why long responses are slow
Models generate output one token at a time, so more output tokens mean a longer wait and usually a higher cost.
Prompt caching
Reuses repeated prompt prefixes from a cache, lowering input cost and latency for long, repeated content.
Batch inference
Processes many prompts asynchronously, at a lower price for supported models, when results aren't needed immediately.
CountTokens in Amazon Bedrock
Estimates how many input tokens a prompt will use before you send it, to plan cost and fit limits.