Back to guides
Integration·July 10, 2026·Updated September 3, 2026·8 min read

Kilo Code with the Claude API — OpenAI-compatible base URL setup and per-mode routing

Kilo Code accepts a custom OpenAI-compatible endpoint — three settings fields put Claude in your editor at about 60% under Anthropic's list price. Here's the setup, which model to pick per mode, and what an agentic coding session actually costs.

Last reviewed on .

Kilo Code is one of the most-used open-source AI coding agents for VS Code, and like its Cline-family siblings it lets you bring your own OpenAI-compatible API endpoint. That means you can run Claude inside your editor with a single sk-kn- key, at about 60% under Anthropic's list price on the mainline models. This guide is the three-field setup, which Claude model to pick per task, and what an agentic coding session actually costs.

Why Kilo Code needs an API key

Kilo Code doesn't bundle a model — every action (read a file, propose an edit, run a command, check the result) is an API call, billed per token. A chat subscription like Claude Pro does not cover this; the extension needs direct API access. That's exactly the shape Kunavo serves: pay-as-you-go from a $10 top-up, one key for Claude, Gemini and GPT, and the balance never expires. Because agentic loops resend the growing task context on every step, the per-token rate is the single biggest lever on what a session costs — which is why the ~60% discount on claude-sonnet-4-6 compounds fast.

The three fields

Kilo Code exposes the provider as three settings fields:

provider-settings
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-haiku-4-5

Get the key from the dashboard after signing up and topping up $10 — it's shown once, so store it right away. Full key management is covered in the Claude API key doc.

Kilo Code setup

  1. Install Kilo Code from the VS Code marketplace and open it from the sidebar.
  2. Open the extension settings (gear icon) and go to the Providers section.
  3. Set API Provider to OpenAI Compatible.
  4. Base URL: https://api.kunavo.com/v1 · API key: your sk-kn-… key · Model: claude-sonnet-4-6.
  5. Save, then ask it something small (“explain this file”) to confirm the wiring before letting it edit code.

Kilo Code supports per-mode model overrides (Architect / Code / Debug) — a good place to route planning to a stronger model (claude-opus-5) and execution to a cheaper one (claude-sonnet-4-6).

Cline and Roo Code

Kilo Code and Roo Code are both forks in the Cline family, so the three fields above are identical in all three tools — provider OpenAI Compatible, base URL https://api.kunavo.com/v1, key, model ID. What differs is the feature each one gives you to route models, and that is where the cost savings live, so each has its own guide: Cline with the Claude API covers its Plan/Act split, and Roo Code with the Claude API covers its named configuration profiles and per-mode model binding.

All three tools additionally ship a native Anthropic provider with a custom base-URL option. Pointing that at https://api.kunavo.com uses the native Messages API (/v1/messages) instead — useful because cache_control passes through untranslated and cached input bills at 10% of the input rate (see the prompt-caching doc). Either route works; the OpenAI-compatible one is the simplest to start with.

Which Claude model to pick

TaskModelKunavo input / output (per 1M)
Everyday agentic coding (default)claude-sonnet-4-6$1.20 / $6.00
Near-Opus coding qualityclaude-sonnet-5$2.00 / $10.00
Hardest refactors and debuggingclaude-opus-5$2.00 / $10.00
Quick edits, commit messages, Q&Aclaude-haiku-4-5$0.40 / $2.00
Cheapest capable optiongemini-2-5-flash$0.09 / $0.75

claude-opus-5 is the strong-reasoning pick here: it is Anthropic's newest Opus and bills at the same $2.00 / $10.00 as the previous-generation claude-opus-4-7 ($2.00 / $10.00), which stays available if you have pinned to it. Because the model field is just a slug on the same endpoint, switching is a one-word change — no new key, no new provider config. Full rates for every model are in the Claude API pricing guide and on the pricing page.

What a 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 agentic step25,000 / 1,200$0.037$0.093
A 20-step task~500k / ~24k~$0.74~$1.86
A heavy day (5 such tasks)~$3.72~$9.30

