AI can help QA professionals review requirements, create test cases, analyse failures and draft automation code. But it is easy to give an AI system far more information than it needs.

A tester may paste a complete requirement document when only one acceptance criterion matters. An automation engineer may attach an entire repository to fix one failed test. A QA lead may ask for a ten-page report when a short risk summary would be enough.

All that information has to be processed. In generative AI systems, much of it is measured in tokens.1

The goal is not to use the fewest tokens possible. The goal is to provide the smallest amount of relevant context needed for a reliable result.

1. What Is a Token?

A token is a unit that an AI model processes. A token can be a whole word, part of a word or even a single character. The way text is divided into tokens depends on the model and its tokenizer.2

AI requests can contain several types of tokens:

  • Input tokens: Your question, instructions, conversation history and other information sent to the model.
  • Output tokens: The content generated by the model.
  • Other tokens: Depending on the provider and model, usage reports may also identify cached, reasoning, tool-use or multimodal tokens.3

This means token usage is not determined only by the sentence you type. Documents, images, tool definitions, earlier messages and other context may also contribute to the request. Provider token-counting tools can estimate input size before a request, while API responses can report actual usage.45

A simple QA example

Suppose you ask AI to identify the cause of a failed Playwright test.

If you provide:

  • the failed test,
  • the error message,
  • the relevant page-object method,
  • the nearby log entries, and
  • the recent application change,

the model receives focused evidence.

If you instead provide the complete repository and a 20,000-line execution log, most of that information may have no connection to the failure. The second request is larger, but it is not automatically more useful.

2. Why Should QA Professionals Care About Token Usage?

Cost

Many AI APIs charge separately for input and output tokens. Rates vary by provider, model, processing option and whether eligible input is cached. Some tools, such as web search or file search, may also have separate charges.6

The amount shown in a consumer AI subscription is not necessarily calculated in the same way as an API bill. Always check the pricing and usage rules for the product your team actually uses.

Speed

The amount of generated output affects response time. OpenAI’s latency guidance lists generating fewer tokens, using fewer input tokens and making fewer requests among its optimisation principles. It also states that generating output is usually the highest-latency stage of a text-model request.7

Available context

Models have limits on how much information they can process in one request. That limit is commonly called the context window. Conversation history and new content can share that available space, although the exact accounting depends on the provider and API.8

Using space on irrelevant logs or repeated instructions leaves less room for evidence that may actually help solve the QA task.

Attention to the task

More context does not guarantee a better answer. Research on long-context language models has found that performance can depend on where relevant information appears, with some models using information less effectively when it is placed in the middle of long inputs.9

This does not mean that every long prompt is poor. It means that relevance and organisation matter as much as size.

3. Where Do QA Professionals Commonly Waste Tokens?

Pasting complete logs

A full execution log may contain successful setup steps, repeated network calls and output from unrelated tests. For one failure, the error, stack trace, nearby events and relevant environment details are usually a better starting point.

Sharing an entire repository

A model rarely needs every file to explain one locator failure or review one API test. Start with the failed test and directly related code. Add more files only when the investigation reveals a dependency.

Repeating stable instructions

Teams often send the same coding standards, test template and domain rules with every request. Some APIs support prompt or context caching so repeated, stable content can be reused at a reduced cached-input rate. Caching rules and minimum eligible prompt sizes differ by provider and model.1011

Asking for unnecessary output

If you need five high-risk scenarios, asking for every possible test case can produce a longer and less focused response. Provider guidance recommends requesting concise output when a shorter response is sufficient.12

Continuing an oversized conversation

In some multi-turn APIs, earlier messages remain part of later input. For example, Google documents token counting across conversation history, and Anthropic notes that retained earlier content can contribute to input-token accounting.1314

When a conversation has moved through several unrelated tasks, a new focused conversation or a verified summary may be more efficient.

Allowing uncontrolled agent activity

An agent may make several model and tool calls while completing one goal. Each call can have its own model usage, and some hosted tools have separate pricing. Teams should therefore observe the number of calls, tool usage, retries and total token consumption instead of looking only at the first prompt.1516

