# Cline

Point the Cline coding agent at eWest.

Cline uses eWest through its **OpenAI Compatible** provider (`/v1/chat/completions`).

> We haven't tested this setup ourselves; it follows the tool's own documentation. If something doesn't work, contact support.

## Setup

1. Open Cline's settings (the gear icon) and choose **OpenAI Compatible** as the API Provider.
2. **Base URL**: `https://api.ewest.ai/v1`. **API Key**: your eWest key. **Model ID**: an `ewest/*` id such as `ewest/claude-sonnet`.
3. Under **Model Configuration**, set **Context Window Size** to the model's context window from [Models](https://ewest.ai/docs/models) (200000 for `ewest/claude-haiku`, 1000000 for `ewest/claude-sonnet`), **Max Output Tokens** to what you need (8192 is a good start), and turn on image support for models that take images.

Cline's **Anthropic** provider also has **Use custom base URL** (`https://api.ewest.ai`, no `/v1`), but its model list only offers Anthropic's own model names, which eWest answers with `404`. Use OpenAI Compatible.

## Choose a model

Enter the id with its prefix: `ewest/claude-sonnet`, not `claude-sonnet`. Cline relies on tool calling, so use a model that supports tools: any `ewest/claude-*` model or `ewest/gemini-flash`. Change the context window when you change the model.

## Verify it works

Click **Verify**, or give Cline a short task. The cURL request below is the one Cline sends, including `stream_options.include_usage`, so the last event carries the token counts Cline shows.

Every response has an `x-request-id` header; paste it into the console under Requests to see the request ([trace IDs](https://ewest.ai/docs/traces)).

cURL:

```bash
# The request Cline sends, without Cline. The last event carries the token usage.
curl https://api.ewest.ai/v1/chat/completions \
  -H "Authorization: Bearer $EWEST_KEY" \
  -H "content-type: application/json" \
  -d '{"model": "ewest/claude-haiku", "stream": true, "stream_options": {"include_usage": true}, "messages": [{"role": "user", "content": "Reply with the single word OK"}]}'
```

## Streaming and tools

Cline always streams and uses tool calling over `/v1/chat/completions`; there is nothing to set.

## Troubleshooting

- `401`: the key is missing, mistyped or revoked. Copy it again from [API keys](https://ewest.ai/keys).
- `404` with `model_not_found`: the model name needs the `ewest/` prefix (`ewest/claude-haiku`, not `claude-haiku`) and must be in [Models](https://ewest.ai/docs/models).
- `403`: your key is not allowed to use that model; `402`: the key's budget is used up. See [Errors](https://ewest.ai/docs/errors).
- Cline trims the conversation early, or the model says the prompt is too long: check **Context Window Size** against the model's limit in [Models](https://ewest.ai/docs/models).

cURL:

```bash
# The models your key may call (use these ids exactly, with the ewest/ prefix):
curl -H "Authorization: Bearer $EWEST_KEY" https://api.ewest.ai/v1/models

# One model, with its context window and whether it supports tools and images:
curl -H "Authorization: Bearer $EWEST_KEY" https://api.ewest.ai/v1/models/ewest/claude-haiku
```

Still stuck? Follow [Troubleshoot a request](https://ewest.ai/docs/troubleshooting).

Source: https://ewest.ai/docs/guides/cline
