A smarter model budget for Claude Code

Your coding agent doesn't need Opus for every turn.

SmartAsk routes each Claude Code step to Sonnet or Opus, escalates when the work gets harder, and shows exactly what every turn costs.

Local proxyNative Anthropic APIAuditable JSONL metrics

slugify-fix
SESSION COST
−39.6%

Interactive product simulation · not benchmark output

One coding session.

Two models.

No wasted intelligence.

01 / UNEVEN WORK

Coding sessions are not uniformly hard.

A session is a sequence of different jobs. Every one should earn the model it uses.

01Understand architectureOPUS · DEEP CONTEXT
02Locate a known fileSONNET · LOCAL
03Make a config editSONNET · MECHANICAL
04Investigate a raceOPUS · SUBTLE DEBUG
05Report passing testsSONNET · VERIFIED

02 / THE ROUTER

Judge. Work. Adapt.

Routing is not a one-time choice. SmartAsk judges every substantive message, then checks the evidence that comes back from Sonnet's tools.

INCOMING REQUEST“Fix the intermittent cache race”Claude Code · complete turn context
classify
SONNET CLASSIFIERroute + confidence
0.82 · substantive prompt
clear / localSONNETmechanical work
deep / uncertainOPUScomplexity or < 0.75
TOOL EVIDENCE RETURNSFailure exposes non-local locking
still clear → continuecomplexity → compact handoff ↗

03 / MEASURED EVIDENCE

Proof, not promises.

Controlled results, exact outcomes, and the sample size in plain sight.

● VERIFIEDN=1 LIVE TASK
39.6%

lower cost on a live repository lookup

SMARTASK$0.1814475
OPUS-ONLY$0.3002575

Both returned the same correct schema_version answer. SmartAsk routed 2/2 visible steps to Sonnet.

One controlled live task · not a general average.
● VERIFIEDN=2 PAIRS / STRATEGY
21.59%

lower aggregate cost on a real SWE-bench repository task

SMARTASK$1.020621
OPUS-ONLY$1.301636

Same exact patch across all four runs. Both strategies reached 115 passed, 1 skipped.

One SWE-bench task · two isolated pairs per strategy.
Read the methodologyFULL DISCLOSURE +

Real upstream repository

pytest-dev/pytest at commit 6995257cf470d2143ad1683824962de4071c0eb7, task pytest-dev__pytest-11143.

Counterbalanced result

Two isolated pairs per strategy. One reversed pair favored Opus-only due to provider-cache variance; the aggregate result favored SmartAsk.

Identical outcome

Patch SHA-256: 6574b635…ec89a8f. The official hidden regression patch produced 115 passed, 1 skipped.

Inspect the benchmark source ↗

04 / COMPACT HANDOFF

Change models without making the new model reread the whole room.

Caches do not transfer between models. SmartAsk does something explicit instead: the warm model creates a bounded factual handoff.

84.97%less Opus input
in a controlled trace
DRAG TO COMPRESS3,523 tokens
FULL CODING SESSION23,443 input tokens
FACTUAL HANDOFF3,523 input tokens

task + verified state + latest tool result

Observed Opus call cost$0.1480925$0.01969−86.70%

Controlled live trace comparison. Context and savings vary by switch.

claude

Fix the failing slugify tests.

⏺ Read(tests/test_slugify.py)

⏺ Update(src/slugify.py)

Fixed the delimiter branch. 3 tests passed.

05 / NATIVE WORKFLOW

Claude Code stays Claude Code.

No new chat UI. No copy-pasting between models. Start Claude Code through one launcher and work normally.

  • Same interactive workflow, tools, and normal flags
  • Private loopback proxy to the native Anthropic API
  • Colored model and cost footer after every response
  • Prompt-free JSONL metrics written locally
./scripts/claude-smart-ask
The display footer is removed before the next model sees history.

06 / OBSERVABILITY

The router is not a black box.

Every decision and provider request becomes structured evidence. See why a turn escalated, what model answered, and what the switch cost.

RUN LEDGER.smart-ask/claude-code/
metrics.jsonl
REQUEST IDreq_8f42…a91c
STATUS● completed
LATENCY4,218 ms
CLASSIFIERsonnetconfidence 0.79
TOOL EVIDENCEcomplexitylock spans modules
ANSWERING MODELopuscompact handoff
CALLMODELINPUTOUTPUTCACHE READCOST
classifierSonnet 4.61,20442$0.0041
summarizerSonnet 4.68,9124387,104$0.0137
generatorOpus 4.13,523912$0.0334
TURN TOTAL$0.0512SESSION$0.2847

07 / YOUR NUMBERS

Run the economics on your workload.

No magical total. Start from an observed Opus-only session and inspect every assumption.

Assumption: equivalent Sonnet work costs 20% of Opus work. Replace this with your observed ratio as pricing changes.

ESTIMATED ROUTED COST$15.20

$9.80 estimated saving 39.2%

$10.50 Opus work
+ $2.90 Sonnet work
+ $1.50 classifier
+ $0.30 handoffs
Estimate, not a guarantee. Task mix, provider caching, and stochastic behavior vary.

08 / QUALITY BOUNDARIES

Conservative by design.

The cheap route is never the default when the evidence is unclear.

01

Uncertainty goes up.

Below 0.75 confidence routes to Opus.

02

Evidence can escalate.

Tool failures trigger a new judgment.

03

Opus keeps hard loops.

No oscillation during deep reasoning.

04

Unsafe summaries fail closed.

Incomplete handoffs use full context.

09 / OPEN ARCHITECTURE

Local, inspectable, and bounded.

Strategy files choose trusted target IDs. They cannot inject endpoints, credential names, or commands.

Inspect the routing policy ↗
01Claude Codenormal UI + tools
02Localhost adaptergenerated bearer token
03Confidence routerschema-v3 YAML + route memory
↙ ↘
Native SonnetNative Opus
04Metrics ledgerbounded requests + per-turn cost

10 / FAQ

The sharp questions.

And the non-marketing answers.

Is routing decided only once per session?+

No. Every substantive user message is classified. Sonnet tool results are also reclassified so newly exposed complexity can escalate the current task.

What model decides?+

Claude Sonnet 4.6 is the default classifier. It returns sonnet, opus, or uncertain plus confidence.

What happens on classifier failure?+

The default strategy fails conservatively to Opus.

Can “fix” automatically mean easy?+

No. Substantive prompts are judged semantically. Keywords such as “fix” do not determine the route.

Do Sonnet and Opus share prompt cache?+

No. Provider caches are model-specific. SmartAsk reduces switch cost with a compact factual handoff.

Will it always save money?+

No router can guarantee that for every stochastic session. Savings depend on task mix and cache state. SmartAsk exposes the real cost so you can evaluate your own workload.

Does SmartAsk replace Claude Code?+

No. It runs as a local proxy underneath the existing Claude Code harness.

Does traffic go through a SmartAsk cloud?+

No. The default setup uses the native Anthropic API from the local adapter.

READY WHEN YOU ARE

Let every turn earn its model.

Clone. Add your Anthropic key locally. Keep working in Claude Code.

git clone git@github.com:arshiaafzal/smart-ask.git
cd smart-ask
cp scripts/claude-smart-ask.local.env.example scripts/claude-smart-ask.local.env
# Add ANTHROPIC_API_KEY, then:
./scripts/claude-smart-ask