4. A Better Way to Send QA Context

Consider this request:

This test failed. Analyse it.

Attaching the full repository and complete CI log does not make this vague instruction precise.

A more useful request would be:

The following Playwright test failed after the login page changed. Identify the most likely cause and suggest the smallest safe fix. Use only the attached failed test, page-object method, error message and 30 log lines around the failure. If the evidence is insufficient, tell me what additional information you need. Return: cause, evidence, proposed fix and verification steps.

This version improves efficiency in four ways:

  1. It defines the task.
  2. It supplies selected evidence.
  3. It limits the expected output.
  4. It tells the model not to invent missing information.

The improved request may not always be shorter than the original sentence. Prompt efficiency is about useful information, not word count alone.

5. Eight Smarter Ways to Use AI Efficiently

1. Start with the task

State what you want the model to do before adding background information. “Find why this API test returned 401” is clearer than “Review this project.”

2. Select evidence before sending it

For failure analysis, begin with the failed test, error, stack trace, relevant code and nearby logs. Add broader material only if it is needed.

3. Separate stable context from changing context

Keep reusable instructions—such as automation standards or output schemas—stable where possible. Prompt caching generally depends on reuse of a matching prompt prefix, so changing early content can reduce cache reuse.17

4. Request the output you actually need

Specify a useful boundary: “Give the five highest-risk scenarios,” “Return only the changed method,” or “Summarise in a table with four columns.” Shorter output can reduce both generated tokens and response time.18

5. Use the right model for the task

Do not assume that the largest model is required for every activity. Provider guidance recommends evaluating smaller models for suitable workloads, while recognising that they may need clearer instructions, examples or task-specific optimisation to maintain quality.19

Use evaluations on your own QA tasks before changing models. A cheaper result that misses important risks is not an improvement.

6. Avoid unnecessary calls and control agents

If the first answer is wrong, improve the evidence or instruction before asking the same question again. OpenAI includes making fewer requests among its latency-optimisation principles.20

For agents, set practical limits for retries, investigation depth, tool calls and escalation. Record why the agent made each call and whether the call contributed to the result. Usage and tracing data are needed to understand the full run.21

7. Summarise carefully

For a long investigation, create a short, verified summary containing confirmed facts, open questions and rejected causes. Continue from that summary only after checking that important evidence has not been removed.

8. Measure before optimising

Use the provider’s token-counting or usage fields where available. Google and Anthropic provide token-counting mechanisms, while OpenAI recommends tracking input counts, cached tokens, latency and realised cost when evaluating prompt caching.222324

Without measurement, a team may spend time shortening prompts that contribute very little to its total usage.

6. When Should You Not Reduce Tokens?

Do not remove information merely to make a prompt smaller.

Keep the context needed to understand:

  • business rules,
  • acceptance criteria,
  • safety or compliance requirements,
  • environment and test-data conditions,
  • relevant code dependencies, and
  • evidence needed to verify a conclusion.

A vague prompt can lead to a generic answer. Missing requirements can lead to missing tests. An aggressive summary can hide the event that caused a failure.

The correct question is not:

How can I make this prompt as short as possible?

It is:

What is the smallest set of reliable information needed to complete this task well?

7. A Checklist Before You Send Information to AI

Before sending a QA request, ask:

  • Is the task specific?
  • Is every attached file relevant?
  • Can I send only the important part of the log?
  • Have I included the business rule or acceptance criterion that controls the answer?
  • Am I repeating instructions already available to the application?
  • Have I requested only the output I need?
  • Does this task require the selected model?
  • Could one good request replace several trial-and-error requests?
  • If an agent is involved, are retries and tool calls controlled?
  • Can I measure the input, output, cached and tool usage?

Final Thought

Tokens are not something QA professionals need to fear. They are a useful way to understand how much information an AI system is processing.

Efficient AI usage does not mean sending tiny prompts. It means giving the model clear instructions, relevant evidence and an appropriate output boundary—and then measuring what happened.

The principle is simple:

Provide enough context for a reliable answer, but do not make the AI search through information that you already know is irrelevant.

References