qvib.pro
RU

Save tokens in Claude Code

Save tokens in Claude Code with no third-party services: /model opusplan, /compact and ultrathink — three built-in commands stretch your weekly limit.

бесплатно любой

Официальная документация Claude Code подтверждает: алиас `opusplan` — «Special mode that uses `opus` during plan mode, then switches to `sonnet` for execution» (страница Model configuration) и настройку модели командой `/model` с порядком приоритетов источников (сессия → запуск → env → settings); что Sonnet дешевле Opus за токен («Sonnet ... costs less than Opus») и что команда `/compact` принимает фокус («/compact Focus on code samples and API usage tells Claude what to preserve during summarization», плюс правила компактации в CLAUDE.md), а extended thinking включён по умолчанию — всё это на странице Manage costs. Ключевое слово `ultrathink` как максимальный уровень «think»-бюджета описано Anthropic в best-practices по агентному кодингу и работает в CLI Claude Code, а не в веб-чате. Сообщение «Not enough messages to compact» и точный вид индикатора компактации — приблизительная передача поведения CLI, не цитата из доки. Прирост недельного лимита числом не заявляется — это оценка автора разбора. Проверено 2026-07-13. checked 2026-07-13

Updated: 13.07.2026

$ /model opusplan

Open source ↗

Save tokens in Claude Code

Claude Code burns through your weekly limit for no reason: Opus deliberates even over renaming a variable, and the chat drags the whole history along with every request. Three commands fix that 🔥

This isn't a new service, it's three built-in Claude Code features. All of them are free — you only pay for access to Claude Code itself (subscription or API). Below: what to turn on, how to check it worked, and where the traps are. The order matters — the biggest money-saver comes first.

Step 1 — Opus for plans only, Sonnet for code: /model opusplan

The pain: by default one expensive model grinds through both planning and dumb indentation fixes. Planning is worth it, routine work isn't.

/model opusplan

What it does: Opus works in plan mode, and for execution Claude switches to Sonnet on its own. Sonnet costs less per token — so the routine work moves to the cheap model without losing plan quality. This is an officially documented alias, not a hack.

How to tell it worked: the session header/status shows the model as opusplan; while tasks run you see sonnet, and during the planning stage — opus.

Common mistakes:

  • Expecting Opus quality in the code itself — no, Sonnet writes the code. If the whole task is heavy (architecture, race conditions, security) — stay on /model opus.
  • Whether a model choice made via /model survives into the next launch depends on the CLI version and where it was set. The docs describe the precedence order (session → launch --model → env ANTHROPIC_MODEL → settings). If you want it to stick, put the model in settings.

Step 2 — Stop hauling the entire conversation around: /compact

The pain: the longer the chat, the more context Claude re-reads on every request. You're paying tokens for old chatter.

/compact
/compact Focus on the auth module and the currently failing tests

What it does: it compresses the conversation history into a dense summary and works from that instead of the full log. The second form adds a hint about what exactly to keep (the docs give the example /compact Focus on code samples and API usage). Standing compaction rules can be written into CLAUDE.md.

How to tell it worked: a compaction marker appears, and the context counter (check it with /context) drops noticeably.

Common mistakes:

  • Firing it too early — there's nothing to compress, and Claude answers something like "Not enough messages to compact".
  • A blind /compact with no focus can throw out a detail you needed. At an important stage, spell out the focus in text, like in the second example.

Step 3 — Think before the code, not after: ultrathink

The pain: without deliberation the model rushes straight into writing, hits a wall and redoes the work. Those redos are the quiet drain on your limit through iterations.

Refactor the payments module. ultrathink — think the whole plan through first, then write the code.

What it does: the keyword in the prompt raises the extended thinking budget, and the model works the task out before the first line of code. It works specifically in the Claude Code CLI, not in the Claude.ai web chat (there it's just a word in the text).

An honest caveat: ultrathink itself does NOT save tokens at this step — quite the opposite, it spends more on thinking. The win is indirect: fewer botched attempts and fewer rounds of rework. On a simple task you don't need it.

How to tell it worked: before the code you see an expanded reasoning/plan block, not an immediate diff.

Common mistakes: slapping ultrathink into every prompt, including "change the button color" — that just burns the thinking budget for nothing.

The result: Opus stops squandering itself on routine, the chat stops hauling kilobytes of old history, and the model reworks less. According to the author of the write-up this buys several extra hours of limit per week (the number wasn't measured, it's an estimate).

🆘 Rescue prompt

ultrathink. First lay out a plan for the whole task, break it into steps,
and only then write the code — minimum rework.

I keep the model on opusplan: Opus for planning, Sonnet for execution.

When our conversation grows and the context fills up with stale material,
remind me to run /compact with a focus on the current task.
Confirm briefly that you understand the mode.

💎 Depth and value

  • The three techniques save in different ways, don't mix them up: opusplan cuts cost directly (Sonnet is cheaper than Opus per token and it's officially documented), /compact cuts context volume, and ultrathink saves on iterations rather than tokens directly. The biggest money-saver of the three is the first one.
  • How this ties in with its qvib neighbours: /compact treats the symptom of a bloated chat, but the root cause — "Claude re-reads the repository from scratch every time" — is handled systematically by the Codebase Memory MCP card; for durable memory between sessions see Ponytail. The three commands are a quick win right now, the MCP approach is the long game.
  • All of this is standard Claude Code machinery, not third-party services, and the details change with CLI versions: check via /help and the official docs. For example, so that your model choice doesn't get lost between sessions, it's more reliable to set it in settings (the docs describe the precedence order of model sources) than to rely on /model inside the session.

Читать по-русски →