Roo Code
Roo Code shares Cline’s provider architecture, so the setup is nearly identical to Cline’s: one OpenAI-compatible provider, one key, and one model. MirAPI’s OpenAI-compatible endpoint accepts Roo Code’s standard requests without any changes.
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 Platform at https://platform.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 catalog (see Models & pricing). - Save. If the provider settings offer a connection test, 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 (here,deepseek-chat). Model names pass through verbatim. - The
vendor/prefix in the catalog (for exampledeepseek/deepseek-chat) is only for browsing and filtering in the Platform; never put it in the Model ID field. - Set the context window from the model’s
context_lengthin the catalog. An overstated value makes Roo Code assume the model accepts more context than it does, which can truncate a task midway. - Roo Code profiles (Architect, Code, Ask) each remember their own model, so switch every profile you use to
deepseek-chat. - MirAPI sends each request to the primary channel you chose and fails over to your backup channel if the primary errors. If both are 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 against a prepaid USD balance that never expires. There is no subscription and 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://platform.mirapi.ai and the same key works again immediately.
- Reconcile usage in the Platform billing log or via
GET /api/log/token. Theusageobject in a non-streaming response reports token counts only, never a dollar amount.
Tool-specific pitfalls
Section titled “Tool-specific pitfalls”- Enter the model ID 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, because Architect, Code, and Ask store settings separately.