The new Claude Code mode has been launched, no model replacement is required, and the token consumption is cut by up to 77%.
Developers who have used Claude Code almost all share the same experience: it is extremely efficient to get work done, but when they see the rapidly jumping Token consumption and bills in the background, their hearts ache.
In the past, if users wanted AI agents to run faster and cost less, they usually only had two options: either wait for manufacturers to release cheaper new models, or manually downgrade the main model to a smaller one, putting up with the decline in delivery quality.
But recently, Anthropic quietly added an experimental feature that is disabled by default in the update log of Claude Code (version v2.1.323 and above) — Code Mode. Third-party actual tests show that without changing the model at all or sacrificing intelligence, enabling this mode to run multi-step development tasks can directly reduce the real API bills by 22%–23%; in scenarios where external tools are called frequently, the total amount of Tokens processed cumulatively by the model has even plummeted by 62%–77%.
When Anthropic further hands over the local script orchestration right, code has further become the most efficient communication protocol between Agent and tools.
Why did Claude Code cost so much in the past?
To understand what Code Mode saves, we must first see how "cumbersome" traditional agents work.
In normal mode, Claude Code usually directly organizes tool calls by the model. For example, it first searches for files via Bash, then calls Read to view the content, and finally uses Edit to modify the code. If subsequent operations depend on the execution result of the previous step, the tool needs to return the result to the model, which will judge what to do next.
Although Claude Code itself already supports parallel tool calls and can execute commands in batches through Bash scripts, for tasks that require multi-step judgment and cross-tool collaboration, the model may still repeatedly participate in the intermediate process, consuming Tokens continuously.
This process is no problem when only one or two functions are modified. But once you encounter tasks such as finding errors across dozens of files, or pulling hundreds of external records through MCP (Model Context Protocol), two hidden overheads will quickly expand the context.
The first overhead appears at the starting point. An independent review site bestagent.dev disassembled the request payload and found that when Code Mode was not enabled, Claude Code sent 16 built-in tool definitions to the model by default in each round, and the volume of the first round of request alone reached about 38,000 tokens. As long as the session continues, this "tool instruction manual" is retransmitted repeatedly in every round of requests.
The second overhead is hidden in the intermediate process. Many tool return values only need a quick glance to filter out a few lines of useful content, but under the mechanism of round-by-round calls, the entire log and the whole batch of original records must all be kept in the conversation history. In the test of the open-source benchmark Bicameral, when the model was asked to pull 120 work orders through MCP and count the total refund amount, the normal mode was forced to pull all 120 records into the context in separate rounds.
It can be seen that in the past, every time the agent called a tool, it had to load the full amount of original output together with all tool definitions into the next round of context, causing the problem that the more rounds there are, the Token consumption expands in a snowball manner.
A surgical operation on the scheduling architecture
In essence, what Code Mode does is to reconstruct the scheduling division of labor between the model and tools.
After enabling Code Mode, Claude can first write a piece of JavaScript, to organize multiple tool calls, conditional judgments, loop execution and result filtering into the same piece of code. For operations that do not require step-by-step decision-making by the model, the program can execute continuously, process the data returned by the tools directly, and finally send only the necessary results back to the model context.
Anthropic's official documentation gives an intuitive example: for example, if you want Claude to find a certain configuration file, change the number of retries in it from 3 to 5, and then run the test. In the past, it had to find the file once, wait for the result to return, then modify the configuration once, run the test again after modification, and every step had to go through the conversation.
After enabling Code Mode, it will write a small script by itself, complete "finding files, modifying configurations, and running tests" at one go locally, and finally only return the two conclusions of "which file was modified and whether the test passed" to the conversation.
The directories searched in the middle and a large number of generated test logs can all be processed and filtered by the code first, and then the necessary information is handed over to the model. As for how many Tokens can be saved in the end, it still depends on the amount of data returned by the script.
At the same time, Code Mode has been greatly streamlined at the entrance: the built-in tool definitions received by the model side have been reduced from the original 16 to only 3 core entrances that retain functions such as code execution and status polling.
Two independent third-party tests show consistent changes. bestagent.dev measured that the first round of requests dropped from about 38,000 tokens to about 22,000 tokens. Bicameral also measured on 4 models that 13,055—13,106 tokens are fixedly reduced at the start of each round.
Code Mode cuts off the tool definitions retransmitted in each round and the intermediate redundant output, leaving the context window for the information that really needs the model to make judgments.
Dividends of strong models, traps for weak models
The logic of saving Tokens sounds impeccable, but the scores in the real world show a sharp differentiation.
The most complete public test currently comes from the open-source benchmark Bicameral. The team ran 6 types of tasks on Claude Code v2.1.326 with four models Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.2, with 2 runs per group, a total of 96 runs (48 groups of switch control).
The most outstanding performance is the high-frequency MCP data fetching and summation test: pull 120 work orders one by one through external tools and count the total refund amount. The conversation context increment of the 4 models plummeted from about 54,000 tokens to 3,500—8,800 tokens (a decrease of 84%—94%). All 16 runs answered correctly, and the cumulative processed Tokens decreased by 62%—77%.
In the judgment-type data fetching tasks that need to read and screen repeated deductions, the processed Tokens are reduced by 40%—68%, and the conversation context is reduced by 65%—83%. However, the test team stated that these manually generated work orders have sentence pattern rules, and the model script just took the opportunity to skip the repeated paragraphs. And 3 unqualified failures occurred, all of which appeared on the Haiku 5.5 model.
If you switch to another daily work, this set of numbers will shrink.
Back to the local file modification that everyone does every day (check dead links in 47 Markdown files, and rename functions across 36 calls in a Python project). Looking only at the newly generated conversation content (Task context) during the execution process, 14 of the 16 control groups not only did not decrease, but increased because of extra script writing or troubleshooting.
However, since the "tool instruction manual" carried at the start of each round after enabling is fixedly reduced by about 13,000 Tokens, after offsetting the pros and cons, the cumulative processed Tokens of Opus 5.5, Sonnet 5.5 and Fable 5.2 after the whole run still decreased by 15%—54%.
Only Haiku 5.5's processed Tokens in the file task increased by 9%. Looking back at the logs, the main reason is that one of the scripts found the wrong directory, and a large number of accumulated error records ate up all the quota saved from the starting base.
In addition, it should be noted that the report specifically emphasizes: "Cumulative processed Tokens" is not equal to the actual bill cost, because the bulk of the saved part belongs to the prompt cache that is read repeatedly. The platform itself charges a discounted lower rate for this part of the cache.
Another set of third-party tests from the independent review site bestagent.dev converted this account into US dollars. The team ran 3 real open-source repository tasks 3 times each on Claude Code v2.1.325 with Opus 5.5 according to Anthropic's official API price, and measured numbers that are closer to daily experience:
Add new CLI parameters with tests: after enabling Code Mode, the single cost drops from $0.45 to $0.35 (23% saved), and the time consumption is reduced from 80 seconds to 60 seconds.
Check dead links in 134 Markdown files: the cost drops from $0.20 to $0.16 (22% saved), and the time consumption is reduced from 26 seconds to 18 seconds.
Unify adding version numbers to 20 skill description files: the cost is almost the same ($0.16 vs $0.17). Because even without Code Mode, Claude will write a small script in Bash to complete all modifications at one go.
However, bestagent.dev only tested short tasks within two minutes with the single Opus 5.5 model. For complex tasks like the one in the first set of tests, there may still be better actual cost differences.
It can be seen that Code Mode is really good at some complex batch processing tasks, such as cross-tool batch data processing, and repository development that requires multi-round retrieval and test linkage. When encountering simple file corrections that can be solved with a single shell command, it makes almost no difference whether to use it or not. Using a weak model (Haiku 5.5) to write the wrong script path may even amplify the rework loss.
It can save money and speed up, but why is it "disabled by default"?
Since it can save real money, why does Anthropic set an environment variable threshold (CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1) and mark it in the document with the warning that "it is an experimental feature and may be modified or even removed at any time"?
The primary bottleneck lies in safety check and process monitoring.
In the traditional mode, every time Claude reads a file or runs a command, it has to initiate a separate request, so the system's permission rules, hook scripts and security audits can check them one by one. The enterprise monitoring system can also leave a clear record for each tool call.
But after enabling Code Mode, Claude writes a series of actions into a whole piece of JavaScript and runs them all at once. The security classifier in Auto mode can only take a rough look at the whole piece of code, and cannot check each path dynamically assembled during operation one by one as in the past.
In order to prevent risks, the official added multiple layers of hard locks on the activation threshold. Claude Code will deliberately ignore the Code Mode switch in the project directory configuration file, to prevent developers from being secretly enabled by the other party when cloning an external repository. If the user enables enterprise monitoring export or disables telemetry, the client will directly refuse to start Code Mode.
Apart from security checks, the available scenarios are still limited.
From the perspective of support scope, the current Code Mode is more like a "test field" limited to the pure command line terminal. It currently only supports use in local interactive terminals, directly connected to Anthropic official subscriptions or Console accounts. Desktop App, VS Code plugin, and third-party cloud platforms such as Amazon Bedrock and Google Cloud are not available for the time being.
For users who want to try it now, pay attention to two points: first, decide to turn on or off according to the task, the effect of saving Tokens is obvious only when doing complex tasks such as batch processing. Second, several linked functions will be temporarily unavailable after enabling, remote control, Chrome browser linkage and computer use will be disabled.
From a higher perspective, Code Mode has verified something enlightening to the industry: without changing the underlying model, just by correcting the working mode of the Harness layer of "who organizes the loop and where the intermediate data is stored", more than 20% of the real cost can still be squeezed out for mature clients like Claude Code.
Similar improvements have been promoted by several teams along the same direction in recent months, from cloud infrastructure to open-source programming tools. Cloudflare and OpenCode 2 have both developed similar functions to check directories on demand and combine call tools with scripts. The DeepSeek Harness open-sourced in August also has a built-in Programmatic Tool Call (PTC) mode among its four operating modes. However, their respective capabilities to reduce Token costs, ease of use and safety remain to be demonstrated by more comparative tests.
This article is from the WeChat official account "AI Front" (ID: ai-front), authors: Fei Ye, Si Yue, published with authorization from 36Kr.