Concepts

Routing and costs

How Duscode picks a fast, standard or frontier model for each task, when it escalates or falls back, how to pin a model, and how cost and savings are measured.

Duscode routes each task by the kind of work: hard reasoning (debugging, finding a root cause, a flaky test, a review, a plan) starts on the strongest model, and routine work starts on the cheapest model that can do it and moves up only when the work fails. You see which model answered, why, what it cost, and what the top model would have cost.

The three tiers

Tier Suited to Default models
fast Mechanical edits, renames, formatting, docs and comments, quick lookups, version bumps. Also titles, commit messages and summaries. claude-haiku (Claude Haiku 5.5), gpt-luna (gpt-6-luna)
standard General coding work claude-sonnet (Claude Sonnet 5.5), gpt-sol (gpt-6.1-sol)
frontier Architecture, subtle or concurrency bugs, security, migrations, large refactors, performance work, repeated failures claude-opus (Claude Opus 5.5), gpt-astra (gpt-6-astra)

Only models whose provider has a key are used. If a tier has no available model, Duscode uses the nearest tier above it, then the one below. See Providers and models for prices and other providers.

How a tier is chosen

  1. Hard work starts strong. With Settings → Models & keys → Reasoning: Strongest for hard steps (the default), debugging, root causes, flaky tests, races and timeouts, reviews, plans across the code, security work, migrations and performance work start on the frontier tier, so the thinking happens on the strongest model from the first step instead of after a failure. Within the task, routine steps (a mechanical edit, a summary) use less reasoning effort. Choose Cheapest first to start every task cheap. In Economy every task starts cheap.
  2. Cheapest first for routine work. Renames, docs, formatting, plain features and lookups start on the fast tier.
  3. What worked here before. Duscode remembers how each task went on this computer, per project: the kind of work (bug fix, feature, refactor, docs, UI, migration, security, performance, tests), the model it started on, whether it finished without help, and what it cost. When a model has passed at least 5 recent tasks of this kind, at least 8 times in 10, Auto starts on whichever of those models had the lowest cost per finished task: what all its tasks of this kind cost, failed tries included, divided by the ones that passed. Recent tasks count more; a result loses half its weight every two weeks, so old results fade and models get a fresh chance.
    • With too few results, Auto keeps starting cheap.
    • It only starts a kind of work on a pricier model when the cheap models have been measured failing at it. In Economy and Fast it never does.
    • Strongest always starts on the standard tier. Best of several starts where Auto would, but tries 3 ways side by side on every task and keeps the one the checks prove best (see the model picker).
  4. A failed check moves it up. If the work fails, escalation moves it up a tier. If you say the problem is still failing ("still fails", "still broken", "tried everything"), the task starts one tier up, on standard.
  5. Never down mid-session. Once a task has moved up, later tasks stay on that tier. Duscode doesn't move down, because switching models throws away the prompt cache, and cache reads cost about a tenth of normal input.

Your highest tier. routing.maxTier in your own config (fast, standard or frontier) caps where a task starts and how far it escalates. A project's config can't raise it, and can't turn on the strongest start: both are your spend.

The route line in the chat shows the model, the tier and the reason, for example claude-opus frontier tier · a flaky test: the strongest model reasons from the start or claude-haiku fast tier · cheapest first; a failed check moves up a tier. When past results picked the model, the reason says so in one line, for example gpt-luna: 14 of 15 recent bug fixes passed at about $0.03 each.

Work where the worst mistakes still pass the checks (merges, migrations, sign-in and permissions, payments, deleting data, production) also starts cheap, and a stronger model reviews the change before it counts as done.

Escalation

Within a task, Dus moves one tier up when:

  • three tool rounds in a row fail
  • the project's checks still fail after a fix attempt
  • the model refuses the request

The chat shows a line such as ▲ Switched to claude-opus because …, with the reason.

Provider fallback

If a provider is overloaded or unreachable, Duscode moves to the same tier on another provider you have a key for, then to one tier up. That covers rate limits (429), overloaded (529), server errors and timeouts, after the provider SDK's own retries. Duscode stays on the fallback model for the rest of the task and goes back to the routed model at the next one.

Errors that you need to fix aren't hidden by a fallback. Those include missing permission, an unknown model or a bad request. Duscode shows them with a hint.

Out of credit

