Docs / Integrations
Use Cent AI with Roo Code
Set Roo Code's API provider to OpenAI Compatible with the Cent AI base URL, your API key and a model name.
Last updated
Your setup
Fills in YOUR_API_KEY in the code on this page. The key stays in this tab: it is never sent and never saved.
Roo Code's OpenAI Compatible provider speaks the OpenAI Chat Completions format, so it connects to Cent AI at https://api.cent-ai.dev/v1 and adds /chat/completions itself.
Prerequisites
- A Cent AI account with balance. See Quickstart.
- An API key from Keys. It looks like
cai_<secret>and is shown once. - Roo Code installed in VS Code.
Configure Roo Code
Open the Roo Code settings (the gear icon in the Roo Code panel) and fill in:
| Setting | Value |
|---|---|
| API Provider | OpenAI Compatible |
| Base URL | https://api.cent-ai.dev/v1 |
| API Key | Your key, cai_<secret> |
| Model | A model name exactly as listed by GET /v1/models, for example glm-5.3 |
Roo Code works through tool calls, so pick a model that supports tool calling.
Under Model Configuration you can set the context window and the maximum output tokens of the model. Use the values shown for the model in GET /v1/models. The input and output prices in that panel only feed Roo Code's own cost estimate; what Cent AI charges is in usage.cost and on the Requests page.
Test it
Check the key and the model name with one request. Replace YOUR_API_KEY with your key.
export CENT_AI_KEY="YOUR_API_KEY"
curl https://api.cent-ai.dev/v1/chat/completions \
-H "Authorization: Bearer $CENT_AI_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"glm-5.3","messages":[{"role":"user","content":"Hello"}]}'
The response has usage.cost, the amount charged for this request in USD. Then start a task in Roo Code, for example "Explain this file". One task usually sends several requests, one per step. Each request appears on the Requests page of the dashboard with its tokens per rate and its cost. See Request cost.
Cache continuity
Roo Code resends the task history on every step, so much of the input of a long task can be read from the model's cache. Cent AI sends the next turns of a conversation to the route that served the previous turn. It uses the session signal a tool sends when there is one; without it, it uses the stable start of the prompt. You do not add anything to the settings for this.
- Keep one task on one model. Switching the model or the mode's model in the middle of a task starts a new cache.
- Keep custom instructions and rules the same during a task. A change near the start of the prompt changes everything after it.
Cent AI does not promise a cache hit rate. Cache tokens are charged only when the model reports them. See Prompt caching.
Troubleshooting
To look up a failed request, find the x-request-id of the response on the Requests page. All codes are in 4xx errors and 5xx errors.
401 invalid_api_key
The key in API Key is wrong, cut off, revoked, or a management key (cai_mgmt_…). Paste the key again, or create a new one in Keys.
402 insufficient_balance
The balance available for this model is empty, or the model is not in your budget pack. Top up or buy a pack. See Balance.
403 ip_not_allowed or model_not_allowed
The key has an IP allowlist without your address, or a model allowlist without the model in the Roo Code settings. If different modes use different models, each of them must be in the allowlist. Add the address or the model to the key.
404 model_not_found
The model name is not one Cent AI serves. Copy the exact name from Models or GET /v1/models; names from other providers, such as gpt-4o-mini, are not aliases. A :free name works only for today's event model (see Free tokens daily); on any other model, including a previous day's event model, it returns 404.
429 rate_limited, key_limit_exceeded or project_budget_exceeded
rate_limited: more than 600 requests per minute on this key. Several tasks running at once on one key can reach it. Wait forRetry-After, or spread the work over several keys. See Rate limits.rate_limitedon a:freename: today's free pool is used up, or the event is off.Retry-Afterruns to 00:00 UTC; the model's own name stays available at its normal price.key_limit_exceeded: the daily or monthly limit you set on the key was reached.project_budget_exceeded: the budget of the key's project was reached.
501 not_available_yet
The endpoint is not open yet. Roo Code's chat provider only needs /v1/chat/completions, which is available. If codebase indexing is set to use Cent AI for embeddings, it gets 501: /v1/embeddings is not open yet.
Stream timeout
If a step stops with upstream_timeout or upstream_unavailable in the stream, see Stream timeout.