Lennox Saint
Open menu
LAB 0045

on YouTube 18 nov 2026

field notes · new episode

make Claude Code use fewer tokens with one new setting - and when it backfires

from the episode: make Claude Code use fewer tokens with one new setting - and when it backfires | LAB 0045

Lenny's AI Builders - LAB 0045

one Claude Code setting, 36 to 38% fewer tokens in every pair of my test, the catch on cost, and a prompt that gives you 10 versions.

if you build with Claude Code, one new setting can make it use fewer tokens.

i tested this myself. every pair of runs used 36 to 38% fewer tokens.

but there is a catch. my first run cost 83% more at api prices. the other two pairs came out 15% and 17% cheaper.

why it matters

the setting turns on Code Mode. Claude writes code that makes several tool calls in one step.

without it, Claude asks for one tool call, reads the result, then picks the next one. with it, one piece of code can make the calls and hand back only the part Claude needs to read.

but Anthropic's own page never mentions tokens, so i tested it myself.

and in my test, fewer tokens didn't always mean a lower cost.

what you get

one line turns it on. in my test it gave me:

  • fewer tokens. every pair used 36 to 38% fewer.
  • several tool calls in one step. Claude writes one piece of code instead of asking for each call one by one.
  • the same answer. both jobs gave the same answer with it off and on.

my test: three pairs on Opus 5.5

on 17 November i ran the same jobs with Code Mode off, then on. Claude Code 2.1.326, Opus 5.5, medium effort, the same prompt and the same copy of the repo each time.

job one: find broken links across 138 Markdown files. job two: sum up that repo in one sentence. job one ran twice and job two once, so three pairs and six runs.

  • tokens: 36 to 38% fewer in every pair.
  • cost, first pair: my first run cost 83% more at api prices. it wrote far more to the one-hour cache, and on Opus 5.5, writing to that cache costs 40 times as much as reading from it ($8 vs $0.20 per million tokens).
  • cost, the other two: the other two pairs came out 15% and 17% cheaper.

so check your cost, not just your tokens. the token numbers here are from my own test.

try it

  1. check your version. run claude --version. you need v2.1.323 or later. if it's older, run claude update.
  2. add the setting. set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in your shell, then start claude in your terminal.
  3. say yes. the first time, Claude Code asks you to confirm. pick Yes, turn on Code Mode.
  4. give it a job with lots of related tool calls. Anthropic's example is one change that repeats across many files.
  5. run the same job with it off and on. compare the tokens and the cost.

or do what i said on the episode: give your agent the link to this episode and say, go and switch on Code Mode for me.

to switch it off, remove the setting or set it to 0, then start a new session.

copy this prompt

this is Gabriel Petersson's prompt from the practical. use it any time you make something with AI:

Lenny’s AI Builders / LAB 0045
make 10 different increasingly high variance versions and show me, then i can pick the best one

i ran it in Claude.ai on the web, on Opus with medium effort, on the hook of my Threads post with 444K views.

number 1 stayed close: "okay, why the hell isn't anyone talking about this?" number 10 went far: "i found out something today and honestly wish i hadn't."

try it on designs, landing pages and plans too, then pick your favorite parts of each.

you'll know it worked when

Claude Code restarts and shows this line near the top of the session: Code Mode (experimental) is on · this session can be resumed only with Code Mode on

press Ctrl+O and you'll see Code rows. that's the code Claude wrote to make its tool calls.

the real win: the same job uses fewer tokens and costs less.

if you see a different line or none, Code Mode didn't start. check your version, and check you're in the terminal, not the VS Code panel. if your tokens drop but your cost goes up, it's backfiring on that job.

for the prompt: number 1 should stay close to what you had, and number 10 should go far.

limits and dates

  • experimental and off by default. Anthropic says it may change or be removed in any release.
  • terminal only. it runs in an interactive Claude Code session in the terminal. not claude -p, the Agent SDK, the VS Code panel, the desktop app or cloud sessions.
  • it needs a Claude subscription or Console account, and Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2.
  • cost is at api prices, not my bill. on my subscription, the weekly meter read 53% before and after all six runs. it only shows whole percents, so the runs were too small to show up.
  • my test is small. two small jobs, three pairs, one model, one machine. it doesn't prove Code Mode is cheaper or dearer for you.
  • why the first run wrote more, my test can't say. the cache wasn't reset between runs.
  • the prompt test is one run on one hook.
  • dates. Code Mode came out in Claude Code 2.1.323 on 12 November 2026. i ran my test and read the docs on 17 November 2026. LAB 0045 went public on YouTube on 18 November 2026.

the rest of this LAB

  • Qwen4-Max and Hy4 flash. Hy4 flash is $0.07 in and $0.28 out per million tokens, and Tencent says it's close to Haiku 5.5 in a blind test with 85 of its own users. Qwen4-Max is $1.50 in and $4.50 out, and Alibaba says cost per task drops about 60% on its own test. Haiku 5.5 is $0.10 in and $0.50 out, so Qwen4-Max costs more than Haiku. the $0.10 is for prompts up to 100,000 tokens.
  • Anthropic's guide to always-on agents. an event inbox, timers, memory, permissions and an outbox. the agent sleeps most of the time, your passwords sit in a proxy outside it, and memory only holds what it can't look up again. my version: one rules file it loads every run, plus one progress file per job.
  • iPhone Duo in the simulator. Claude Code on desktop can run your app on an iPhone Duo in the iOS simulator, then fold and unfold it to test each layout. it's a public beta, and you need Xcode 27.1 or later.
  • Hugging Face and OpenRouter. one token and one endpoint for every open model on the Hub that a provider serves. Hugging Face says it adds no markup. there are setup guides for Claude Code and Codex, and $2 of credits a month on PRO.
  • Jensen Huang. a source told CNBC that Nvidia's board is not considering bringing him back, and a petition to reinstate him has 180,000 signatures, per CNBC. after filming, Nvidia reported $115.8B revenue for the quarter, up 103% on a year ago. that was Jensen's quarter. my take: i believe Jensen should be reinstated.

sources

next step

watch LAB 0045 on YouTube - my test starts at 0:13 and the practical starts at 10:47.

or listen to LAB 0045 as a podcast.

today's sponsor is my software, Threadify: your lead generation agent for Threads, X and YouTube. it tracks your links, so you see which posts actually drive clicks, then you do more of what's working. same idea as Code Mode - stop guessing and test it on your own stuff. start your free 7-day trial - card required.

want the next one? get the next field notes. optional - these notes stay free to read.

want the next one?

free. unsubscribe any time, one click. privacy.