Source: https://arara.code.app.br/en/articles/reduce-token-usage-when-coding-with-ai
Language: en-US
Published: 2026-11-16T08:45:00-03:00

Guides and comparisons

# How to reduce token usage when coding with AI

To spend fewer tokens when coding with AI, send only the context you need, reuse prefixes with prompt caching, use smaller models for simple tasks and open a new session for each task. In APIs, input and output tokens have different prices, and output usually costs more.

Arara Code

Published and sources checked on November 16, 2026.

Published by the Arara Code project based on the official documentation cited.

## Where token usage comes from

Providers charge per processed token, with separate prices for input and output, as the Anthropic pricing table shows. On plans with a usage limit, the same consumption exhausts the quota sooner.

In agents, each step resends the session history. That is why long sessions, with many terminal outputs and large files, consume far more than the initial request suggests.

[Anthropic: model pricing](https://docs.anthropic.com/en/docs/about-claude/pricing)

## Prompt caching lowers the cost of repeated context

Prompt caching reuses the repeated prefix of a prompt. According to Anthropic documentation, cache reads cost 10% of the base input price; OpenAI applies automatic caching to prompts of 1,024 tokens or more.

To benefit, keep the start of the context stable: instructions, AGENTS.md and reference files first, and whatever changes at each step last.

[Anthropic: prompt caching documentation](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching)

Related

[Claude Code or Codex usage limit reached? What to doClaude Code or Codex usage limit reached? Learn how the 5-hour and weekly windows work, how to track usage, and what to do until access returns.](https://arara.code.app.br/en/articles/claude-code-and-codex-usage-limits)

## Lean context and the right model for each task

Reference only the files you need instead of pasting the whole repository, and ignore folders such as node_modules and dist. Summarize long terminal output before continuing.

Use smaller, cheaper models to rename, format and write simple tests, and keep the larger ones for architecture and hard bugs. Choose low reasoning effort when the task is straightforward.

[OpenAI: prompt caching documentation](https://platform.openai.com/docs/guides/prompt-caching)

## Controlling usage in Arara Code

Arara Code brings Claude Code, Codex, Kiro and Antigravity into the same editor and lets you switch platform, model and effort per conversation. When one agent hits its limit, continue the task in another.

Open a new conversation per task, keep fixed instructions in AGENTS.md and track your account limits in the chat usage meter.

[Arara Code repository on GitHub](https://github.com/arara-ide/arara-code)

## Sources and further reading

- [Anthropic: model pricing](https://docs.anthropic.com/en/docs/about-claude/pricing)
- [Anthropic: prompt caching documentation](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching)
- [OpenAI: prompt caching documentation](https://platform.openai.com/docs/guides/prompt-caching)
- [Arara Code repository on GitHub](https://github.com/arara-ide/arara-code)

[Read as Markdown](https://arara.code.app.br/en/articles/reduce-token-usage-when-coding-with-ai.md)

## Keep exploring

### [Vibe coding: what it is, the risks and how to start safely](https://arara.code.app.br/en/articles/vibe-coding)

Learn what vibe coding is, what 2025 data shows about trust and security, and how to start safely with a branch, tests and diff review.

[Read the guide](https://arara.code.app.br/en/articles/vibe-coding)

### [AI coding statistics 2025: what the data shows](https://arara.code.app.br/en/articles/ai-in-software-development-data-2025)

AI coding statistics for 2025: adoption, trust and productivity data from Stack Overflow, DORA, METR and GitHub, and how to apply it to your project.

[Read the guide](https://arara.code.app.br/en/articles/ai-in-software-development-data-2025)

## Make room for your next idea.

Get to know Arara Code in your own project. Start with the installer and review the changes your assistant makes.

Download Arara Code
