# Use Xantly with Kilo Code

[Kilo Code](https://kilo.ai) is the **#1 IDE Extension on OpenRouter by token volume**: another Cline fork with its own Kilo Gateway feature. Pointing it at Xantly replaces Kilo Gateway with a smarter routing layer: BaRP bandit routing, semantic cache, memory.

## Prerequisites

- VS Code, JetBrains, or the Kilo Code CLI installed
- A Xantly API key, [create one](/dashboard/api-keys)

## Setup (VS Code / JetBrains)

1. Open Kilo's settings panel.
2. Under **API Provider**, select **OpenAI Compatible**.
3. Configure:

| Field | Value |
|---|---|
| Base URL | `https://api.xantly.com/v1/chat/completions` (full path, Kilo supports it) or `https://api.xantly.com/v1` (standard) |
| API Key | `xantly_sk_...` |
| Model ID | `xantly/auto-quality` |

4. Save.

## Setup (CLI)

```bash
kilo --base-url https://api.xantly.com/v1 \
     --api-key xantly_sk_... \
     --model xantly/auto-quality
```

Or via environment:

```bash
export KILO_OPENAI_BASE_URL=https://api.xantly.com/v1
export KILO_OPENAI_API_KEY=xantly_sk_...
export KILO_MODEL=xantly/auto-quality
kilo
```

## Heavy-usage budget pattern

Kilo users tend to burn through tokens fast, the #1 rank on OpenRouter isn't accidental. Set a USD budget on your Xantly key before running anything serious:

```
Dashboard → API Keys → [your key] → Daily Budget USD → 10
```

Once daily spend hits the cap, Xantly returns 402; Kilo surfaces it as a friendly error instead of silently draining your balance.

## Model choice

| Model ID | When |
|---|---|
| `xantly/auto-value` | Daily driver, Kilo's usage pattern benefits from T2 balance |
| `xantly/auto-quality` | Complex refactors, multi-file agent runs |
| `anthropic/claude-sonnet-4.6` | Strong tool-calling; Kilo's autonomous mode shines here |
| `groq/llama-3.3-70b` | Fast edits, simple prompts; great p50 latency |

## Verify

Run a quick agent task:

```
Open my TypeScript project and find all files importing from the deprecated `@legacy/...` path. Propose fixes.
```

Kilo should scan, reason, propose edits. Your Xantly dashboard will log each call with cost + model + cache status.

## What you get over Kilo Gateway

- **Bandit routing per tenant.** Kilo Gateway routes by static rules; Xantly's BaRP learns your workload patterns and adapts.
- **L2 semantic cache.** Kilo's "re-ask similar question" pattern is exceptionally cache-friendly.
- **Memory cascade.** Kilo's multi-session workflows stay context-aware.
- **Waterfall fallback.** Provider outages don't derail in-flight agent runs.
- **BYOK support.** Bring your own OpenAI/Anthropic credits and route them through Xantly's intelligence layer.

## Gotchas

**Full URL vs base URL.** Kilo accepts both `https://api.xantly.com/v1` and `https://api.xantly.com/v1/chat/completions`. Both work. Pick one and stick to it.

**Model ID format.** Same as Cline/Roo, `provider/model` prefix or `xantly/auto-*` alias. Bare slugs get rejected.

**High-volume concurrent runs.** If you run 5+ Kilo agent sessions in parallel, consider upgrading your Xantly plan for higher concurrent request limits.

## Next steps

- [Cline](/docs/use-with-cline), the upstream Kilo was forked from.
- [Roo Code](/docs/use-with-roo-code), another Cline fork with per-mode models.
- [Cost-Optimized Routing](/docs/cost-optimized-routing), how to keep heavy Kilo usage on budget.
