# Cline

Source: https://docs.aiand.com/integrations/cline/

[Cline](https://github.com/cline/cline) is an AI coding agent for the terminal.
ai& is included as a built-in provider, with id `aiand` and base URL
`https://api.aiand.com/v1`.

<Aside type="note">
  For repository work, start with `moonshotai/kimi-k3`. For a cheaper loop,
  use `deepseek-ai/deepseek-v4-flash`. Cline loads context size, tool support,
  and prompt-cache pricing from the [model catalog](/models/catalog/), so you
  do not enter those by hand.
</Aside>

## 1. Install the CLI

```bash
npm install -g cline
```

## 2. Add your API key

Create a key in the [ai& console](https://console.aiand.com/api-keys), then set it in your shell:

<Tabs syncKey="os">
<TabItem label="macOS / Linux">

```bash
export AIAND_API_KEY="sk-your-aiand-api-key"
```

</TabItem>
<TabItem label="Windows (PowerShell)">

```powershell
$env:AIAND_API_KEY = "sk-your-aiand-api-key"
```

</TabItem>
</Tabs>

## 3. Select ai&

Save the provider and a model. This writes the API key into Cline's local settings:

```bash
cline auth --provider aiand --apikey "$AIAND_API_KEY" --modelid moonshotai/kimi-k3
```

The model id is the catalog id, such as `moonshotai/kimi-k3`. It is not prefixed with `aiand/`.

To switch the saved model:

```bash
cline auth --provider aiand --apikey "$AIAND_API_KEY" --modelid deepseek-ai/deepseek-v4-flash
```

## 4. Run Cline

Start a task with the saved provider:

```bash
cline "inspect this repository and fix the failing test"
```

A prompt runs in act mode with tool auto-approval on. Override the saved model for one run:

```bash
cline -P aiand -m moonshotai/kimi-k3 "reply with only: ok"
```

When `AIAND_API_KEY` is set, that one-shot form does not need `cline auth` first.

## Verify

```bash
cline "reply with only: ok"
```

Cline prints token counts for the turn, including cached input tokens when the model supports prompt caching.

## Troubleshooting

- **Unauthorized request** — set `AIAND_API_KEY` in the same shell, or run `cline auth` again with a key from the [ai& console](https://console.aiand.com/api-keys).
- **Model not found** — use an id from the [model catalog](/models/catalog/). Do not prefix it with `aiand/`.
- **The agent answers but does not edit files** — pick a model with tool calling, such as `moonshotai/kimi-k3` or `deepseek-ai/deepseek-v4-flash`.
