# Continue

> Connect Continue (VS Code and JetBrains) to MirAPI as an OpenAI-compatible provider: set its apiBase to MirAPI /v1 base URL and add your key in ~/.continue/config.yaml.

Continue is an open-source AI coding assistant for VS Code and JetBrains. Its `~/.continue/config.yaml` accepts any OpenAI-compatible endpoint, so you can route Continue's chat and autocomplete requests through MirAPI on your own key.

## What you need

| Element | Value |
|---|---|
| Provider | `openai` |
| Base URL | `https://api.mirapi.ai/v1` (`apiBase`) |
| API key | Your MirAPI key (`sk-...`) |
| Model | `deepseek-chat` |

Create the key in the console (`https://console.mirapi.ai`) and check the model's availability and context length on the [Models & pricing](/docs/models) page.

## Configure

1. Open `~/.continue/config.yaml` (Windows: `%USERPROFILE%\.continue\config.yaml`). Create it if it does not exist.
2. Add a model entry under `models`:

```yaml
models:
  - name: MirAPI DeepSeek
    provider: openai
    model: deepseek-chat
    apiBase: "https://api.mirapi.ai/v1"
    apiKey: ${MIRAPI_API_KEY}
    roles:
      - chat
      - edit
      - apply
      - autocomplete
```

3. Export the key so Continue can resolve `${MIRAPI_API_KEY}`:

```bash
export MIRAPI_API_KEY=sk-...
```

4. Reload Continue (or restart the editor) and select **MirAPI DeepSeek** in the model picker.

:::note
`apiBase` must include `/v1` — Continue appends `/chat/completions` to the base URL. A bare `https://api.mirapi.ai` will return 404.
:::

The `roles` list decides which features use this model: `chat` enables the chat panel, and `autocomplete` enables inline completions. If you paste a literal key instead of an environment variable, the same `apiKey` field works, but a shell-exported key is easier to rotate and keeps secrets out of the config file.

## Verify with a message

In the Continue chat panel, send:

```text
Reply with exactly: connected to MirAPI
```

The assistant's reply should contain `connected to MirAPI`. If it does not, see Errors and troubleshooting below.

You can also confirm the model is listed before starting:

```bash
curl https://api.mirapi.ai/v1/models -H "Authorization: Bearer sk-..."
```

Look for `deepseek-chat` among the returned `id` values.

## Protocol variants

MirAPI serves three API dialects under one key. The `openai` provider above is the recommended path; if you use Continue's Anthropic or Gemini provider instead, point it at the matching surface:

| Protocol | Base URL | Auth |
|---|---|---|
| OpenAI-compatible | `https://api.mirapi.ai/v1` | `Authorization: Bearer sk-...` |
| Anthropic | `https://api.mirapi.ai` | `x-api-key` or `Authorization: Bearer` |
| Gemini | `https://api.mirapi.ai` or `https://api.mirapi.ai/v1beta` | `x-goog-api-key` or `?key=` |

Whichever protocol you pick, copy the **model ID verbatim** from `GET /v1/models` — requests use the exact `id`, not the display name.

## Errors and troubleshooting

| Symptom | Cause and fix |
|---|---|
| `401` | Key missing, invalid, or unknown. Check that it is copied in full and matches the console. |
| `403` | Key is valid but rejected: the model is not on the key's whitelist, a quota or IP allowlist is exceeded, or the balance is empty. Top up or adjust the key's limits, then retry. |
| `413` | Payload too large. Trim the context or the attached files. |
| `429` | Rate limited. Retry with jittered exponential backoff (1s → 2s → 4s, capping around 30s). MirAPI sends no `Retry-After` header and does not retry for you. |
| `500` | Gateway or upstream failure. Idempotent requests are safe to retry. |

Every error message ends with a **request ID**; include it in a support ticket. OpenAI-style errors use the envelope `{"error": {"message", "type", "param", "code"}}`, where `type` is `new_api_error` (gateway side) or `upstream_error` (upstream failure).

## Billing

Continue charges through MirAPI's prepaid balance — no subscription or monthly fee, and the balance never expires. Chat turns are billed per token (per 1M USD, in three tiers: input, output, cached read), and reasoning tokens count as output. When the balance runs out MirAPI returns `403`; topping up restores the same key immediately.

## Related links

- [Cursor](/docs/integrations/cursor)
- [Models & pricing](/docs/models)
- [Billing & top-ups](/docs/billing)
- [Errors](/docs/api-reference/errors)