# Where do your AI credits go?

On every turn, your AI assistant re-reads its own instructions, the project instructions file, the whole conversation and the files it opened, as well as your latest message. That is why a long conversation costs more with each question. Before paying for a bigger plan, scope your requests and start a new conversation when you switch tasks.

- Checked on 2026-12-04
- Rodrigo Lombana Reina, https://thefabricofdata.com/profile/
- https://thefabricofdata.com/patterns/ai-credits-context-budget/

## The problem

You have spent the whole afternoon in one conversation with your AI assistant. You started by asking it to check today's orders load. Then you asked it to look at a config file, explain an error in a notebook and go over some meeting notes. It all went fine. Then, halfway through a simple question, the warning appears: you are close to your usage limit.

Two questions come up. Do I pay for a bigger plan? Or am I doing something wrong?

This article answers both with a real measurement. You will see where the usage goes in a conversation, how to check it yourself, what each option costs you in money, quality and time, and which one fits your case. It is written for people who do data work with AI, either with a coding agent (an assistant that reads and writes files in your project, such as Claude Code, OpenAI Codex, Gemini CLI, GitHub Copilot or Grok Build, formerly Cursor) or with a chat assistant such as ChatGPT, Claude or Gemini.

## Where the usage goes

The model remembers nothing between one request and the next. To keep the conversation going, the tool sends it everything it needs on every turn:

- the tool's system instructions;
- the project instructions or memory file, if you have one (the "Steps" section lists what each tool calls it);
- the whole conversation so far, your messages and its replies;
- the content of every file it has opened;
- your new message.

OpenAI says it plainly in its API documentation: each request is independent, and the tokens of earlier turns are billed as input. Google's API can keep the conversation on its server so you do not have to send it again, but its documentation makes clear that usage still includes the tokens from earlier turns. And for the Gemini app, Google explains that long chats make it re-read the conversation history to keep the context.

A turn is one round trip to the model. A coding agent can make several for each message you send: it reads a file, thinks, reads another and replies. Each of those turns reads everything before it again.

