Back to guides
Integration·August 8, 2026·Updated September 3, 2026·9 min read

Roo Code with the Claude API — provider setup and a model per mode

Roo Code ships modes but no model. Here is the three-field provider setup, the base-URL trap on its native Anthropic route, and how configuration profiles let Architect think on Opus while Code executes on Sonnet.

Last reviewed on .

Roo Code is an open-source autonomous coding agent for VS Code — a fork in the Cline family, distinguished by its mode system and per-mode model routing. It ships no model of its own, so it needs an API key. This guide is the exact setup for running Claude in Roo Code on one sk-kn- key at about 60% under Anthropic's list price on the mainline models, how to use configuration profiles to spend strong-model money only where it pays, what a session costs, and an honest account of the tradeoff versus calling Anthropic directly.

Why Roo Code needs an API key

Every step Roo Code takes — reading a file, writing a diff, running a command, reading the result — is a model call billed per token. A claude.ai Pro or Max subscription does not cover it: chat plans and API access are separate products, and Roo Code talks to the API. Since an agentic loop resends the growing task context on every step, the per-token rate is the biggest lever on session cost — which is the case for a gateway: pay-as-you-go from a $10 top-up, one key that also reaches Gemini and GPT, and a balance that never expires.

Setup — the three fields

Open Settings → Providers and set the API provider to OpenAI Compatible. Three values:

Roo Code → Settings → Providers
API Provider   OpenAI Compatible
Base URL       https://api.kunavo.com/v1
API Key        sk-kn-...              # create at kunavo.com/app/keys
Model ID       claude-sonnet-4-6      # or claude-sonnet-5 / claude-opus-5

Create the key at the dashboard after signing up and topping up — it is shown once, so store it immediately; the Claude API key doc covers rotation and spend limits. If Roo Code asks for model metadata such as context window or output cap, take the values from the model page — an understated context window makes it truncate earlier than necessary.

Test with something small before letting it edit code. A 401 here is almost always the key; a 404 is almost always the base URL or a nonexistent model slug — Kunavo matches slugs exactly and does not alias date-suffixed names, so claude-sonnet-4-5-20250929 returns 404 while claude-sonnet-4-6 resolves.

Modes and configuration profiles — the cost lever

Roo Code ships several built-in modes — Code, Architect, Ask and Debug — plus custom modes you define yourself. The part that matters for cost is that Roo Code stores named API configuration profiles and remembers which profile you last used in each mode. So the model becomes a property of the mode, not something you remember to change:

profile-per-mode
# One API configuration profile per mode, all on the same sk-kn- key.
# Roo Code remembers the profile you last used in each mode.

Profile "plan-strong"    model claude-opus-5        -> bind to Architect mode
Profile "code-default"   model claude-sonnet-4-6    -> bind to Code mode
Profile "debug-strong"   model claude-sonnet-5      -> bind to Debug mode
Profile "ask-cheap"      model claude-haiku-4-5     -> bind to Ask mode

The reason this works is that the modes have very different token profiles. Architect is a handful of reasoning-heavy turns where model quality decides whether the next twenty steps are productive — a small share of total tokens, so a strong model costs little in absolute terms. Code is many mechanical steps, each resending context, which is where the per-token rate compounds. Ask is usually one-shot and does not need a frontier model at all.

The worked numbers are below: three Architect steps on Opus 5 plus seventeen Code steps on Sonnet 4.6 comes to about $0.86 against $0.74 for the all-Sonnet run — roughly 16% more for materially better planning, and far cheaper than running everything on Opus.

The native Anthropic route (and why you might want it)

Roo Code also offers a native Anthropic provider with a custom base-URL field. Pointing it at https://api.kunavo.comthe origin only, with no /v1, because that client appends /v1/messages itself — routes through the native Messages API. Pasting the /v1 form here produces a 404 that reads like a missing model.

What that route buys is prompt caching: cache_control passes through untranslated and cached input bills at 10% of the input rate (how it works). On a loop that resends a stable prefix every step that is the single largest saving available — bigger than any model swap. Either route works; OpenAI Compatible is simpler to start with, and moving between them is a settings change.

Which Claude model to bind to which mode

ModeModelKunavo input / output (per 1M)
Code (default, highest volume)claude-sonnet-4-6$1.20 / $6.00
Architect — planning and designclaude-opus-5$2.00 / $10.00
Debug — near-Opus reasoning at Sonnet costclaude-sonnet-5$2.00 / $10.00
Ask — one-shot questionsclaude-haiku-4-5$0.40 / $2.00
Cheapest capable optiongemini-2-5-flash$0.09 / $0.75

Every one of these is the same key and the same endpoint — only the model slug differs, so a profile is a one-word change. Full per-model rates against Anthropic's official list are in the Anthropic Claude API price list, and the live catalog is on the pricing page.

Roo Code on Kunavo vs calling Anthropic directly

The honest comparison, including where going direct is the better call:

 Roo Code → KunavoRoo Code → Anthropic direct
Sonnet 4.6 per 1M (in / out)$1.20 / $6.00$3.00 / $15.00
Getting startedSign up, top up $10, create a keyAnthropic Console account with billing configured
Models on the one keyClaude, Gemini, GPT, plus image, video and audioClaude only
Per-mode model routingYes — profiles are a Roo Code feature, unaffected by providerYes
Prompt cachingYes, via the native Anthropic provider route (cache_control passes through)Yes, natively
Failed requestsNot billedNot billed
Capacity and SLAShared upstream capacity, no contractual SLA or guaranteed quotaYour own organization's rate-limit tier and Anthropic's support terms
Same-day access to brand-new modelsWhen the upstream channel carries themOn release

