> ## Documentation Index
> Fetch the complete documentation index at: https://docs.routor.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Use with Cline CLI

> Connect Cline (and Roo Code) to Routor for automatic model routing on every task.

# Use with Cline CLI

Cline is an autonomous coding agent that runs in VS Code. It sends prompts to an OpenAI-compatible API, which means it works with Routor out of the box. This guide shows you how to point Cline at Routor so every task - from a quick refactor to a multi-file architecture change - routes to the right model automatically.

Roo Code (the Cline fork) uses the same configuration.

***

## Why Use Routor with Cline

Cline is token-heavy. A single task can burn through tens of thousands of tokens across tool calls, file reads, and retries. Sending all of that to one expensive model adds up fast.

Routor fixes this by routing each request to the best-value model for the job. A simple "fix this typo" hits a cheap model. A complex "refactor this auth system" hits a strong one. You keep Cline's full capabilities while cutting costs 25 to 70 percent.

***

## Setup

### 1. Get your API key

1. Sign up at [routor.ai](https://routor.ai)
2. Go to **API Keys** in the dashboard
3. Create a key. It starts with `sk-routor-`

### 2. Configure Cline

Open Cline's settings in VS Code and set up an OpenAI-compatible provider:

| Setting      | Value                      |
| ------------ | -------------------------- |
| API Provider | OpenAI Compatible          |
| Base URL     | `https://api.routor.ai/v1` |
| API Key      | `sk-routor-YOUR_KEY_HERE`  |
| Model        | `auto`                     |

That is it. Cline now routes every request through Routor.

### 3. (Optional) Use the Anthropic-compatible endpoint

Cline also supports the Anthropic Messages API format. Routor exposes an Anthropic-compatible endpoint at `/v1/messages`, so you can use it directly:

| Setting      | Value                     |
| ------------ | ------------------------- |
| API Provider | Anthropic                 |
| Base URL     | `https://api.routor.ai`   |
| API Key      | `sk-routor-YOUR_KEY_HERE` |
| Model        | `auto`                    |

This route converts the Anthropic-format request to the internal pipeline, runs the full routing and fallback logic, and translates the response back to Anthropic shape. Useful if you prefer the Anthropic format or want Cline's native Claude Code integration patterns.

***

## Recommended: Set a Tier Floor

Cline tasks are almost always coding tasks. Without a floor, a trivial request might route to a NANO or SIMPLE tier model that is too weak for agentic coding. Set a tier floor so every request uses at least a capable model:

### Option A: In the request (per-task)

Cline does not let you set custom request body fields in its UI. Use a [Routing Profile](../playground/create-profile.md) instead.

### Option B: With a Routing Profile (recommended)

1. Go to **Playground** in the Routor dashboard
2. Create a profile named "cline" with:
   * **Tier floor**: `STANDARD` (ensures capable coding models)
   * **Tier ceiling**: `COMPLEX` (allows the strongest models when needed)
3. Copy the profile's dedicated API key
4. Use that key in Cline's settings instead of your main key

Now every Cline request uses a model between STANDARD and COMPLEX tier. Simple fixes hit a mid-tier model. Hard architecture work hits a flagship. You never overpay, and you never get a model too weak for the task.

***

## How Routor Handles Cline's Requests

Cline wraps every request in agent scaffolding: a `<task>` block, an `<environment_details>` file dump, and tool-result blocks. This is noise that can confuse a naive router.

Routor strips this scaffolding before classification. It extracts the actual user instruction, classifies that, and routes based on the real task - not the wrapper. The full prompt (including file contents) is still sent to the model. Only the classification uses the cleaned text.

Routor also detects Cline's tool definitions and routes to tool-capable models ranked by BFCL function-calling accuracy.

***

## Verifying It Works

Send a task to Cline and check the dashboard. You will see:

* The **model** Routor picked for each request
* The **tier** it was classified into
* The **cost** and **savings** vs the baseline

Or use the [Debug Endpoint](../api/debug.md) with a sample Cline prompt to see the routing decision without spending credits:

```bash theme={null}
curl https://api.routor.ai/v1/routing/debug \
  -H "Authorization: Bearer sk-routor-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Refactor the auth middleware in src/middleware/auth.ts to use JWT",
    "max_output_tokens": 4096
  }'
```

***

## Cost Comparison

A typical Cline session on a direct Claude Opus 4.8 connection might look like:

| Task                 | Tokens | Cost on Opus 4.8 direct |
| -------------------- | ------ | ----------------------- |
| Fix a small typo     | 12,000 | \$0.30                  |
| Add a unit test      | 28,000 | \$0.70                  |
| Refactor auth system | 85,000 | \$2.13                  |
| **Session total**    |        | **\$3.13**              |

The same session through Routor with a STANDARD tier floor:

| Task                 | Routed model      | Cost with Routor |
| -------------------- | ----------------- | ---------------- |
| Fix a small typo     | Claude Sonnet 4.6 | \$0.08           |
| Add a unit test      | Kimi K2.6         | \$0.03           |
| Refactor auth system | Claude Opus 4.8   | \$2.13           |
| **Session total**    |                   | **\$2.24**       |

The typo and test tasks route to cheaper capable models. The hard refactor still hits Opus because the classifier recognizes the complexity. You save on the easy work without sacrificing quality on the hard work.

***

## Troubleshooting

**Cline says the model is invalid.** Make sure the model field is set to `auto`, not a specific model name. Routor's `auto` mode is what triggers routing.

**Responses feel too weak.** Your tier floor is too low (or not set). Create a profile with a `STANDARD` or `COMPLEX` floor as described above.

**Responses are too expensive.** Your tier floor is too high. Lower it to `LIGHT` or remove it entirely to let Routor pick the cheapest capable model for each task.

**Tool calls fail.** Routor automatically filters to tool-capable models when tools are present. If a specific tool call fails, it is likely a provider issue, not a routing issue. Check the [Provider Health](../providers/health.md) page.