The math, runnable:

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),
}

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 agentic step: the tool resends the task context + file reads.
print(step_cost("claude-sonnet-4-6", 25_000, 1_200))       # -> $0.0372
# A realistic 20-step task (edit, run, fix, repeat):
print(20 * step_cost("claude-sonnet-4-6", 25_000, 1_200))  # -> ~$0.74

Keeping the bill down

  1. Start new tasks instead of extending one forever. The tool resends the whole conversation each step, so a long-running task is quadratically expensive. Fresh task = fresh, small context.
  2. Route by mode. Kilo Code supports a model per mode — Architect on claude-opus-5 or claude-sonnet-5, Code on claude-sonnet-4-6, quick questions on claude-haiku-4-5. Planning is a small share of the tokens, so the stronger model there costs little.
  3. Use the native Anthropic route for caching. Cached input bills at 10% of the input rate — on a loop that resends a stable prefix every step, that's the biggest saving available (how it works).
  4. Watch per-key spend. Give the editor its own key with a spend limit in the dashboard, and check usage to see what a week of agentic coding really costs you.

FAQ

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

Set the API provider to 'OpenAI Compatible' and the base URL to https://api.kunavo.com/v1, with a Kunavo API key (sk-kn-...) and a Claude model slug such as claude-sonnet-4-6. If you use the native Anthropic provider instead, set the base URL to the origin only (https://api.kunavo.com) — that client appends /v1/messages itself.

Can I use my Claude Pro or Max subscription with Kilo Code?

No — chat subscriptions don't include API access. Kilo Code calls the API directly and bills per token. A pay-as-you-go key is the right shape for this: on Kunavo you top up from $10, Claude is served about 60% under Anthropic's list price on the mainline models, and the balance never expires.

Which Claude model is best for Kilo Code?

claude-sonnet-4-6 ($1.20/$6.00 per 1M tokens on Kunavo) is the value default for everyday agentic coding. Step up to claude-sonnet-5 for near-Opus coding quality, or claude-opus-5 ($2.00/$10.00) for the hardest refactors and debugging — it is the newer Opus at the same rate as claude-opus-4-7, so stepping up costs nothing extra. Route quick, simple asks to claude-haiku-4-5 to cut costs further.

How much does using Claude with Kilo Code cost?

Agentic tools resend context on every step, so tokens add up: a typical step is ~25k input / 1.2k output, about $0.037 on claude-sonnet-4-6 at Kunavo rates — roughly $0.74 for a 20-step task, versus ~$1.86 at Anthropic's list price. Failed requests are not billed.

Does the same setup work for Cline and Roo Code?

Yes. Kilo Code and Roo Code are forks in the Cline family and share the same provider model: pick 'OpenAI Compatible', set base URL https://api.kunavo.com/v1, paste the key, set the model ID. What differs is how each tool routes models — Cline splits Plan and Act mode, Roo Code binds named configuration profiles to modes — which is where the cost savings are, so each has its own guide. All three also have a native Anthropic provider with a custom base-URL option; point that at the origin https://api.kunavo.com for cache_control passthrough.

What base URL do I use?

https://api.kunavo.com/v1 with the OpenAI Compatible provider. For the native Anthropic provider, use the origin only — https://api.kunavo.com — because that client appends /v1/messages itself.

Can I use a Claude Pro / Max subscription?

No — chat subscriptions don't include API access, and Kilo Code calls the API directly. Pay-as-you-go from a $10 top-up is the right shape: no monthly fee when you don't code, and the balance never expires.

Which model should I set?

claude-sonnet-4-6 as the default; step up to claude-sonnet-5 or claude-opus-5 when a task defeats it, and down to claude-haiku-4-5 or gemini-2-5-flash for simple asks. Comparative positioning is in Claude vs GPT vs Gemini.

Is this different from using the OpenAI SDK?

Same mechanism: any OpenAI-compatible client works by changing base_url — the editor extensions just expose that as a settings field. The general pattern is covered in the OpenAI-compatible API guide.

What about Claude Code, the terminal agent?

Claude Code is configured differently — it reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from the environment rather than a settings field, and it uses the native Messages API instead of the OpenAI-compatible one. See the Claude Code setup guide for the variables, the credential trap behind most 401s, and what a gateway changes.