# Cline

Cline has a CLI and a VS Code extension. Both have an "OpenAI Compatible" provider that uses Chat Completions. Set that provider to the exchange, and Cline sends its requests there.

The **CLI verified** label applies to the Cline CLI. It does not apply to the VS Code extension.

## Start with the Liquid CLI

The [Liquid CLI](https://inference.ai.exchange/docs/cli.md) can start Cline with the exchange as its provider. Cline keeps its settings in a file, so set it up one time with the steps below. `liquid connect cline` prints the same setup with your model filled in. Then start Cline with `liquid cline`.

```bash
curl -fsSL https://inference.ai.exchange/cli/install.sh | bash
liquid login
liquid connect cline
liquid cline
```

## Before you start

- A workspace with a balance and a `spend` key. See [API keys](https://inference.ai.exchange/docs/keys.md).
- Cline installed from the VS Code marketplace.

## 1. Choose the OpenAI Compatible provider

Open the settings panel of Cline and set the API provider to **OpenAI Compatible**.

## 2. Set the base URL and the key

Set **Base URL** to:

```
https://router.inference.ai.exchange/v1
```

The base URL ends in `/v1`, because Cline adds `/chat/completions` to it. Paste your key into **API Key**:

```
sk-liquid-...
```

## 3. Pick the model

Cline reads `GET /v1/models` and shows the names in its **Model ID** list. The order is `liquid.auto`, the other router models, your presets, then the models that support tools. Pick a name, for example:

```
liquid.auto
```

You can also type any other name on the book as a custom model ID. To get the current names, see the **Market** page. See [Market data](https://inference.ai.exchange/docs/market.md).

## 4. Set the editor headers

Add these custom headers to the OpenAI Compatible provider:

**X-Title**

```
Cline
```

**x-liquid-cap-usd**

```
1.00
```

`X-Title` identifies Cline on the receipt. The cap applies to each request.

## CLI procedure

Use Node 22 or newer and `jq`.

### 1. Install the CLI

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

### 2. Configure the CLI

Replace the key placeholder before you run this command:

```bash
export LIQUID_API_KEY=sk-liquid-...
set -e
umask 077
cline_settings="$HOME/.cline/data/settings/providers.json"
cline_saved=$(mktemp)
trap 'rm -f "$cline_saved" "$cline_settings.new"' EXIT
if [ -f "$cline_settings" ]; then
  jq '.' "$cline_settings" > "$cline_saved"
else
  printf '{}' > "$cline_saved"
fi
cline auth --provider openai-compatible --apikey "$LIQUID_API_KEY" --modelid 'liquid.auto' --baseurl 'https://router.inference.ai.exchange/v1'
jq --slurpfile saved "$cline_saved" '$saved[0] * . | .providers["openai-compatible"].settings |= (.maxTokens = 16384 | .headers = ((.headers // {}) | with_entries(select((.key | ascii_downcase) != "x-title" and (.key | ascii_downcase) != "x-liquid-cap-usd")) + {"X-Title": "Cline", "x-liquid-cap-usd": "1.00"}))' "$cline_settings" > "$cline_settings.new" && mv "$cline_settings.new" "$cline_settings"
```

The script uses `cline auth`, then merges the provider settings.

- It keeps other providers, preferences and custom headers.
- It sets the exchange URL, the key, the model, the cap header and `X-Title: Cline`.
- It stores `maxTokens: 16384`. Release 3.0.69 does not send this limit in its API requests. The exchange applies its default output limit when the request has no limit.

### 3. Start the CLI

```bash
cline --provider openai-compatible --model 'liquid.auto'
```

## Notes

- The exchange sets a cap on each request. It is in the `x-liquid-cap-usd` header. To limit total spend, set a spending limit on the key. See [API keys](https://inference.ai.exchange/docs/keys.md).
- Cline writes full files, so use a model with a large output limit. If the offers allow less output than Cline asks for, the exchange lowers the request to their limit, and a long answer stops there. See [Errors](https://inference.ai.exchange/docs/errors.md).

## Troubleshooting

| Symptom                                 | Cause and fix                                                                            |
| --------------------------------------- | ---------------------------------------------------------------------------------------- |
| `401` or an authentication error.       | The key is empty or wrong, or the provider is not set to "OpenAI Compatible".            |
| `model_not_found`.                      | The model ID is not on the book. Check it against `GET /v1/models`.                      |
| The model list is empty.                | The base URL is wrong. It must end in `/v1`.                                             |
| Your presets are not in the list.       | The API key is empty or is from a different workspace.                                   |
| Answers stop at the output limit.       | The offers' output limit is below what Cline asked for. Choose a model that allows more. |
| A request is refused for lack of funds. | The workspace balance cannot cover the cap. Add funds on the **Credits** page.           |

## Next steps

- [Cursor](https://inference.ai.exchange/docs/connect-cursor.md): the editor, with its own model settings.
- [Roo Code](https://inference.ai.exchange/docs/connect-roo-code.md): a VS Code agent with a model for each mode.
- [API keys](https://inference.ai.exchange/docs/keys.md): scopes and spending limits.
