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

# API overview

> Programmatic access to AI models through an OpenAI-compatible Chat Completions API, plus the VS Code extension API for building integrations.

Cline exposes two distinct APIs depending on what you want to build:

* **Cline REST API** — An OpenAI-compatible HTTP endpoint at `api.cline.bot`. Send chat messages to any supported model from any language, framework, or tool.
* **VS Code Extension API (`ClineAPI`)** — A TypeScript interface exposed by the Cline VS Code extension. Lets other extensions programmatically start tasks, send messages, and interact with the Cline panel.

## Cline REST API

The Cline REST API is an OpenAI-compatible Chat Completions endpoint. Authenticate once with a Cline API key and get access to models from Anthropic, OpenAI, Google, and more through a single base URL. No need to manage separate keys for each provider.

```
Your app  →  Cline API (api.cline.bot)  →  Anthropic / OpenAI / Google / ...
```

### Base URL

```
https://api.cline.bot/api/v1
```

### Authentication

All requests require a Bearer token in the `Authorization` header:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

Get your API key at [app.cline.bot](https://app.cline.bot) under **Settings > API Keys**.

### Quick example

```bash theme={null}
curl -X POST https://api.cline.bot/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4-6",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

## VS Code extension API

The Cline VS Code extension exports a `ClineAPI` interface that other extensions can use to control the Cline panel programmatically. This is intended for extension authors building editor integrations.

```typescript theme={null}
export interface ClineAPI {
  // Start a new task with an optional message and images
  startNewTask(task?: string, images?: string[]): Promise<void>

  // Send a message to the active task
  sendMessage(message?: string, images?: string[]): Promise<void>

  // Simulate clicking the primary action button
  pressPrimaryButton(): Promise<void>

  // Simulate clicking the secondary action button
  pressSecondaryButton(): Promise<void>
}
```

Access the API from another VS Code extension:

```typescript theme={null}
const clineExtension = vscode.extensions.getExtension('saoudrizwan.claude-dev')
const cline: ClineAPI = clineExtension?.exports

await cline.startNewTask('Refactor this module to use async/await')
```

<Note>
  The `ClineAPI` is only available in the VS Code extension context. It does not apply to the REST API, the CLI, or JetBrains.
</Note>

## REST API reference

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/api/authentication">
    API keys, security best practices, and environment variable setup.
  </Card>

  <Card title="Chat completions" icon="message" href="/api/chat-completions">
    Full endpoint reference — parameters, streaming, tool calling, and response format.
  </Card>

  <Card title="Errors" icon="triangle-exclamation" href="/api/errors">
    Error codes, mid-stream errors, and retry strategies.
  </Card>

  <Card title="Models" icon="brain" href="/models/model-selection-guide">
    Browse available models, free tiers, and selection guidance.
  </Card>
</CardGroup>
