Roo Code
Roo Code shares Cline’s provider architecture, so the setup is nearly identical: one OpenAI-compatible provider, one key, and one model. MirAPI’s OpenAI-compatible surface accepts Roo Code’s standard requests out of the box.
What you need
Section titled “What you need”| Element | Value |
|---|---|
| Base URL | https://api.mirapi.ai/v1 |
| API key | MIRAPI_API_KEY |
| Model | deepseek-chat |
Create the key in the console at https://console.mirapi.ai. Roo Code sends it as Authorization: Bearer, which MirAPI accepts (the scheme is case-insensitive).
Configure
Section titled “Configure”- Open Roo Code → Settings → API Provider.
- Choose OpenAI Compatible.
- Fill in the three fields:
Base URL: https://api.mirapi.ai/v1API Key: $MIRAPI_API_KEYModel ID: deepseek-chat- Set the context window to the model’s
context_lengthfrom the catalogue (see Models & pricing). - Save. If the provider settings offer a test connection, run it once.
Keep /v1 in the base URL: Roo Code appends /chat/completions itself, so the full path becomes https://api.mirapi.ai/v1/chat/completions.
Verify with a message
Section titled “Verify with a message”Start a task and type:
Reply with exactly: connected to MirAPIThe assistant reply should contain connected to MirAPI. If it does not, check the status codes table below.
Model, context window, and profiles
Section titled “Model, context window, and profiles”- Send the exact
idthatGET /v1/modelsreturns —deepseek-chat. Model names pass through verbatim. - The
vendor/prefix in the catalogue (for exampledeepseek/deepseek-chat) is only for browsing and filtering in the console; never put it in the Model ID field. - Set the context window from the model’s
context_length. An overstated value makes Roo Code think the model fits more than it accepts, which can truncate a task mid-way; use the catalogue number. - Roo Code profiles (Architect, Code, Ask) each remember their own model — switch every profile you use to
deepseek-chat. - MirAPI routes each request to a healthy channel automatically. If every channel for a model is down, the request fails with a 5xx rather than silently substituting another model.
Errors and troubleshooting
Section titled “Errors and troubleshooting”Status codes
Section titled “Status codes”| Status | Meaning | What to do |
|---|---|---|
| 401 | Key missing, invalid, or unknown | Check the key in Roo Code settings |
| 403 | Key valid but rejected — empty balance, model whitelist, quota, or IP | Fix the cause; top up if the balance is empty |
| 413 | Request too large | Reduce the context or payload |
| 429 | Rate limited — no Retry-After header |
Retry with jittered exponential backoff (1s → 2s → 4s, capped ~30s) |
| 5xx | Upstream or channel failure | Retry idempotent requests |
Every error message ends with a request ID — include it in any support ticket. See Errors for the full reference.
Billing
Section titled “Billing”- MirAPI bills on a prepaid USD balance that never expires — no subscription, no minimum spend.
- Chat requests are billed per token (input / output / cache read), priced per 1M tokens; reasoning tokens are billed as output.
- When the balance runs out, requests return 403. Top up at https://console.mirapi.ai and the same key works again immediately.
- Reconcile usage in the console billing log or via
GET /api/log/token. A non-streamingusagereports token counts only, never a dollar amount.
Tool-specific pitfalls
Section titled “Tool-specific pitfalls”- Model ID is verbatim:
deepseek-chatmust matchGET /v1/modelsexactly. - A 403 with a valid key usually means the model is not whitelisted for the key or the balance is empty — top up and retry; the same key works again immediately.
- Keep
/v1in the base URL; Roo Code appends/chat/completions. - After changing the key or model, re-save each profile you use — Architect, Code, and Ask store settings separately.