Skip to content

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.

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

  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 catalog (see Models & pricing).
  2. 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.

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 (here, deepseek-chat). Model names pass through verbatim.
  • The vendor/ prefix in the catalog (for example deepseek/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_length in 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.
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 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. The usage object in a non-streaming response reports token counts only, never a dollar amount.
  • Enter the model ID 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, because Architect, Code, and Ask store settings separately.