# Reduce token usage in the Claude API and Agent SDK

> 7 settings cut more. Agent type: building my own agent. From Use Fewer Tokens, by StackOne.

Last checked: 30 Nov 2026, against the vendor's own pages.

## Settings that cut more in Claude API and Agent SDK
- **Load tools when needed**: defer_loading: true on your tools, plus the tool_search_tool_bm25_20251119 tool. ([source](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool), read 30 Nov 2026)
- **Prompt caching**: cache_control: {"type": "ephemeral"} after the tools and system prompt. ([source](https://platform.claude.com/docs/en/build-with-claude/prompt-caching), read 30 Nov 2026)
- **Let the agent run code over results**: code_execution_20260120 with allowed_callers on your tools. ([source](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling), read 30 Nov 2026)
- **Clear old tool results** (beta): context_management with clear_tool_uses_20250919, or server-side compaction. ([source](https://platform.claude.com/docs/en/build-with-claude/context-editing), read 30 Nov 2026)
- **Read web pages as text**: web_search_20260318 and web_fetch_20260318 filter results in code before they enter context. ([source](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool#dynamic-filtering), read 30 Nov 2026)
- **Lower the effort setting**: effort: "low" for high-volume or latency-sensitive work (the default is high, or medium on Opus 5.5 and Haiku 5.5). ([source](https://platform.claude.com/docs/en/build-with-claude/effort), read 30 Nov 2026)
- **Batch scheduled jobs**: Message Batches API: 50 percent off for work that can wait up to 24 hours. ([source](https://platform.claude.com/docs/en/build-with-claude/batch-processing), read 30 Nov 2026)

## With StackOne
- **Deep Query**: Data Sync on the list action, then list_tickets_s1query({ filter, source, aggs })
- **Load tools when needed**: Add https://mcp.stackone.com/mcp; Advanced Tool Search is on by default
- **Ask for fewer fields**: source on any _s1query call, listing only the fields the answer uses
- **Keep live questions live**: Keep the live action next to the _s1query tool
- **Tool Policies**: Tool Policies on the project

## Other techniques for your own agent
- [Turn off tools you don't use](https://usefewertokens.com/techniques/fewer-tools/): fits. Filter the tool list per step.
- [Cap tool output](https://usefewertokens.com/techniques/output-caps/): fits. Reshape results with toModelOutput in the Vercel AI SDK.
- [Run side tasks on a smaller model](https://usefewertokens.com/techniques/smaller-subagents/): fits. Route side tasks to a smaller model.
- [Keep instruction files short](https://usefewertokens.com/techniques/instruction-files/): partly. Keep the system prompt short.
- [Measure what fills the window](https://usefewertokens.com/techniques/audit-commands/): partly. Log input tokens per request.

## Links
- Optimizer set to Claude API and Agent SDK: https://usefewertokens.com/harnesses/claude-api/
- How to reduce AI agent token usage: https://www.stackone.com/blog/reduce-ai-agent-token-usage/
