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 with 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 catalog value |
Create the key in the Platform (https://platform.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 catalog value for
deepseek-chat. Cline uses this number to plan truncation, so an overstated value makes it overfill the request. - Save. If Cline offers to send 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 protocols 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 Platform. |
403 |
Key is valid but rejected: the model is not on the key’s whitelist, the key hit a quota, the caller’s IP is not on the allowlist, 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 usage is charged to your MirAPI prepaid balance. There is no subscription or monthly fee, and the balance never expires. Chat turns are billed per token in three tiers (input, output, and cache read), priced in USD per 1M tokens, and reasoning tokens count as output. When the balance runs out, MirAPI returns 403; after you top up, the same key works again immediately.