Skip to content

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.

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).

  1. Open Roo Code → Settings → API Provider.
  2. Choose OpenAI Compatible.
  3. Fill in the three fields:
Base URL: https://api.mirapi.ai/v1
API Key: $MIRAPI_API_KEY
Model ID: deepseek-chat
  1. Set the context window to the model’s context_length from the catalogue (see Models & pricing).
  2. 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.

Start a task and type:

Reply with exactly: connected to MirAPI

The assistant reply should contain connected to MirAPI. If it does not, check the status codes table below.

  • Send the exact id that GET /v1/models returns — deepseek-chat. Model names pass through verbatim.
  • The vendor/ prefix in the catalogue (for example deepseek/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.
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.

  • 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-streaming usage reports token counts only, never a dollar amount.
  • Model ID is verbatim: deepseek-chat must match GET /v1/models exactly.
  • 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 /v1 in 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.