Cline
Cline is a VS Code extension that runs an autonomous coding agent. It supports custom OpenAI-compatible providers, so you can route its requests through MirAPI on your own key.
What you need
Section titled “What you need”| Element | Value |
|---|---|
| API provider | OpenAI Compatible |
| Base URL | https://api.mirapi.ai/v1 |
| API key | Your MirAPI key (sk-...) |
| Model ID | deepseek-chat |
| Context window | The model’s catalogue value |
Create the key in the console (https://console.mirapi.ai) and check the model’s context length on the Models & pricing page.
Configure
Section titled “Configure”- Open Cline → Settings → API Provider.
- Select OpenAI Compatible.
- Fill in:
Base URL: https://api.mirapi.ai/v1API Key: sk-...Model ID: deepseek-chat- Set the context window from the catalogue value for
deepseek-chat. Cline uses this number to plan truncation, so an overstated value makes it overfill the request. - Save. Cline may offer a small test request — allow it.
Verify with a message
Section titled “Verify with a message”Create a Cline task and send:
Reply with exactly: connected to MirAPIThe assistant’s reply should contain connected to MirAPI. If it does not, see Errors and troubleshooting below.
You can also confirm the model is listed before starting:
curl https://api.mirapi.ai/v1/models -H "Authorization: Bearer sk-..."Look for deepseek-chat among the returned id values.
Protocol variants
Section titled “Protocol variants”MirAPI serves three API dialects under one key. The OpenAI Compatible provider above is the recommended path; if you use Cline’s Anthropic or Gemini provider instead, point it at the matching surface:
| Protocol | Base URL | Auth |
|---|---|---|
| OpenAI-compatible | https://api.mirapi.ai/v1 |
Authorization: Bearer sk-... |
| Anthropic | https://api.mirapi.ai |
x-api-key or Authorization: Bearer |
| Gemini | https://api.mirapi.ai or https://api.mirapi.ai/v1beta |
x-goog-api-key or ?key= |
Whichever protocol you pick, copy the model ID verbatim from GET /v1/models — requests use the exact id, not the display name.
Errors and troubleshooting
Section titled “Errors and troubleshooting”| Symptom | Cause and fix |
|---|---|
401 |
Key missing, invalid, or unknown. Check that it is copied in full and matches the console. |
403 |
Key is valid but rejected: the model is not on the key’s whitelist, a quota or IP allowlist is exceeded, or the balance is empty. Top up or adjust the key’s limits, then retry. |
413 |
Payload too large. Trim the context or the attached files. |
429 |
Rate limited. Retry with jittered exponential backoff (1s → 2s → 4s, capping around 30s). MirAPI sends no Retry-After header and does not retry for you. |
500 |
Gateway or upstream failure. Idempotent requests are safe to retry. |
Every error message ends with a request ID; include it in a support ticket. OpenAI-style errors use the envelope {"error": {"message", "type", "param", "code"}}, where type is new_api_error (gateway side) or upstream_error (upstream failure).
Billing
Section titled “Billing”Cline charges through MirAPI’s prepaid balance — no subscription or monthly fee, and balance never expires. Chat turns are billed per token (per 1M USD, in three tiers: input, output, cached read), and reasoning tokens count as output. When the balance runs out MirAPI returns 403; topping up restores the same key immediately.