Docs menu

Docs / Integrations

Use Cent AI with Cursor

Set Cent AI as Cursor's OpenAI base URL, paste your key and add a model by 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.

Cursor connects to Cent AI through its OpenAI API key setting, with the base URL https://api.cent-ai.dev/v1.

Prerequisites

  • A Cent AI account with balance. See Quickstart.
  • An API key from Keys. It looks like cai_<secret> and is shown once.
  • Cursor installed.

Configure Cursor

Open Cursor Settings and go to Models. Enter these values:

SettingValue
OpenAI API KeyYour key, cai_<secret>
Override OpenAI Base URLOn, with https://api.cent-ai.dev/v1
Custom modelglm-5.3, or another name exactly as listed by GET /v1/models
  1. Paste your key into the OpenAI API Key field.
  2. Turn on Override OpenAI Base URL and enter https://api.cent-ai.dev/v1. Keep /v1: Cursor adds the rest of the path.
  3. Add glm-5.3 as a custom model and make sure it is enabled.
  4. Save.

Things to know about this setting in Cursor:

  • Cursor sends your requests through its own servers, which then call Cent AI. The request reaches Cent AI from Cursor's addresses, not from your computer.
  • The base URL override applies to every OpenAI model in Cursor while it is on. Turn it off to go back to Cursor's own models.
  • Your key is used for chat. Tab completion keeps using Cursor's own models.

Test it

Check the key and base URL outside Cursor first. 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 open the chat panel in Cursor, pick glm-5.3 and send a message. Each turn appears on the Requests page of the dashboard with its tokens per rate and its cost. See Request cost.

Cache continuity

Cent AI keeps the turns of a conversation on the same route without any setting on your side. It uses the session signal Cursor sends when there is one; without it, Cent AI uses the stable start of the prompt, which Cursor resends on every turn. You do not add anything to your configuration for this.

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 is wrong, cut off, revoked, or a management key (cai_mgmt_…). Paste the key again into the OpenAI API Key field, without spaces around it.

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

  • ip_not_allowed: requests come from Cursor's servers, not from your computer, so an IP allowlist with your own address blocks them. Remove the IP allowlist from the key you use in Cursor and use a daily or monthly limit instead.
  • model_not_allowed: the key has a model allowlist without the model you picked. Add 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. Wait for Retry-After.
  • rate_limited on a :free name: today's free pool is used up, or the event is off. Retry-After runs 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. Cursor chat uses chat endpoints, which are available, so this usually means a wrong base URL.

Stream timeout

Long answers stream with : keepalive every 15 seconds. If an answer stops with upstream_timeout or upstream_unavailable, see Stream timeout.