That capacity row is the real tradeoff, stated plainly. If you need a guaranteed quota, a contractual SLA or a procurement relationship with the model vendor, go direct — that is what the price difference buys. For an individual developer or a small team running Roo Code, the trade usually runs the other way.

What a Roo Code session actually costs

Agentic tools are token-hungry by design: each step resends the system prompt, the task history and fresh file context. Realistic numbers at Kunavo rates:

UnitTokens (input / output)claude-sonnet-4-6At Anthropic list
One Code-mode step25,000 / 1,200$0.037$0.093
A 20-step task~500k / ~24k~$0.74~$1.86
Same task, Architect on Opus 5~500k / ~24k~$0.86~$2.15
A heavy day (5 such tasks)~$3.72~$9.30

The math, runnable:

roo_session_cost.py
# Kunavo Claude rates (USD per 1M tokens): (input, output)
RATES = {
    "claude-haiku-4-5":  (0.40, 2.00),
    "claude-sonnet-4-6": (1.20, 6.00),
    "claude-opus-5":     (2.00, 10.00),
}

def step_cost(model, in_tokens, out_tokens):
    i, o = RATES[model]
    return in_tokens / 1_000_000 * i + out_tokens / 1_000_000 * o

# One Code-mode step: Roo resends the task context plus the files it read.
print(step_cost("claude-sonnet-4-6", 25_000, 1_200))       # -> $0.0372
# A realistic 20-step task on the Code-mode default:
print(20 * step_cost("claude-sonnet-4-6", 25_000, 1_200))  # -> ~$0.74
# Architect mode on Opus 5 for 3 steps, Code mode on Sonnet 4.6 for 17:
print(3 * step_cost("claude-opus-5", 25_000, 1_200)
      + 17 * step_cost("claude-sonnet-4-6", 25_000, 1_200)) # -> ~$0.86

Keeping the bill down

  1. Start new tasks instead of extending one forever. Roo Code resends the whole conversation each step, so one long-running task grows quadratically in cost. A fresh task is a fresh, small context — the highest-leverage habit here.
  2. Bind a profile per mode. Covered above: it turns model routing into configuration rather than something you have to remember mid-task.
  3. Use the native Anthropic route for caching. Cached input at 10% of the input rate is the biggest structural saving on a loop that resends a stable prefix.
  4. Give the editor its own spend-limited key. Create a separate key in the dashboard and check usage after a real week — that is the only honest estimate of what this costs you.

FAQ

What base URL do I use for Roo Code with the Claude API?

In Roo Code, go to Settings → Providers, set API Provider to 'OpenAI Compatible', Base URL to https://api.kunavo.com/v1, paste a Kunavo key (sk-kn-...) and set the model ID to a Claude slug such as claude-sonnet-4-6. If you use Roo Code's native 'Anthropic' provider instead, set the base URL to the origin only — https://api.kunavo.com — because that client appends /v1/messages itself.

Can I use a Claude Pro or Max subscription with Roo Code?

No. A claude.ai chat subscription does not include API access, and Roo Code calls the API directly — every file read, diff and command is a billed model call. You need a pay-as-you-go API key. On Kunavo that is a $10 minimum top-up, Claude served roughly 30–60% under Anthropic's list price depending on the model, and a balance that never expires.

Can Roo Code use a different Claude model per mode?

Yes, and it is the main cost lever on this tool. Roo Code stores named API configuration profiles and remembers which profile you last used in each mode, so you can bind a strong model to Architect and Debug and a cheaper one to Code and Ask. A practical split: claude-opus-5 ($2.00/$10.00 per 1M) for Architect, claude-sonnet-4-6 ($1.20/$6.00) for Code, claude-sonnet-5 for Debug, claude-haiku-4-5 ($0.40/$2.00) for Ask. All four profiles use the same key — only the model slug changes.

How much does running Claude in Roo Code cost?

Roo Code resends the task context on every step, so cost tracks step count rather than time spent. A typical step is around 25,000 input and 1,200 output tokens — about $0.037 on claude-sonnet-4-6 at Kunavo rates, so a 20-step task lands near $0.74 against roughly $1.86 at Anthropic's list price. Failed requests are never billed. Prompt caching, available on the native Anthropic provider route, bills cached input at 10% of the input rate and is the largest structural saving.

What base URL do I use for Roo Code?

https://api.kunavo.com/v1 with the OpenAI Compatible provider. With the native Anthropic provider, use the origin only — https://api.kunavo.com — since that client appends /v1/messages itself. Adding /v1 there is the most common cause of a 404 on this setup. For the hardest tasks point it at claude-opus-5.

Does the same setup work for Cline and Kilo Code?

Yes — all three are the same provider model, since Roo Code and Kilo Code are forks in the Cline family. The tool-specific details differ: Cline with the Claude API covers its Plan/Act split, and Kilo Code with the Claude API covers its own setup. For the terminal agent rather than the editor extension, the Claude Code setup guide has the environment-variable contract, and Claude Code pricing works through the subscription-versus-API break-even.