How to Use Claude Code Mode to Cut Your Token Bill

How to Use Claude Code Mode to Cut Your Token Bill

November 25, 2026Faisal Mahmood7 min read

Claude Code has a new experiment that can cut the tokens your coding sessions burn, and it arrived with Claude Code 2.1.323 on 12 November. It is called Code Mode, and it changes how Claude makes tool calls. Instead of calling tools one at a time and reading every result into the context window, Claude writes a small JavaScript program that makes the tool calls itself and returns only what matters. Less text in the context window means fewer input tokens and a smaller bill.

This guide explains what Code Mode is, how to turn it on, what it actually saves, and where it does not help. It also covers the limits, because this is an experiment, not a finished feature, and the savings depend heavily on the task. Do not expect a fixed percentage off every session.

What Claude Code Mode Changes

In normal Claude Code use, Claude calls one tool, reads the result, then calls the next tool. Every result lands in the context window, including long file listings, search output, and command results you never needed in full. Input tokens pile up from results, not just from your prompts.

Code Mode changes the shape of that work. Claude writes a small JavaScript program that runs in a REPL tool and makes the tool calls itself, using Bash, Read, Edit, and MCP tools. The program does the looping, filtering, and combining, then returns only the answer that matters. Anthropic shipped it as an experiment in Claude Code 2.1.323, and it is off by default, so nothing changes for you until you switch it on.

How to Turn On Claude Code Mode

There are two ways to enable it, and both use the same environment variable. The first is to start Claude Code with the variable set, like this: CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude. The second is to put the variable in the env block of your settings file at ~/.claude/settings.json, so it applies every time you start Claude Code. After either route, confirm the prompt once when Claude Code asks.

Before you enable it, check your Claude Code version. Code Mode shipped in 2.1.323, so update first if you are on an older release. The variable does nothing on a version that does not include the experiment. Code Mode works in the interactive terminal only. Scripts are checked in auto mode, and your permission rules still apply, so Code Mode does not bypass the safety settings you already have.

What It Actually Saves: Real Test Figures

Independent tests, all run on Opus 5.5, give a useful picture of the savings. On a feature and tests task, the cost fell by about 22 percent, from $0.45 to $0.35. On a broken link check, it fell by a similar amount, from $0.20 to $0.16. On a 20 file edit, the cost was roughly the same with Code Mode on or off. On a 40 file order query, input tokens fell by 37 percent. Those figures show the pattern clearly: tasks that read a lot of files save the most, and tasks that do one thing save the least.

The reason is simple. Code Mode saves tokens by keeping raw tool output out of the context window. A task that reads 40 files generates a lot of raw output, so filtering it in a program saves a lot. A task that makes a single call generates almost no raw output, so there is nothing to save, and the program itself adds a little overhead. That is why single call tasks may not benefit at all, and can even run slower. One test saw a task slow from 15 seconds to 37 seconds with Code Mode on. The saving is real, but it is not free.

The dollar figures in these tests are small, and that is worth saying plainly. Saving ten cents on a task does not change a budget. The saving matters when the task repeats. A broken link check that runs daily, a search that runs across every pull request, or a file audit that runs weekly will turn a small per run saving into a real monthly difference. If you also review pull requests with Claude, see how Claude Ship reviews, fixes, and approves pull requests.

When to Use Code Mode and When to Leave It Off

Use Code Mode when a task reads many files, searches across a codebase, or checks a long list of items. A broken link check, a search for a pattern across 40 files, or an audit of a folder of documents are all good candidates, because the raw output is large and most of it does not need to reach the context window. Leave it off for a single edit, a quick question, or a task with one tool call, because there is nothing to save and the program adds overhead.

The same thinking applies inside a bigger job. A feature build that starts with reading a dozen files and ends with a single edit will benefit in the reading phase and gain nothing in the edit phase. That is fine. Code Mode is a switch you can leave on for the session and judge by the totals. The same judgement applies to client work such as the systems in the complete guide to AI powered email outreach automation.

How to Measure Your Own Saving

Do not trust a percentage from someone else’s test. Run the same task with Code Mode on and off, and compare your own session totals. Pick a task you repeat, such as a broken link check or a search across a set of files, and run it once in each mode. Note the input tokens and the cost for each run.

Keep a small log for a week. Write down the task, the mode, the input tokens, and the cost. After a few repeats, you will know which of your tasks benefit and which do not, and you can switch Code Mode on for the ones that do. That is the practical approach, and it beats arguing about a headline percentage. For a wider look at recent Claude changes, see new Claude features for teams and everyday work, and check how to check Claude Code for leaked secrets if your workflow touches private keys.

Limits and Who Cannot Use It

Code Mode is experimental, and the exclusions are specific. As of 16 November, it is excluded for gateways, cloud provider accounts, zero data retention configurations, and HIPAA configurations. If your organisation uses any of those, do not expect to see it, and do not try to work around the exclusion. The exclusion exists for compliance reasons, and your admin can confirm whether it applies to you.

There is one more confusion to avoid. Anthropic has published figures for programmatic tool calling from an older API feature, about 150,000 tokens down to 2,000. That is a different, older feature, and those figures are not Code Mode figures. Do not quote them as Code Mode savings. Code Mode saves a useful share on the right tasks, not a near total cut. You can read more on the official sites: Anthropic and Claude. For a wider view of what changed across the assistants, see new AI assistant features launched this month.

FAQs

Is Claude Code Mode on by default?

No. It is off by default. Enable it with the CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 variable, either when you start Claude Code or in the env block of ~/.claude/settings.json, then confirm the prompt once.

How much will Code Mode save me?

It depends on the task. Tests on Opus 5.5 found about 22 percent cheaper on a feature and tests task and a broken link check, 37 percent fewer input tokens on a 40 file order query, and roughly no saving on a 20 file edit. Run the same task with it on and off and compare your own totals.

Does Code Mode work outside the terminal?

No. It works in the interactive terminal only. It also does not apply to gateways, cloud provider accounts, zero data retention, or HIPAA configurations.

Does Code Mode bypass my permission rules?

No. Scripts are checked in auto mode and your permission rules still apply. Code Mode changes how tool calls are made, not which actions need approval.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top