# Chatbox

> Connect Chatbox to MirAPI as a custom OpenAI-compatible provider with a /v1 base URL, an API key, and a DeepSeek chat model.

Chatbox is a cross-platform desktop and mobile chat client. Add MirAPI as a custom OpenAI-compatible provider and one base URL plus one key gives you the whole catalogue — chat, vision, and reasoning models.

## What you need

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

Chatbox speaks the OpenAI-compatible protocol, so the only endpoint you configure is the base URL. Because Chatbox appends `/chat/completions` itself, the base URL must end in `/v1`.

## Configure

1. Open **Settings → Add custom provider** (Add Provider).
2. Choose **OpenAI API compatible**.
3. Fill in:

```text
API domain / Base URL: https://api.mirapi.ai/v1
API key: sk-...
Default model: deepseek-chat
```

4. Save the provider.
5. Add `deepseek-chat` — or any other id from `GET /v1/models` — to the provider's model list if it isn't populated, then start a new chat with the MirAPI provider.

:::note
Models are entered by hand. Enter each id exactly as `GET /v1/models` returns it; the `vendor/` prefix in the console is for browsing only and never belongs in a request.
:::

## Verify with a message

Send:

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

The reply should contain the exact phrase. If you get an error instead, it almost always comes down to the base URL or the key — check both against the table above.

## Tool-specific pitfalls

- **Keep `/v1` in the base URL.** `https://api.mirapi.ai/v1` is correct; `https://api.mirapi.ai` alone breaks the chat path.
- **Pick models your key can call.** A model outside your whitelist returns 403 even with a valid key.
- **403 also means an empty balance.** Top up and retry — the same key works again immediately.
- **`429` means rate limited.** Retry with jittered exponential backoff; MirAPI sends no `Retry-After` header and does not retry for you.
- **Errors carry a request ID.** Chatbox shows the raw HTTP error text, including MirAPI's request-id suffix — keep it for support tickets.

:::tip
Streaming works out of the box: MirAPI streams standard SSE, which Chatbox renders as it arrives. Billing is per token from your prepaid balance — reconcile it in the console billing log or via `GET /api/log/token`.
:::

## Related links

- [Quickstart](/docs/quickstart)
- [OpenAI compatibility](/docs/openai-compat)
- [Models & pricing](/docs/models)
- [Billing & top-ups](/docs/billing)
- [Authentication](/docs/api-reference/authentication)
- [Errors](/docs/api-reference/errors)