Direct answer
Point Cursor at the CodeNodex OpenAI-compatible endpoint and confirm the setup actually took, using a model-list request, a minimal task, and a few targeted error codes.
What this guide helps you solve
Answers a few common questions: where the custom API key goes in Cursor, whether the Base URL needs `/v1`, whether the CodeNodex CLI can edit Cursor for you, and how to track down 401, 404, or unavailable-model errors.
What the CLI can and can’t do for you
Cursor keeps custom keys in its own settings, so the CodeNodex CLI can’t safely write there. --client cursor does two things: it validates your key, and it prints the Base URL, key, and provider hints you’ll need to enter by hand.
First, create a key in a CodeNodex OpenAI group. Use the model ID that key can actually see — don’t grab a display name off the web UI and pass it as the request parameter.
codenodex login -o "https://token.codenodex.com"
codenodex setup --client cursorEnter the key and Base URL in Cursor
Open Cursor Settings and find the Models or API Keys section. Turn on the custom OpenAI API key, paste your CodeNodex key, and set Override OpenAI Base URL to https://token.codenodex.com/v1.
Menu names vary between Cursor versions, but three values are constant: the OpenAI provider, a Base URL ending in /v1, and a real model ID that exists in your key’s group.
- 01Pick a providerChoose OpenAI, or whatever entry accepts a custom OpenAI API.
- 02Set the endpointBase URL is
https://token.codenodex.com/v1— don’t append/chat/completionsyourself. - 03Save the keyPaste your own API key.
YOUR_API_KEYin these docs is just a placeholder. - 04Pick a modelEnter an exact model ID from the model list, then save and enable it.
curl /v1/models first
Before you run anything inside Cursor, hit the model list directly. That keeps “is the gateway authenticating me?” separate from “did I set up Cursor’s models right?”
A successful response only proves the key and Base URL work. You still need to confirm the model ID you want to use actually shows up in that response.
curl --fail-with-body "https://token.codenodex.com/v1/models" -H "Authorization: Bearer YOUR_API_KEY"Run a minimal task and confirm it really used your key
Open a throwaway directory in Cursor, pick the model you just configured, and hand it one low-risk task with an easy-to-check result — explain a function, or add one unit test to a pure function.
Check three things at once: the model selector, whether the response came back complete, and the CodeNodex usage log. All three have to line up before you can rule out Cursor silently falling back to another provider.
- The model selector shows the ID you entered.
- A matching call shows up in CodeNodex usage after the task runs.
- The config is still there after you close and reopen Cursor.
401 / 404 / 429 / timeout: what each means
A 401 usually means the key is wrong or disabled. A 404 usually means /v1 got appended twice, the model ID doesn’t exist, or the endpoint path doesn’t match. A 429 means check your balance, concurrency, or upstream limits.
If curl works but Cursor doesn’t, recheck Override OpenAI Base URL and make sure two competing providers aren’t both enabled. On timeouts, shorten the prompt and retry before blaming the network or the model.
Official sources and verification scope
This guide is based on public official documentation. Commands and configuration may change between client versions, so verify the linked sources before use.
Read the verification methodology