Cursor
Connect supported custom chat models in Cursor, with setup steps and known limitations.
On this page
Set it up with your coding agent #
Paste your key into the prompt's key field, then copy the prompt into Claude Code, Codex, Cursor, or any coding agent. It configures the tool and keeps testing until a real request goes through RouterPlex, fixing environment problems along the way. Prefer to do it by hand? Follow the manual setup below; your key fills those commands too.
Optional. It stays in this browser tab and is never saved or sent. No key yet? Create one in guided setup.
Set up Cursor on this machine to use RouterPlex, an OpenAI- and Anthropic-compatible AI gateway. Keep working until a real request from Cursor succeeds through RouterPlex.My RouterPlex API key: YOUR_ROUTERPLEX_API_KEYKey handling:- If the key line above is a placeholder rather than a real key (real keys start with sk-), use my ROUTERPLEX_API_KEY environment variable. If that is empty too, ask me for the key once, then continue.- Store the key only in user-level config or my user environment. Never put it in a project file, never commit it, and do not repeat the full key in your replies.Full guide: https://docs.routerplex.com/cursorStep 1. Prove the key and the RouterPlex gateway work before changing anything else. Run:curl -sS https://api.routerplex.com/v1/chat/completions -H "Authorization: Bearer YOUR_ROUTERPLEX_API_KEY" -H "Content-Type: application/json" -d '{"model":"claude-sonnet-4-6","max_tokens":32,"messages":[{"role":"user","content":"Reply with exactly: RouterPlex connected."}]}'On Windows PowerShell, use curl.exe with the body in a file, or Invoke-RestMethod.- A reply containing "RouterPlex connected.": go on.- 401: the key is wrong or revoked. Stop and ask me for a correct key.- 402: my balance or trial credit is used up. 403: this key reached its own spending limit. Stop and tell me; retrying cannot fix these.- Network, DNS, TLS, or proxy errors: find and fix the cause (proxy variables, VPN, firewall, system clock, outdated CA certificates), then run it again.Step 2. Configure Cursor:- Cursor keeps these settings in its own app storage, so I have to enter them. Tell me to open Cursor Settings → Models, then:OpenAI API Key: <key>Override OpenAI Base URL: https://api.routerplex.com/v1 (turn the override on)Add model: claude-sonnet-4-6 (exact ID), then select it in a new chat- Cursor Tab and Cursor's bundled models always use Cursor's own servers; only the custom model goes through RouterPlex.Step 3. Test Cursor itself from a new terminal or a restarted app, so you test the saved setup rather than the shell you changed:Ask me to send this in a new chat with the custom claude-sonnet-4-6 model selected, and report the reply: Reply with exactly: RouterPlex connected.If Cursor rejects the model, check that I updated Cursor, that the override is on, and that the custom model (not a bundled one) is selected.Expected reply: "RouterPlex connected."Step 4. If step 1 works but step 3 fails, the problem is Cursor's configuration or environment, not RouterPlex. Check these, fix what is wrong, and repeat step 3:- The key or base URL is set in one place but not where Cursor starts: zsh vs bash startup files, login vs non-login shells, a desktop launcher, a background service, Windows vs WSL, or a remote SSH or container environment.- Another setting wins: OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_API_BASE, ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, or a project-level config that overrides the user-level one.- Cursor is outdated, or still needs a full restart to read the new settings.- If an environment variable cannot be made to reach Cursor reliably and Cursor accepts a key in its user-level config, put the key there instead.Keep repeating steps 3 and 4 until the test reply comes back. Stop early only for a 401, 402, or 403, or for a step only I can do, such as a click in a settings window or a login. Then tell me exactly what to do, wait for me, and continue testing afterwards.When it works, tell me which files you changed, where the key is stored, and the final test output.
Manual setup #
Connect supported Cursor chat models to RouterPlex using Cursor's OpenAI base URL override. Use the same settings on macOS, Linux, and Windows.
Cursor controls which models and features work with custom keys. A RouterPlex model being available through the API does not guarantee that Cursor accepts it. Tab completion and bundled Cursor models use Cursor's own backend.
1. Install or update Cursor #
Download the current build for your OS from Cursor. Create a dedicated RouterPlex key in guided setup.
2. Add the provider settings #
- Open Cursor Settings → Models and find API Keys or the OpenAI provider settings.
- Paste your RouterPlex key into OpenAI API Key.
- Enable Override OpenAI Base URL if your build exposes it, and use the values below.
OpenAI API Key: YOUR_ROUTERPLEX_API_KEYOverride OpenAI Base URL: https://api.routerplex.com/v1Custom model: claude-sonnet-4-6
- Save the key/settings. Add the model ID verbatim with Add model, then select that custom model in a new chat.
- If your build has a Verify action, use it, but also send a real chat message to confirm the selected model.
3. Verify #
Send Reply with exactly: RouterPlex connected. Do not read files or run tools. and confirm the request appears in Usage under your Cursor key.
Cursor routes requests through its servers for prompt construction, so the endpoint must be publicly reachable. A localhost endpoint on your machine will not work through that path.
If Cursor rejects the setup #
Update Cursor and check that the override and custom model are actually selected. Model support can differ by release, account policy, and feature. Cursor's official BYOK page documents restrictions on OpenAI models and chat-only usage. If the override is missing or the model is rejected, use OpenCode, Cline, or the SDK with the same RouterPlex key.
For stalled requests, check Cursor's network diagnostics and HTTP compatibility settings. Keep the key in Cursor's settings rather than a project file.
A longer walkthrough of the same override is in Cursor: override the OpenAI base URL.
Official reference: Cursor API keys and limitations.