![Diagram of one turn: system instructions, the instructions file, the whole conversation so far, the files opened and your new message form one request to the model. All of it is read again on every turn; it is written to the cache the first time and read from the cache afterwards.](https://thefabricofdata.com/_astro/18-each-turn.B5uIM1Vd.svg)

The usage counters use these terms:

- Token: a piece of text, roughly part of a word. All usage is measured in tokens.
- Input: what the model reads in a turn.
- Output: what the model writes, its internal reasoning included.
- Prompt cache: temporary storage that keeps the start of a request so the next turn does not have to process it from scratch.
- Cache write: the first time a piece of text appears, it is saved to that cache. At Anthropic it costs more than plain input: 1.25 times with the 5-minute cache and 2 times with the one-hour cache.
- Cache read: reusing the saved text. Much cheaper, but it still counts. OpenAI caches automatically from 1,024 tokens and discounts repeated input by up to 95%. Google caches by default from Gemini 2.5, with 95% less on Gemini 4 and up to 90% less on Gemini 3 and 2.5. Anthropic charges cache reads at 0.1 times the input rate on most of its models.

The consequence is simple. Your message may be one line, but the model also reads everything that came before. The longer the conversation, the more each question costs, however short it is.

## The case, measured

The test was run with Claude Code because it can output the counters of each run as JSON; the mechanism is the same in the other tools. To put numbers on this, a small project folder was set up with made-up data:

- today's orders, `data/orders.csv`: 24 rows, with two repeated order IDs, SO-26007 and SO-26019;
- an orders archive from 2025 with 1,500 rows;
- some meeting notes;
- an old spec of the export file.

The question was always the same: are there duplicate orders? The first file is enough to answer it. It was sent three ways:

- A, open request: "Check the data in this project and tell me if there are duplicate orders." Claude Code decides what to read.
- B, scoped request: "Read only data/orders.csv. Do not open any other file. Find the order_id values that appear more than once. Reply with only this JSON..." Fresh session.
- C: request B, sent inside the session that had already run A, with all of A's conversation behind it.

The runs took place on 2026-12-04 with Claude Code 2.1.296, the haiku model alias (claude-haiku-5-5) and a session signed in with a Claude subscription. Claude Code started in safe mode, without a project instructions file, plugins or MCP servers (connectors to outside tools), and could only read files.

| Run | Turns | Tokens read (input + cache write + cache read) | Output tokens | Cost estimate (USD) | Correct |
|---|---|---|---|---|---|
| A open, 1 | 8 | 115,187 | 2,758 | 0.0150 | yes |
| A open, 2 | 8 | 115,307 | 2,581 | 0.0146 | yes |
| B scoped, 1 | 2 | 12,581 | 224 | 0.0008 | yes |
| B scoped, 2 | 2 | 12,577 | 243 | 0.0007 | yes |
| C scoped after A | 2 | 140,314 | 292 | 0.0021 (this run only) | yes |

![Horizontal bars of tokens read per run: A1 115,187, A2 115,307, B1 12,581, B2 12,577 and C 140,314, each with its number of turns and cost estimate.](https://thefabricofdata.com/_astro/18-measured-runs.CXPwIUzo.svg)

Every answer was right. The difference is in how they got there.

The open request answered in prose. It also read the 1,500-row archive from 2025, and its answer says it checked it "by eye" rather than with a script. It took 8 turns and ended by offering to delete rows. The scoped request returned the JSON in 2 turns.

A read about 9 times more tokens than B, and its cost estimate was about 20 times higher. Cost grew faster than reading because most of A's text was written to the cache, and cache writes are expensive: in these runs Claude Code used the one-hour cache, priced at twice the plain input rate.

C teaches the most. It asked exactly B's question, but carried A's conversation. It read about 11 times more tokens than B. Its cost estimate was about 3 times B's, because almost all of it was cache reads, which are cheap.

Same question, same answer. The price depends on what came before.

Two notes for reading the table. The cost estimate is Claude Code's own figure at API list prices: on a subscription you are not billed that money. And the documentation checked does not say how much each counter weighs against plan limits, so the table shows the size of the gap, not what share of your limit each run used. The five runs together come to an estimate of about USD 0.033. Two runs per variant show the size of the gap, not a precise average.

## Steps

Measure first, then control. The habits work in any tool; the commands change names, and the table at the end of this section brings them together.

To measure:

1. Check how much of your limit is left, in the "Usage and limits" column. On a subscription, the limits are what you watch; if you pay per use, watch the spend too.
2. Check what fills the context, in the "Context or tokens" column. The context window is everything the model reads on every turn. If one block is large and you no longer need it, that is where your usage goes.
3. Check whether you are working on your subscription or with an API key, a credential that bills every token separately from your plan. If you set an API key in Claude Code, Codex or Gemini CLI, you pay API prices instead of using your plan's allowance.
4. To measure one task precisely, repeat the case. The project scripts use Claude Code and send each request without an interactive session using `claude -p "<prompt>" --output-format json`. You get a JSON reply with `num_turns` (turns), `usage` (tokens by type) and `total_cost_usd` (Claude Code's cost estimate). With the downloaded project, from its folder:

```sh
sh run_case.sh haiku 2
python3 usage.py sample-results/*.json
```

The first command makes five calls with your account and prints the table with your figures. The second reads the replies recorded on 2026-12-04 and uses nothing: you will see the same table as in the previous section.

To control:

5. One task per conversation. Before you switch tasks, write down your decisions and start a new conversation ("Start fresh" column). The history stops travelling with every turn.
6. If you need continuity, summarise the conversation ("Summarise" column). Summarising also uses allowance, and the summary can drop detail.
7. Scope every request: name the files, the expected result, the check and when to stop. You will see fewer turns and fewer files opened, as in B.
8. Keep the project instructions or memory file short, with only what every session needs. It travels with every turn. The Claude Code documentation recommends under 200 lines, Codex caps AGENTS.md at 32 KiB by default and Gemini CLI sends GEMINI.md "with every prompt". Each tool has its own name for it:
   - Claude Code: `CLAUDE.md`.
   - Codex: `AGENTS.md`, also read by GitHub Copilot and Grok Build.
   - Gemini CLI: `GEMINI.md`.
   - GitHub Copilot: `.github/copilot-instructions.md`.
   - Grok Build: `.cursor/rules`.
   - ChatGPT: custom instructions, memory and project instructions.
   - Claude app: project instructions.
   - Gemini app: "Your instructions for Gemini".
9. Use subagents for big searches, if your tool has them. A subagent is a helper assistant that works in its own context, which starts empty, and returns only a summary. Your main conversation stays clean, but its requests count against the same limits.
10. Use a cheaper model or lower effort for simple steps ("Model and effort" column). Effort is how much the model reasons before it answers. In Copilot for VS Code, higher effort uses more credits. On hard tasks, a smaller model can get things wrong.
11. If you pay per use, set a spend limit. "Your options" shows where each service lets you set it.

| Tool | Start fresh | Summarise | Context or tokens | Usage and limits | Model and effort |
|---|---|---|---|---|---|
| Claude Code | `/clear` | `/compact` | `/context` | `/usage` | `/model`, `/effort` |
| Codex | `/new` or `/clear` | `/compact` | `/status` | `/usage` | `/model`, with reasoning effort |
| Gemini CLI | `/clear` | `/compress` | `/stats` | `/stats model` | `/model set` |
| GitHub Copilot CLI | `/clear`, `/new` | `/compact` | `/context` | `/usage` | `/model` |
| Copilot in VS Code | `/clear` | `/compact` | Context window control | Usage dashboard | Model picker, with thinking effort |
| Grok Build (formerly Cursor) | — | Automatic summary | Context ring | Usage dashboard | Model picker |
| ChatGPT | — | — | — | Settings > Usage | — |
| Claude app | New conversation | Automatic context management | — | Settings > Usage | — |
| Gemini app | New chat | — | — | Settings > Usage Limits | — |

— = not found in the official documentation checked on 4 December 2026.

Since 18 June 2026, Google has been replacing Gemini CLI with Antigravity CLI for users without a paid plan and for Google One users.

## Your options

| Option | Money | Quality | Time | Risk |
|---|---|---|---|---|
| Scoped requests (files, expected result, stop condition) | None | Same or better if the check is explicit | The time it takes to write one | Missing context if you trim too much |
| New conversation between tasks | None | You lose the history; note what matters first | Seconds | Forgetting decisions |
| Summarise the conversation | Uses allowance to do it | The summary can drop detail | Little | Losing a detail without noticing |
| Short instructions file | None | Same | Once | Cutting a rule you did need |
| Subagents | Count against the same limits | The main context stays clean | Some overhead | More tokens in total |
| Cheaper model or lower effort | Less per token | Weaker on hard reasoning | Faster | Wrong answers on hard steps |
| Bigger plan | Fixed monthly fee | Same | None | Paying for capacity you do not use |
| Pay per use (API) | Per token, at list prices | Same | None | An open-ended bill if you set no limits |

What each one means for you:

- The habits at the top of the table cost no money. Try them first, because they go after the cause: what gets read again on every turn.
- A bigger plan raises the ceiling but does not change how you spend. ChatGPT, Claude and Gemini have paid plans, and GitHub Copilot plans include monthly AI Credits, worth USD 0.01 each. Claude plans (Pro, Max and Ultra) share their limit between the chat app and Anthropic's coding agent: what you use in one is gone from the other. Pro and Max have a five-hour session limit and a weekly limit; verified Ultra accounts have no five-hour limit. In the Gemini app, the limit refreshes every five hours until you reach a weekly limit.
- With pay per use you work with an API key and pay for every token at list price. For example, on Anthropic's API, Claude Haiku 5.5 costs USD 0.10 per million input tokens and USD 0.50 per million output tokens for prompts up to 100K tokens. If you put an API key in Claude Code, Codex or Gemini CLI, the spend goes on your API bill, not your plan.
- Set a spend limit as soon as you pay per use. OpenAI lets you set it per organisation and per project; the Claude Console, per workspace; GitHub Copilot, with a budget that can stop usage when it is reached; Grok Build, with a monthly additional usage limit. In Google AI Studio, the monthly spend cap is experimental.

## Which one fits you

| If this is you | Start with |
|---|---|
| You hit the limit only in long conversations | A new conversation when you switch tasks, and scoped requests |
| You hit it every day and your work is already tidy | A bigger plan |
| You use it a few hours a month | The API with a spend limit |
| You got an API bill while on a subscription | Check whether the tool is using an API key: in Claude Code, the `ANTHROPIC_API_KEY` variable; Codex and Gemini CLI also bill API-key sessions separately |
| Your instructions file keeps growing | Cut it down to what every session needs |
| You repeat simple steps | A cheaper model or lower effort |

## The project

The downloadable project reproduces the case with Claude Code and contains:

- `make_case.py`: creates the case folder with the made-up data.
- `prompts/`: the open and scoped requests.
- `run_case.sh`: runs the five calls and prints the table.
- `usage.py`: reads the JSON replies and works out turns, tokens read, cost estimate and whether the answer is correct.
- `sample-results/`: the five real replies from 2026-12-04.
- The tests and `RUN_LOG.txt`, with the full output.

Reading the recorded runs needs no account: `python3 usage.py sample-results/*.json` and the tests are enough. Running it yourself needs Claude Code and uses your account, either your plan limits or your API bill. It makes five calls, each with a USD 0.50 budget limit that Claude Code checks on its own estimate, so it can be exceeded slightly.

## Copy this prompt

Use it when you have a data task that is still loosely defined. Paste it as the first message of a new conversation in your assistant and replace what is in <>: the task, the files or folder it may work in and the answer format. The first thing you will see is a list of files with a reason for each, before any of them is opened. Check that the list is short and makes sense before you confirm it. At the end, check that the test you asked for was done and that the answer follows the format.

```text
Task: <describe the task, for example: find duplicate orders in today's load>.
Work only inside <allowed folder or files>.

Before you read any file:
- List the files you need and say in one line why you need each one.
- Say what result you expect and which check will prove it is correct.
- Wait for me to confirm the list.

Then:
- Read only the confirmed files. If you need another one, ask me first.
- Stop as soon as the check passes. Do not propose changes or delete anything.
- Reply only in this format: <answer format>
```

## Limits

- Only Haiku was measured. Figures for Sonnet or Opus were not measured.
- There are two runs per variant. They show the size of the gap, not an average.
- One tool was measured, Claude Code 2.1.296, in safe mode and with file reading only. With your instructions file, plugins and MCP servers, each turn reads more.
- The other tools were not measured. Their commands, files and limits come from their official documentation.
- The cost estimate uses API list prices. The documentation checked does not say how much each counter weighs against plan limits.
- Prices, limits and command names change. The ones in this article were checked on 2026-12-04.

## Sources

- [Manage costs effectively](https://code.claude.com/docs/en/costs)
- [Commands](https://code.claude.com/docs/en/commands)
- [Run Claude Code programmatically](https://code.claude.com/docs/en/headless)
- [How Claude remembers your project](https://code.claude.com/docs/en/memory)
- [Create custom subagents](https://code.claude.com/docs/en/sub-agents)
- [Model configuration](https://code.claude.com/docs/en/model-config)
- [How Claude Code uses prompt caching](https://code.claude.com/docs/en/prompt-caching)
- [CLI reference](https://code.claude.com/docs/en/cli-reference)
- [Pricing](https://platform.claude.com/docs/en/about-claude/pricing)
- [Use Claude Code with your Pro, Max, or Ultra plan](https://support.claude.com/en/articles/11145838-using-claude-code-with-your-pro-or-max-plan)
- [Codex: Developer commands](https://learn.chatgpt.com/docs/developer-commands?surface=cli)
- [Codex: Slash commands](https://learn.chatgpt.com/docs/cli/slash-commands)
- [Codex: Pricing](https://learn.chatgpt.com/docs/pricing)
- [Custom instructions with AGENTS.md](https://learn.chatgpt.com/docs/agent-configuration/agents-md)
- [OpenAI: Conversation state](https://developers.openai.com/api/docs/guides/conversation-state)
- [OpenAI: Prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching)
- [OpenAI: Rate limits and spend limits](https://developers.openai.com/api/docs/guides/rate-limits)
- [Gemini API: Tokens](https://aistudio.google.com/docs/tokens)
- [Gemini API: Caching](https://aistudio.google.com/docs/caching)
- [Gemini CLI](https://geminicli.com)
- [Gemini CLI: GEMINI.md files](https://geminicli.com/docs/cli/gemini-md)
- [Gemini CLI: Commands](https://geminicli.com/docs/reference/commands)
- [Gemini CLI: Quota and pricing](https://geminicli.com/docs/resources/quota-and-pricing)
- [VS Code: Chat sessions](https://code.visualstudio.com/docs/copilot/chat/chat-sessions)
- [VS Code: Language models](https://code.visualstudio.com/docs/copilot/customization/language-models)
- [Grok Build: Rules](https://docs.grok.com/build/agents-window/rules)
- [ChatGPT: Custom instructions](https://help.openai.com/en/articles/8096356)
- [ChatGPT: Memory](https://help.openai.com/en/articles/8590148)
- [ChatGPT: Projects](https://help.openai.com/en/articles/10169521)
- [ChatGPT: Usage](https://help.openai.com/en/articles/20001516)
- [Claude: Projects](https://support.claude.com/en/articles/9519177)
- [Claude: Usage limits and context management](https://support.claude.com/en/articles/11647753)
- [Claude: Project caching](https://support.claude.com/en/articles/9797557)
- [Gemini app: Your instructions for Gemini](https://support.google.com/gemini/answer/16598625)
- [Gemini app: Usage limits](https://support.google.com/gemini/answer/16275805)
- [GitHub Copilot: Add repository custom instructions](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions)
- [GitHub Copilot CLI command reference](https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference)
- [GitHub Copilot: Manage request allowances and budgets](https://docs.github.com/en/copilot/how-tos/manage-and-track-spending/manage-request-allowances)
- [Grok Build: Prompting the agent](https://docs.grok.com/build/agents-window/agent/prompting)
- [Grok Build: Overages](https://docs.grok.com/build/agents-window/help/account-and-billing/overages)
- [Cursor is now Grok Build (cursor.com)](https://cursor.com/)
- [Google AI Studio: Billing](https://aistudio.google.com/docs/billing)
- [GitHub Copilot: Billing for individuals](https://docs.github.com/en/copilot/concepts/billing-and-usage/individuals/billing)
- [Grok Build: Usage limits](https://docs.grok.com/build/agents-window/help/models-and-usage/usage-limits)

## Author

Rodrigo Lombana Reina, data engineer. Personal opinions.

## Questions

### Why do I hit my AI usage limit so fast?

Because on every turn the assistant re-reads everything in the conversation: its instructions, the project instructions file, earlier messages and the files it opened. In a test with Claude Code 2.1.296 and Haiku, an open request read about 9 times more tokens than a scoped one and reached the same correct answer. Long conversations and vague requests multiply the cost.

### Is a plan or the API cheaper?

It depends on how much you use it. A ChatGPT, Claude, Gemini or GitHub Copilot plan costs the same every month and has usage limits. On the API you pay for every token: for example, Claude Haiku 5.5 costs USD 0.10 per million input tokens for prompts up to 100K tokens. For a few hours a month, the API with a spend limit fits; for daily use, a plan does.

### Does starting a new conversation save usage?

Yes. A new conversation does not carry the history, so each turn reads much less. In a test with Claude Code 2.1.296, the same question sent at the end of a long session read about 11 times more tokens than in a fresh session. Since you lose the history, write down your decisions first. In Claude Code it is /clear; in Codex, /new; in Gemini CLI, /clear.

### Does summarising the conversation save usage?

Partly. In Claude Code 2.1.296, /compact reads the whole conversation to summarise it, so that step uses allowance. After it, each turn starts from a shorter summary and reads less, though the summary can drop details. Codex and Copilot also have /compact, and Gemini CLI has /compress. If you switch tasks, start a new conversation.

### Do cache reads count toward usage?

Yes, they count. The prompt cache stores text already sent so the next turn can reuse it. Reading it costs much less: OpenAI discounts it by up to 95% and Anthropic charges 0.1 times the input rate on most models. It is still not free. In a test with Claude Code 2.1.296, the same question at the end of a long session had a cost estimate about 3 times higher than in a fresh session.

### Why was I charged for the API while on a plan?

Check whether the tool is using an API key. In Claude Code 2.1.296, if the ANTHROPIC_API_KEY environment variable is set, that key is used instead of your subscription and every token is billed to your API account. Codex and Gemini CLI also bill API-key sessions separately, at API prices rather than from your plan.

### What do I do in ChatGPT, Gemini or Claude?

The same habits apply. In the Gemini app, Google recommends starting a new chat when you move to a new topic, and your limit is under Settings > Usage Limits. In the Claude app, long conversations that trigger automatic context management use more of your limit; usage is under Settings > Usage. In ChatGPT it is also under Settings > Usage. Keep your custom instructions short.
