Skip to content

Cost Optimization

Whittl's costs are entirely in AI API calls (the app itself is a one-time purchase, no subscription, no usage fees). This page is the strategy guide for keeping those AI costs minimal across a project's life.

The two levers

  1. Pick the right backend for each task — cheap backends are often good enough
  2. Let Whittl's Layer do work that would otherwise cost a round-trip — autofix, smart routing, prompt caching, and skills compound

Most users waste money on lever 1 (always using the premium backend) and underuse lever 2 (not leveraging the Layer's free work).

The "cheap first, escalate only when stuck" pattern

A project's life usually looks like:

  1. Initial scaffolding (first 3-5 generations) — lots of tokens, straightforward work. Use a cheap backend. Gemini's free tier or a free OpenRouter model cost you $0.
  2. Feature iteration (next 20-50 generations) — small changes, specific edits. Auto-fix and smart routing keep tokens tiny. DeepSeek at ~$0.005-0.02 per edit. A full development session is under $0.50.
  3. The hard bug (once a day) — something subtle the cheap model can't figure out. Switch to Claude Sonnet for ONE generation, get it fixed, switch back. ~$0.05-0.15 for the one escalation.

Total for a day of heavy development: usually under $1. Often under $0.25 if you're disciplined about when to escalate.

The "free tier forever" setup

If you want zero marginal cost:

  • Primary: Gemini Flash (free tier) — see Gemini for the current quota
  • Backup: OpenRouter's free models — ids ending in :free; the set changes often, so check OpenRouter's model list
  • Fallback: Ollama — local, no limits, slower

You can build real apps on this stack indefinitely. Quality ceiling is below Claude Sonnet but well above "useless" for most tasks.

Using Whittl's Layer to reduce spend

The Layer catches mistakes before they cost AI round-trips:

Layer component Saves
Autofix rules 1-2 rounds per generation (no AI needed for known fixes)
Smart Routing 60-90% of input tokens on multi-file projects
Skills prevents re-making the same mistake (no debugging round)
Prompt caching (every cloud backend) repeated context is billed at a fraction of the normal rate: a tenth on Claude and Gemini, about 2% on DeepSeek
Loop guards end a run that repeats the same call or stops learning anything new, instead of spending the whole round budget
Index-only context (large projects) the AI reads only what it needs instead of the whole project every round; one field fix round went from 364K to 15K input tokens
Provider pinning (OpenRouter) keeps the prompt cache warm across rounds instead of a cold miss on every provider switch
Function-level edits a tenth of a regeneration for a change inside a long file

Every generation you run is cheaper than the same generation would have been on a bare API.

Session-level tips

  1. Leave Think off by default. Think mode reasoning tokens are 3-5x the normal output cost. Toggle on per-request for hard problems.
  2. Don't re-send the whole project. Smart Routing does this automatically — but if you manually attach files via the Assets panel that aren't needed, those bloat the prompt.
  3. Batch related edits in one prompt. "Make all buttons green" is cheaper than four individual "make this button green" requests.
  4. Prefer iteration over regeneration. "Modify the existing code" is cheaper than "start over from scratch."
  5. Tell it to research when it should. One web_search costs nothing in tokens compared with a guess that crashes and needs three auto-fix rounds. "Research the API first" is the cheapest sentence in the prompt.

Per-task backend cheat-sheet

Task Recommended backend Typical cost
New project scaffolding Gemini Flash (free) $0
Adding a feature DeepSeek Flash $0.005 - $0.02
Tricky debugging Claude Sonnet $0.05 - $0.15
Screenshot to App Gemini Flash, or DeepSeek's vision tier $0 - $0.05
Agent Mode autonomous task Claude Sonnet $0.30 - $2.00
Large refactor Claude Sonnet one-shot, or DeepSeek with iteration $0.20 - $1.00
Code review / explain Haiku or Gemini Flash-Lite $0.001 - $0.01

Monitoring spend

Whittl shows what a request costs while it runs, and keeps a record of every call.

The cost readout, at the bottom right of the window, shows the request in progress: calls made, tokens, how many of them were cached, and the cost so far, for example 6 calls | 48,210 tokens (41,000 cached) | ~$0.0123 so far. When the request finishes it shows the total.

The context gauge (new in v2.6.0), beside it, shows how much of the model's context window the current request is using: ctx 158K / 1.0M, with a bar that turns amber at 70% and red at 90%. It shows the largest request of the turn, from the API's own token count. Hover it for the model, the window, and the cached part. Whittl already trims old tool results and switches a large project to an index when it must; the gauge lets you see it happen, and shows when a local model's window is the limit.

The Usage tab (new in v2.6.0) charts what you have spent per day over the last 7, 30 or 90 days, split by model, with the totals and this session's cost. It is a bundled plugin: turn it on in Edit > Plugins > Manage Plugins... (plugins must be enabled there first). It says how many calls were priced from Whittl's rate table rather than a provider's billed amount, and how many had no known rate.

The log behind both is ~/.whittl/logs/token_usage.csv, one row per call: time, backend, model, the kind of request, tokens in, out and cached, the cost, and whether that cost was billed by the provider or estimated by Whittl.

Each provider's own dashboard (Anthropic console, Google AI Studio, DeepSeek platform, OpenRouter activity page) is the final word on what you were billed.

What's next