---
title: "Claude Code Mode Token Savings and Setup"
canonical: https://wavect.io/blog/claude-code-code-mode-token-usage/
language: en
description: "Claude Code Mode used 55,705 fewer input tokens in one test. See what the Markdown demo measured, enable the terminal flag and compare runs on your own files."
image: "https://wavect.io/img/blog/headers/header_claude-code-code-mode-token-usage.png"
author: ["Kevin Riedl"]
published: "2026-11-16"
updated: "2026-11-16"
reviewed: "2026-11-16"
---

# How many tokens does Claude Code’s Code Mode save?

[**Back**](/blog/overview/)

[![Kevin Riedl](/img/team/kevin.webp)](/team/kevin-riedl/)

[Kevin Riedl](/team/kevin-riedl/) https://linkedin.com/in/wsdt

5 min read · 16 November 2026 Last reviewed November 16, 2026

[**Next**](/blog/caveman-3-claude-code-input-compression/)

TL;DR

Claude Code’s experimental Code Mode groups tool calls in JavaScript and can return just the findings. On a 40-file order query it used 37% fewer input tokens including cache, with four model requests in each mode. A separate Markdown demo found three broken links in two model turns. Try it in the native terminal from v2.1.323 and check accuracy and elapsed time alongside token usage.

Which three customers spent the most? To answer that question across 40 order files, Claude Code used 55,705 fewer input tokens with Code Mode on. It found the same three customers. The ordinary session returned the answer in 15 seconds. With Code Mode on, it took 37. [Juan Andrés Núñez’s paired terminal runs](https://wmedia.es/en/tips/claude-code-code-mode-turn-on)

## What does Claude Code do differently in Code Mode?

Code Mode lets Claude write JavaScript that calls its tools and chooses which results to send back to the model. Take a Markdown link check. The script can read each file, resolve paths and keep a list of failures. Claude can write the report from that list without reading every successful lookup. [Anthropic’s guide to Code Mode](https://code.claude.com/docs/en/code-mode)

A tool call might read a file. A model turn is a chance for Claude to see the evidence and decide what to do next. Several file reads can fit in one turn. Keeping the successful reads out of the conversation leaves room for a follow-up, such as finding which commit moved the missing file. Returning entire files would use that space again.

Ordinary Claude Code can already write a script through Bash. That matters when you compare modes. In the orders test, the ordinary session used Python, and both sessions made four model requests. The author traced much of the difference to the smaller tool descriptions sent with those requests. You can also reduce large tool results with a separate proxy, as our [Caveman input-compression review](/blog/caveman-3-claude-code-input-compression/) explains.

## Where did the 55,705-token saving come from?

In Núñez’s November 2026 test, Opus 5.5 at medium effort ranked customers by paid orders in 40 JSON files. He ran each setting once on Claude Code 2.1.323. The input total includes cached tokens across all four requests. Each run identified the same customers in the same order. [Test setup and session totals](https://wmedia.es/en/tips/claude-code-code-mode-turn-on)

| Measurement | Code Mode off | Code Mode on |
| --- | --- | --- |
| Input tokens, including cache | 150,364 | 94,659 |
| Output tokens | 1,172 | 1,213 |
| Model requests | 4 | 4 |
| Elapsed time | 15 s | 37 s |

The difference comes to 37.0% of the baseline input. Cache reads carry a different price from fresh input, and output rose slightly. To budget for recurring work, track what it costs to get a correct answer. Our [guide to cost per completed task](/blog/cost-per-token-vs-cost-per-task/) explains how to include retries.

## Did the broken-link demo go from 13 turns to two?

Daniel San reported **13 tool calls in two model turns** on Fable 5.2. The run found all three broken Markdown links. Both counts describe the same session. His post gives no turn count for the job with Code Mode disabled, so it leaves the size of any speedup open. [Daniel San’s terminal demo](https://x.com/dani_avila7/status/2121789095168868770)

Anthropic’s **150,000 to 2,000 tokens** figure dates to November 2025. In its Model Context Protocol (MCP) example, an agent moving a transcript from Google Drive to Salesforce loaded only the tool definitions it needed. That saves 98.7% in the example. For a measured Claude Code CLI comparison, use the orders table above. [Anthropic’s MCP example and token calculation](https://www.anthropic.com/research/code-execution-with-mcp)

## How do you enable Code Mode in the terminal?

Start an interactive session with the native Claude Code CLI, version 2.1.323 or later. Anthropic introduced the experimental feature on 12 November 2026 and leaves it off by default. On macOS, Linux or WSL, these commands check the version and enable Code Mode for one launch. [Claude Code v2.1.323 release notes](https://github.com/anthropics/claude-code/releases/tag/v2.1.323)

```
claude --version
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude
```

Accept the first-run prompt and check the startup banner for confirmation. Press `Ctrl+O` and expand a Code row to inspect the JavaScript. If the banner says the feature is unavailable, `/status` gives the reason. Check the account and surface first. Anthropic supports direct Claude subscriptions and Console accounts on eligible models. Gateways, cloud-provider accounts, zero-data-retention and HIPAA configurations are excluded as of 16 November 2026. [Current requirements and troubleshooting](https://code.claude.com/docs/en/code-mode)

## How can you test Code Mode on your own Markdown files?

Give both modes the same files and a question with a known answer. A short report is cheap to produce if it silently skips a broken link. This small example checks two common mistakes in a link audit. One filename contains an encoded space, and one apparent link is an example inside inline code.

In an empty test directory, create these two files. The shell commands work on macOS, Linux and WSL.

```
printf '# Guide\n' > guide.md
cat > links.md <<'MD'
[Guide](guide.md)
[Install](install.md)
[Release notes](Release%20Notes.md#changes)
`[Example](sample.md)`
MD
```

Start a fresh session in that directory. Give it this prompt in each mode.

> Check local file links in links.md. Resolve each path relative to the file, decode URL escapes and ignore fragments and inline code. Report the source line and decoded path for each missing file. Leave the files as they are.

The expected report has two rows. Line 2 points to `install.md`. Line 3 points to `Release Notes.md`. A report that flags `sample.md` has counted an example as a link. This is a correctness check you can repeat. The published timing and token figures above come from their respective authors.

1. Use the same checkout, model, effort level and permissions. Start one fresh session with `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=0 claude` and another with the value set to `1`. Confirm the setting in each.
2. Check the two expected rows first. Then open `/usage` and record session input, cache reads, cache writes and output separately. Record elapsed time and the number of model requests. [Anthropic’s guide to session usage](https://code.claude.com/docs/en/costs)
3. Repeat on a real documentation change, alternating which mode runs first. If a reviewer has to reopen the files to locate a failure, include that time. A path and line number can be worth a few extra tokens.

## When is Code Mode worth enabling?

I’d try Code Mode for a release check that reads many files and produces a small list someone can act on. Keep it for that job if it finds the same failures and the measured savings justify the wait. For a one-file fix, I’d start in the ordinary session until the extra tool traffic shows up in the numbers.

## Claude Code Mode questions

### Can I enable Code Mode for every project?

For your own account, set `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` to `"1"` in the `env` block of `~/.claude/settings.json` and start a new terminal session. Claude Code ignores this variable in project settings. An organization can block it through managed settings.

### How do I enable it in Windows PowerShell?

Install Git for Windows and use the native Claude Code CLI. Set `$env:CLAUDE_CODE_EXPERIMENTAL_CODE_MODE = '1'` in PowerShell, then run `claude` in the same shell. Accept the first-run prompt and check the banner.

### Can I run the experiment in CI or in the VS Code panel?

The current release requires an interactive terminal. The VS Code panel, Desktop app, Agent SDK and `claude -p` fall outside the supported surfaces. Use a regular terminal for both halves of the comparison.

### Can I resume the same conversation with Code Mode switched off?

A Code Mode conversation resumes only in a terminal with Code Mode enabled. To compare settings, keep the first conversation for reference and start a fresh one with the variable set to `0`.

### Does one script get permission for every tool call?

Each call still goes through Claude Code’s deny and ask rules and its `PreToolUse` hooks. In auto mode the classifier reviews the script before execution. Values computed later, such as a filename discovered by a search, are outside that review.

Models and infrastructure

## Read next

Model selection, inference economics, local deployment, compression and serving architecture.

[Start here**Self-Hosting LLMs in the EU: When Open Weights Actually Pay Off**](/blog/self-hosting-llms-eu-cost/)

- [Can you train MiniMind from scratch in two hours on an RTX 3090?](/blog/minimind-training-from-scratch/)
- [Odoo AI credits: budget a reviewed quotation workflow](/blog/odoo-ai-cost-per-accepted-workflow/)
- [Odoo Helpdesk AI: classify, draft or escalate?](/blog/odoo-helpdesk-ai-classify-draft-escalate/)
- [How to Validate Open Ontologies Derivation Certificates](/blog/open-ontologies-proof-verification/)
- [Does Scrapling Save Scraped Items in Checkpoints?](/blog/scrapling-checkpoints-scraped-items/)

[Next article**Can you train MiniMind from scratch in two hours on an RTX 3090?**](/blog/minimind-training-from-scratch/)

[**Back**](/blog/overview/)

[![Kevin Riedl](/img/team/kevin.webp)](/team/kevin-riedl/)

[Kevin Riedl](/team/kevin-riedl/) https://linkedin.com/in/wsdt

5 min read · 16 November 2026 Last reviewed November 16, 2026

[**Next**](/blog/caveman-3-claude-code-input-compression/)
