Blog / Zed
How to Reduce Token Usage in Zed
Zed bills its AI agent in raw tokens with a flat markup on top of provider price, not a fuzzy credits abstraction. auto_compact, compaction_model, Profiles, and BYOK are the settings that actually move the number.
Published August 31, 2026
Zed switched its AI pricing from prompt-based limits to straight token billing, and said so plainly in its own announcement: LLM bills had become the company’s biggest expense, and prompt-based pricing meant “a typo fix cost the same as complex refactoring.” Token-based billing was framed as fixing that mismatch. It also means there’s no credits abstraction to squint at — Zed’s pricing docs show the real per-token rate for every model, markup included. Here’s what actually moves that number.
1. Check the price spread before picking a default model
Zed applies a consistent ~10% markup on top of whatever the provider charges, and the spread between hosted models is enormous: GPT-5 nano runs $0.055 input / $0.44 output per million tokens, while GPT-5.5 pro runs $33 input / $198 output — roughly 600x apart for input alone. Claude and Gemini options span a similar range, with context windows differing too (Claude Opus 4.5 and Haiku 4.5 top out at 200k, while Claude Fable 5 and Gemini 3.5 Flash go to 1M). Pin a cheap, capable model as your default for routine edits, the same model-choice lever Warp and Gemini CLI use, and reach for a premium model deliberately instead of by default.
2. Tune auto_compact instead of trusting the 90% default
Zed compacts a thread automatically once it crosses a configured threshold — 90% of the context window out of the box:
{
"agent": {
"auto_compact": {
"enabled": true,
"threshold": "90%"
}
}
}
threshold also accepts a positive integer (compact once the thread hits that many tokens) or a negative one (compact once that many tokens remain). If you’re running a model with a huge window and don’t want compaction eating context you’re not close to exhausting, push the percentage up. If you’d rather compact earlier and keep summaries fresher, pull it down. Either way, know what the number is doing instead of leaving the default unexamined.
3. Give compaction_model a cheaper model than your primary
By default, compaction runs on whatever model the thread is already using — which means a long session on a premium model pays premium rates to summarize its own history, a task nowhere near as demanding as the coding work that filled the thread in the first place.
{
"agent": {
"compaction_model": {
"provider": "anthropic",
"model": "claude-haiku-4-5"
}
}
}
The only real constraint is that the compaction model’s context window has to be at least as large as your primary model’s — it needs to read the whole thread to summarize it. Past that, a cheap model does this job fine.
4. Default to the Ask profile; switch to Write only when you’re ready to act
Zed’s Profiles group which tools an agent can call. Ask is read-only — good for exploring a codebase or asking questions without the agent editing anything. Write adds file edits and terminal access. Starting a session in Ask keeps a smaller tool schema in every request and removes the risk of the agent taking a wrong write action that costs a full retry to undo and redo. Switch to Write once you actually know what you want changed, not by default from the first message.
5. Only one instructions file loads — so stop leaving stale ones around
Zed checks a fixed list at the project root and stops at the first match: .rules, .cursorrules, .windsurfrules, .clinerules, .github/copilot-instructions.md, AGENT.md, AGENTS.md, CLAUDE.md, GEMINI.md. That’s different from Codex CLI, which loads a personal, repo-level, and subdirectory AGENTS.md into the same request — all three, stacked, every time. Zed only ever pays for one. But if a repo has picked up a CLAUDE.md from one tool and a .cursorrules from another, only the higher-priority file is actually being read — the other is dead weight nobody’s checking. Consolidate into whichever one wins, and keep it short regardless, because that single file is still a per-request cost.
6. Move rarely-needed procedures into a Skill, not always-on Instructions
Zed’s Instructions (the file from tip 5, plus your personal AGENTS.md) load into every single request. Skills — a folder with a SKILL.md, stored in ~/.agents/skills/ or <worktree>/.agents/skills/ — only load when the agent judges the current task actually matches one. It’s the same on-demand principle behind Claude Skills: a short, always-visible description costs almost nothing, and the expensive detail — a deployment runbook, a release checklist, a niche API reference — only enters context on the turns that need it. If something in your always-on instructions file only applies to one kind of task, it’s a skill waiting to happen, not a permanent tax on every other task.
7. BYOK or a local model skips the markup; a spending cap is your backstop
Every Zed plan, including Free, supports bringing your own API key or connecting a local model through Ollama — those requests bypass Zed’s hosted billing (and its 10% markup) entirely, going straight to the provider or running on your own hardware. For hosted usage, Pro’s default overage limit is $10/month past the included $5 credit, and it’s adjustable down to $0 if you want spend to hard-stop at exactly the included amount. Neither lever requires guessing — BYOK pays off once usage regularly clears your plan’s included credit, and the spending cap is there for the sessions where it doesn’t.
8. Skip the screenshot when you mean a specific element
Plenty of what an agent does inside an editor is still frontend work — matching a design change, fixing a layout bug someone described over Slack, reproducing something from a screenshot. Handing over a screenshot means the agent has to infer the underlying element and selector before it can act on it, and a wrong guess is a full extra round trip, paid for twice.
That’s the gap UICuts closes: point at any element on a live page and it hands back the real selector, computed styles, and DOM structure as structured text — something to paste into Zed’s Agent Panel instead of a picture it has to guess from.
Key lessons learned
- Zed bills in raw tokens with a flat markup, not a fuzzy credits number — the model catalog shows the real rate, so pick a default model deliberately instead of accepting whatever’s pinned.
auto_compactandcompaction_modelare separate levers: one decides when a thread gets summarized, the other decides how expensively.- Only one instructions file loads per project, but that one file is still a per-request cost — consolidate stale files from other tools instead of assuming the unused ones are free.
Related reading
The model-choice and compaction levers here echo what already works in Gemini CLI’s Auto routing and Codex CLI’s config.toml settings, and the Instructions-vs-Skills split is the same on-demand-loading idea covered in depth in Using Claude Skills to Reduce Token Usage. If you’re comparing Zed’s editor-integrated approach against a terminal-first agent, Warp’s credits-and-caching setup and Claude Code’s session habits are the closest analogues. For primary sources, Zed’s own agent settings reference and the pricing-change announcement are worth reading directly, since model lineups and rates shift as Zed updates its catalog.
Install UICuts free if UI feedback is part of your Zed workflow — thirty seconds to install, no account required.
Frequently asked
How much does Zed's AI actually cost? +
Pro is $10/month and includes $5 of token credit, with anything beyond that billed at provider list price plus a 10% markup. Student is free for verified students and includes $10/month in credit (Claude Opus excluded). Business consolidates usage into org-wide invoicing. Free gets Zed's editor and BYOK support but no bundled hosted-model credit.
What's the difference between auto_compact and running /compact myself? +
auto_compact fires automatically once a thread crosses a configured threshold (90% of the context window by default), summarizing earlier turns so the next one has room. /compact does the same thing on demand, before you hit that threshold — useful when you already know a thread is done exploring and about to shift into a different task.
Does compaction_model need to match my primary model's capability? +
No, but its context window needs to be at least as large as your primary model's, since it has to ingest the whole thread to summarize it. Summarizing a long conversation is a much easier task than writing the code in it, so a cheaper model with a big enough context window handles it fine.
Does bringing my own API key actually save money over Zed's hosted credit? +
Yes, once your usage regularly exceeds what's bundled. BYOK requests go straight to the provider at their raw rate — no 10% markup — but you also lose whatever credit came with your plan, so it only pays off past that break-even point, not before.
Does Zed's AGENTS.md stack the way Codex CLI's does? +
No, and that's a meaningful difference. Codex CLI loads a personal, repo-level, and subdirectory AGENTS.md into the same request. Zed checks a fixed priority list — .rules, .cursorrules, .windsurfrules, .clinerules, .github/copilot-instructions.md, AGENT.md, AGENTS.md, CLAUDE.md, GEMINI.md — and stops at the first file it finds. Only one loads, ever, but that one file is still a per-request cost, so it still needs to stay short.