OpenCode and Cline with a prepaid API
Point OpenCode and the Cline CLI at an API funded with QRIS or crypto, the steps we ran on OpenCode 2.3.0 and Cline 3.0.74, and the measured cost of one turn.
OpenCode and Cline are open source coding agents that can use an "OpenAI compatible" provider. That means either one can point at any API that serves the OpenAI format, including Cent AI, whose balance you top up with QRIS in rupiah or with crypto. This post has the steps we ran ourselves on 2026-11-14, with OpenCode 2.3.0 and Cline CLI 3.0.74.
What you need
- A Cent AI account with balance. Top up with QRIS from any banking or e-wallet app, or with USDT/USDC on Solana (network fees charged by your wallet are yours). Every payment is manual, with no auto-renewal.
- An API key from Keys. It is shown once.
- A model name exactly as listed in the model list, for example
deepseek-v4.1-flashorglm-5.3.
OpenCode
OpenCode reads its global configuration from ~/.config/opencode/opencode.json (source). Add Cent AI as a provider:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"centai": {
"npm": "@ai-sdk/openai-compatible",
"name": "Cent AI",
"options": { "baseURL": "https://api.cent-ai.dev/v1", "apiKey": "{env:CENT_AI_KEY}" },
"models": { "glm-5.3": { "name": "glm-5.3" } }
}
},
"model": "centai/glm-5.3"
}
Then set the key in the environment and start OpenCode:
export CENT_AI_KEY="YOUR_API_KEY"
opencode
OpenCode's documentation now also shows a newer provider shape, with providers, package, settings and env (source). In our test with OpenCode 2.3.0, both shapes worked. The full guide, including small_model for light tasks, is in the OpenCode docs.
Cline
Cline has a VS Code extension and a CLI. Both use the "OpenAI Compatible" provider with three fields: Base URL, API Key and Model ID (source).
In the CLI, setup is one command:
cline auth openai-compatible -k YOUR_API_KEY -m deepseek-v4.1-flash -b https://api.cent-ai.dev/v1
cline "Explain the folder structure of this project"
Cline saves the key as the provider's key in its configuration folder. In the VS Code extension, choose the API Provider "OpenAI Compatible", enter the Base URL https://api.cent-ai.dev/v1, paste the key and type the Model ID. The extension steps are in the Cline docs.
Check with curl first
If the agent does not answer, check the key and base URL outside it:
curl https://api.cent-ai.dev/v1/chat/completions \
-H "Authorization: Bearer $CENT_AI_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"Hello"}]}'
The response has usage.cost, the amount charged for that request in USD. The most common errors: 401 invalid_api_key (the key is empty or cut off), 404 model_not_found (the model name is not exact) and 429 rate_limited (more than 600 requests per minute on one key).
What one turn costs
Coding agents send a long system prompt on every turn. In our test, OpenCode 2.3.0 sent about 37,000 input tokens per turn, plus one small request for the session title. Rates of the two models we used, per 1M tokens, from the pricing page on 2026-11-14:
| Model | Input | Cache read | Output |
|---|---|---|---|
| deepseek-v4.1-flash | $0.015 | $0.0021 | $0.06 |
| glm-5.3 | $0.14 | $0.014 | $0.44 |
With the first model, our first turn was billed 564,748 nano-USD (about $0.00056), and the next turn 80,946 nano-USD (about $0.00008), because almost the whole prompt was read from cache. Your numbers will differ with the length of the conversation and the files read; every turn shows on the Requests page of the dashboard with its tokens per rate and its cost.
With a prepaid balance there is no 5-hour window: you pay for the tokens you use, and you can set a daily or monthly limit on each key so a long agent session stays within your plan.
Sources
- opencode.ai/docs/config (opens in a new tab) · accessed 2026-11-14
- opencode.ai/docs/providers (opens in a new tab) · accessed 2026-11-14
- docs.cline.bot/provider-config/openai-compatible (opens in a new tab) · accessed 2026-11-14
- cent-ai.dev/docs/integrations/opencode (opens in a new tab) · accessed 2026-11-14
Related posts
- Card declined when paying for an AI API? What to checkpayment · 3 minCommon things to check when a debit or credit card is declined while buying AI API credits, and a prepaid alternative with QRIS or USDT/USDC.
- Codex CLI custom provider in config.tomlcodex · 3 minAdd a custom model provider to Codex CLI in ~/.codex/config.toml with wire_api = "responses", keep the key in an environment variable, and check it with one curl request.
- Claude Code usage limit reached: how to keep workingclaude-code · 5 minWhy Claude Code stops with "Usage limit reached" on a Pro or Max plan, the official ways to continue, and how to run it on a prepaid API key with no 5-hour window.