# Cline Integration

> **Last verified**: 2026-09-18 · 📄 Per official docs (VS Code extension 4.1.19, released 2026-09-17; Cline Desktop below)

## At a glance

| Item | Details |
|---|---|
| Models you can use | Claude ✅ (Route A: Anthropic provider) · GPT ✅ · Chinese models ✅ (Route B: OpenAI Compatible) · Gemini ❌ (no Gemini route documented here) |
| Protocol & Base URL | Anthropic: `https://api.qcode.cc/api` · OpenAI: `https://api.qcode.cc/openai/v1` |
| Where to configure | VS Code extension settings (API Provider + "Use custom base URL"); the desktop app follows the same logic |
| Official docs | [cline.bot](https://cline.bot) · [GitHub](https://github.com/cline/cline) |

[Cline](https://github.com/cline/cline) is a popular VS Code AI coding extension (millions of installs) that supports any AI model and custom API endpoints. It ships with Plan / Act dual modes, file-edit diff previews, terminal execution, and MCP tool calls. By pairing Cline with the QCode.cc API, you can use Claude, GPT, and [China-family models](/docs/usage/cn-models) in VS Code at low cost.

## Why Cline?

- **Zero markup**: No markup on model costs — you only pay QCode.cc API fees

- **Flexible model switching**: Switch between `claude-sonnet-5`, `claude-opus-5`, `gpt-5.6-terra`, and more in the same interface (4.x still works)

- **Deep VS Code integration**: Sidebar panel, inline code actions, file-edit diff preview, auto-approve

- **Plan / Act dual modes**: Plan first, then execute — keeps complex changes under control

- **Fully open source**: Transparent code, active community

- **MCP support**: Connect external tools (databases, browsers, docs) via the Model Context Protocol

## Installation & Configuration

### Step 1: Install the Cline Extension

In VS Code:

1. Open the Extensions panel (`Ctrl+Shift+X` / `Cmd+Shift+X`)

2. Search for **"Cline"**

3. Click **Install**

4. After installing, the Cline icon appears in the left Activity Bar

> Cline also offers a command-line version (Cline CLI) that reuses the same configuration in your terminal; this guide focuses on the VS Code extension.

### Step 2: Configure QCode.cc API

A single QCode.cc API key (starts with `cr_`) is compatible with both the Anthropic protocol and the OpenAI protocol. Cline offers two ways to connect — **pick either one**:

#### Option A: Anthropic-compatible (recommended for Claude models)

In Cline's settings (gear icon), open the **API Provider** dropdown and select **"Anthropic"**, then fill in:

| Setting | Value |
|---------|-------|
| API Key | Your QCode.cc API key (starts with `cr_`) |
| Use custom base URL | Check it and enter `https://api.qcode.cc/api` |
| Model | `claude-sonnet-5` (daily default) or `claude-opus-5` (hard jobs). `claude-sonnet-4-6` / `claude-opus-4-8` still on sale |

> The SDK automatically appends `/v1/messages` after the Base URL, so set the Base URL to `/api` — do **not** write `/api/v1/messages`, and do **not** include a trailing slash.

#### Option B: OpenAI-compatible

In the **API Provider** dropdown, select **"OpenAI Compatible"**, then fill in:

| Setting | Value |
|---------|-------|
| Base URL | `https://api.qcode.cc/openai/v1` |
| API Key | Your QCode.cc API key (starts with `cr_`) |
| Model ID | `gpt-5.6-terra`, `gpt-5.5`, or a [China-family id](/docs/usage/cn-models) such as `glm-5.2`. **`claude-*` will not work here** |

> 🔴 **OpenAI-compatible mode cannot use Claude.** QCode's OpenAI endpoint serves only GPT and the four Chinese families; a `claude-*` id returns `model_not_available_on_endpoint`. For Claude, go back to **Option A (Anthropic)** with Base URL `https://api.qcode.cc/api`. See [Endpoints & API Paths](/docs/getting-started/endpoints-and-api-paths).

### Step 3: Verify Connection

Type a simple message (e.g., "Hello") in the Cline chat box. If you receive a response, the configuration is successful.

You can also self-check with curl in a terminal (a `401` means the path is correct and only auth is missing):

```bash
# Anthropic protocol
curl -i https://api.qcode.cc/api/v1/messages \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-5","max_tokens":16,"messages":[{"role":"user","content":"hi"}]}'

# OpenAI protocol (note: this leg only accepts GPT or China-family ids)
curl -i https://api.qcode.cc/openai/v1/chat/completions \
  -H "content-type: application/json" \
  -d '{"model":"gpt-5.5","messages":[{"role":"user","content":"hi"}]}'
```

## Alternative Endpoints

The same key works across 4 access domains, which back each other up. If the primary domain is unstable, swap `api` in the Base URL for the corresponding subdomain below:

| Endpoint | Anthropic Base URL | OpenAI Base URL |
|----------|--------------------|-----------------|
| Default | `https://api.qcode.cc/api` | `https://api.qcode.cc/openai/v1` |
| Asia-Pacific (preferred in mainland China) | `https://asia.qcode.cc/api` | `https://asia.qcode.cc/openai/v1` |
| US | `https://us.qcode.cc/api` | `https://us.qcode.cc/openai/v1` |
| Europe | `https://eu.qcode.cc/api` | `https://eu.qcode.cc/openai/v1` |

> Users in mainland China should prefer `asia.qcode.cc`, which usually has the lowest latency. See [Endpoints & API Formats](/docs/getting-started/endpoints-and-api-paths) for details.

## Cline Desktop

On 2026-09-14 Cline shipped a desktop app ([official announcement](https://cline.bot/blog/cline-desktop-an-open-source-app-for-open-weight-models): *"Bring your own API key and connect natively to any provider — Anthropic, OpenAI, Gemini, open-weight models, or a local endpoint"*; the [product page](https://cline.bot/desktop) carries no date). The desktop app follows the same provider logic as the extension (pick an API Provider + custom Base URL); field-level names for the desktop are not separately documented upstream — go by what the app shows. Downloads and platform support: [cline.bot/desktop](https://cline.bot/desktop).

## Plan / Act Dual Modes

Cline offers a **Plan** / **Act** toggle below the chat box:

- **Plan**: Cline reads the code, asks questions, and proposes an implementation plan, but does **not** modify files. Great for aligning on requirements before any change.

- **Act**: Cline actually creates/edits files, runs commands, and calls tools. Each change is shown as a diff for you to approve or auto-approve.

A typical workflow: use **Plan** mode first to have the model outline and confirm an approach, then switch to **Act** mode to implement it step by step. For complex tasks, plan with `claude-opus-5`, then execute with `claude-sonnet-5`. 4.x is still available as a comparison.

## Usage Tips

### 1. Model Selection Guide

| Scenario | Recommended Model | Notes |
|----------|-------------------|-------|
| Daily coding | `claude-sonnet-5` | Current balanced tier, 1M / 128K; input was cheaper than 4.6 when this was written |
| Complex architecture / Plan mode | `claude-opus-5` | Current flagship. `claude-opus-4-8` still on sale |
| Lightweight tasks / copy edits | `claude-haiku-4-5` | Lowest cost |
| Prefer GPT style | `gpt-5.6-terra` | Selectable under the OpenAI protocol |
| China-family / lower unit price | `glm-5.2` / `deepseek-v4-pro` | See [China-family models](/docs/usage/cn-models) |

See [Billing](/docs/reference/billing) for full pricing.

### 2. Configure MCP Tools

Cline supports the Model Context Protocol (MCP), letting the model call external tools (database queries, browsers, document search, etc.). Add a server in Cline's **MCP Servers** panel:

```json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
    }
  }
}
```

MCP servers are decoupled from the upstream model — tool calls work whether you connect to QCode.cc via the Anthropic or OpenAI protocol. For each server's install steps and parameters, see the tool's official docs.

### 3. Project-Level Custom Instructions (.clinerules)

Create a `.clinerules` file in the project root to inject fixed context for that repo — code style, stack conventions, directory layout. Cline includes these rules in every conversation, so you don't have to paste them repeatedly:

```text
# .clinerules
- Use TypeScript everywhere, strict mode
- Prefer reusing helpers under src/lib
- Run `pnpm test` before committing
```

For the rules file's fields and advanced usage, see Cline's official docs.

### 4. Image Input (Vision)

`claude-opus-5`, `claude-sonnet-5` (and still-on-sale 4.8 / 4.6) and GPT-5.x all support vision input. Drag a UI screenshot, an error screenshot, or an architecture diagram straight into the Cline chat box and let the model code from it or debug it.

> Note: this is about having the model **read** images. To **generate** images, use [gpt-image-2 Image Generation](/docs/usage/image-2) with the model name `gpt-image-2`.

### 5. Auto-Approve & Cost Control

- In settings you can enable **Auto-approve** separately for "read files", "write files", and "execute commands" to reduce interruptions; keep manual confirmation for high-risk operations.

- Cline shows the token usage and estimated cost per request, making spend easy to track. For complex tasks, narrow scope with Plan mode first to avoid unnecessary back-and-forth.

- For large codebases, use `@` (mention a file/folder/URL) to feed precise context instead of letting the model scan the whole project — it saves tokens and stays focused.

### 6. Pairing with Claude Code CLI

Cline and Claude Code CLI each have their strengths — use them together:

| Scenario | Recommended Tool |
|----------|------------------|
| Quick edits in VS Code | Cline |
| Complex project analysis | Claude Code CLI |
| Multi-file refactoring | Cline |
| Git operations, code review | Claude Code CLI |
| Codebase-wide migration/review | Claude Code CLI ([subagents](/docs/advanced/subagents)) |
| CI/CD automation | Claude Code CLI ([headless mode](/docs/advanced/headless)) |

### 7. Shared Quota

Cline and Claude Code CLI use the same QCode.cc API key and share the plan quota — no need to request separate keys per tool.

## FAQ

### Connection failed / 401 / 404?

1. Make sure the Base URL has **no** trailing `/`

2. In Anthropic mode, set the Base URL to `/api` (the SDK appends `/v1/messages`) — don't write the full path manually

3. In OpenAI mode, set the Base URL to `/openai/v1`

4. Check that the API key starts with `cr_` and was copied in full

5. Try switching to an alternative endpoint (e.g., `asia.qcode.cc`)

6. Confirm your network can reach QCode.cc services

### Model list is empty?

In OpenAI-compatible mode, manually type the model name in the Model ID field (e.g., `glm-5.3`) — you don't need to select from a list.

### Plan mode doesn't change files?

That's expected. Plan mode only plans; changes are written only after switching to Act mode.

### Getting 401 even though config looks right?

A `401` usually means the path is correct and only auth failed. Re-check that the API Key is complete and that you picked the right Provider type (Anthropic vs OpenAI Compatible) with its matching Base URL.

## Next Steps

- See [Endpoints & API Formats](/docs/getting-started/endpoints-and-api-paths) for all protocols and domains

- See [Aider Integration](/docs/ide/aider) for another open-source tool compatible with QCode.cc

- See [VS Code Integration](/docs/ide/vscode) to use the official Claude Code extension

- See [China-family models](/docs/usage/cn-models) to call GLM / Kimi / DeepSeek / Qwen with the same OpenAI-compatible fields

- See [Billing](/docs/reference/billing) for pricing details

> Don't have an API key yet? [See QCode.cc plans and pricing →](https://qcode.cc/pricing)