Cursor → AI24X
Cursor can use any OpenAI-compatible endpoint. Point Models at AI24X for flash/pro (and VIP named models) with one key and PayPal USD top-up.
1) Prerequisites
Sign up → Console → create an API key → keep a small credit balance. Cursor desktop or latest IDE build.
2) Cursor Settings
- Open Cursor Settings → Models (or Features → Models, depending on build).
- Enable OpenAI API Key / custom OpenAI-compatible provider.
- OpenAI API Key: paste your AI24X key from Console.
- Override OpenAI Base URL:
https://api.ai24x.com/v1(include/v1, do not append/chat/completions). - Add or pick model id
flash(optional:pro,ultra). Save. - In Chat / Composer, select that model and send a short prompt (e.g.
hello).
3) Smoke test (terminal)
If Cursor returns an error, verify the key outside the IDE:
Expect HTTP 200 and a text reply in choices[0].message.content.
4) Pitfalls
- Base URL must end at
/v1. Extra/chat/completions→ 404/405. - 401 = bad, truncated, or rotated key—paste the full key from Console (no ellipsis), or create a new one.
- Start with flash; use pro for harder tasks; VIP ids (e.g. vip-kimi) need an active membership.
- Some Cursor builds cache the model list—toggle the custom key off/on after changing Base URL.
Choosing what to route through the gateway
You do not have to move everything at once. Many teams keep their existing setup for everyday edits and route the heavy work — long-context refactors, agent runs, batch questions — through the gateway key. The tier stays a per-conversation choice: flash for quick lookups, pro when the answer has to hold up.
Because both tiers share one key and one base URL, switching a conversation from flash to pro is a dropdown change, not a configuration change.
Troubleshooting order
- Run the smoke test above — a 200 there means the key and base URL are already correct.
- Confirm the Base URL ends at
/v1with nothing appended. - Re-paste the full key; a truncated key copied with an ellipsis is the classic 401.
- Toggle the custom key off and on so Cursor re-fetches the model list.
- Restart Cursor if the model list still looks stale.
Gateway guides: What is an AI gateway · OpenAI-compatible API · Pricing · Start free