When a provider says your account is out of credit or quota, or that the key is not valid, Duscode:

  1. Moves the work to the same tier on another provider you have a key for (or one tier up), as for an outage. The chat says why, for example claude-sonnet unavailable (Anthropic is out of credit since 14:02, checking every 15 min); continued on gpt-sol.
  2. Skips that provider in every task, so no other task spends a failed call finding out again.
  3. Checks it again in the background every 15 minutes, and at once when you add or replace its key in Settings → Models & keys. The check is the smallest request the provider accepts: one word in, one token out (16 for OpenAI) on its cheapest model, about a millionth of a dollar, on your own key.
  4. Comes back as soon as a check gets an answer: from the next step of the task that is running, not only the next task. The route line says Anthropic has credit again (checked 14:17), so back on Sonnet 5.5.

Settings → Models & keys shows it next to the key, for example Out of credit since 14:02 · …abcd · checking every 15 min, with a Top up link to the provider's billing page. If every provider you have is out, Duscode tries anyway and tells you what the provider said.

When no provider can take over

If every provider you could use is out of credit, Dus pauses. You get one notice, however many tasks were running: Your AI credit has run out, so Dus has paused. Nothing is lost. It sits above the message box, in Calls and in the bell, with one button for the way on:

  • your own key: Add credit at Anthropic (or your provider), which opens its billing page; or Use another key;
  • Duscode credits: Top up credits, which opens Settings → Usage;
  • staff on the company key: Open Costs on the platform console.

The company key, for Duscode's own platform owners and admins

If you sign in with an account that is an owner or admin of the Duscode platform, your Duscode works on the company key everywhere: the desktop app, the terminal app, VS Code and duscode.com/code. The key stays in Duscode Cloud; each model call goes through the cloud, which uses the key there and counts the call against the staff monthly limit. Your computer never holds it, so when the key is replaced (once, in the platform console under Settings → AI for staff → Company key) every surface uses the new one.

It is used by itself when your computer has no key of its own. If you have one and would rather use the company key, turn on Settings → Models & keys → Use the company key (only owners and admins see it). When the monthly limit is reached, Dus pauses with the out-of-credit notice and its Open Costs button, and carries on by itself once the limit is raised. Nobody else can use it: it is not for sale and not part of Duscode credits.

If no Duscode window is open, the same message goes once through the notifications you turned on (desktop, Slack, Teams, webhook, email), never during your quiet hours. Nothing runs into the same wall meanwhile: the paused task and everything queued after it wait. Dus checks again every few minutes; when the credit is back the notice clears itself and says Dus is working again, and the paused task carries on first, then the queue, oldest first.

Duscode credits (your plan's usage) work differently: when they run out, Dus pauses and asks what to do (see Pricing and plans).

Pinning a model

  1. Click Model in the message box, left of the microphone (Engineer view).
  2. Choose a model.

That model then answers every request in this task; choose Auto to go back to routing. The model picker page has the details (Alt+M opens it). Auto is the default. In the terminal, use /model <id> and /model auto.

A pinned model is never escalated or swapped for a fallback. If you attach an image and the pinned model can't read images, Duscode tells you instead of quietly dropping the image.

Images and vision

When a task includes images or PDFs, Duscode makes sure the model can read them. If the routed model can't, it uses the cheapest model that can, at the same tier or above. It says so in the route reason.

Cost and savings

Every model call is metered at the provider's published prices. That covers input, cached input, output, images and web searches. You see:

  • The task's cost so far, live while it runs, next to the task's status in the top bar, against its budget: Working · $1.75 of $2. Click it to give the task more.
  • Task cost at the end of each task
  • Cost so far, Estimated savings and Model usage for the task, in Project details (click the project's name in the top bar)
  • Today's spend across all your projects in Spending, in the status bar at the bottom right (with your credits balance when it runs low or out). Click it for today, yesterday, this week and this month, and today by project; its Open Usage opens Settings → Usage: today's and this month's spend, spend by model and the savings by routing. Usage is also in Settings.

Savings compare what the task cost with what the same tokens would have cost on the top model (the baseline: the best frontier model available, or baselineModel in your config). That's an estimate of what routing saved, not a bill. Your provider bills you directly.

Note

On the Free plan, Dus uses one model you choose (by default the standard tier), with no automatic routing or escalation. During early access every feature is on. See Pricing and plans.

Something missing or wrong? Email support@duscode.com.