Cursor
Connect Cursor chat to a Runtoken endpoint.
Prerequisites#
Before you start, prepare:
- An installed Cursor editor and a small test project.
- A Runtoken platform API key.
- An OpenAI Chat-compatible model ID eligible for custom-key use in the client.
Set the endpoint and model#
Open Cursor Settings → Models, then expand API Keys. Use the OpenAI-compatible configuration controls below; this does not require an OpenAI-issued key.
| Setting | Value or action | Purpose |
|---|---|---|
| OpenAI API Key | YOUR_PLATFORM_KEY | Runtoken credential. |
| Use OpenAI API Key | Enable | Uses the supplied key for eligible requests. |
| Override OpenAI Base URL | Enable | Routes eligible requests to the custom endpoint. |
| Base URL | https://api.runtoken.net/v1 | API prefix, without /chat/completions. |
| Custom model ID | YOUR_MODEL_ID | Exact model identifier from the platform catalogue. |
Replace YOUR_PLATFORM_KEY and YOUR_MODEL_ID with your platform credential and chosen model ID. Do not put the key into the model name or send it in chat. Control labels can vary by editor version; both the custom key and address must be active.
Save the settings, restart Cursor, open a new chat and explicitly select the custom model. Do not use automatic model selection to establish which endpoint is being called.
If the API-key section is missing or disabled, check your team's personal-key policy with its administrator. Creating another custom model does not override a team restriction.
Check chat and editing#
First ask for a short explanation of the test directory. Find the matching request in Runtoken and check the model and time. A successful key-verification button does not prove that the next chat uses the intended model.
Then ask for the following change using a chat mode that supports file edits.
Create greeting.py with greet(name), returning "Hello, " plus name.
Show the proposed change. Do not install packages or use the network.Review and apply the intended edit, then ask for an empty name to return "Hello, friend". Inspect the real file and corresponding requests. If editing is unavailable for this model or mode, do not treat a text answer as an applied change.
Feature and data boundaries#
A custom endpoint applies to eligible model requests, not every feature in the editor.
| Area | Boundary |
|---|---|
| Chat models | Must support custom API keys in Cursor and the protocol offered by Runtoken. |
| Tab completion and Cursor-specific models | Continue to follow Cursor's own feature and model rules. |
| Model selection | Being visible in the picker does not establish custom-key compatibility. |
| Request path | Custom-key requests still pass through Cursor's servers for final prompt construction. |
A custom base URL is not a promise of direct device-to-gateway traffic. Review Cursor's data policies together with your gateway requirements before using private project content. A custom key also does not remove any applicable Cursor plan charges or replace platform inference billing.
Troubleshooting#
Check the selected chat model before changing the endpoint or key.
| Symptom | What to check |
|---|---|
| API-key controls are hidden | Team policy and current editor settings. |
| Model does not support custom API keys | Choose an eligible model; an arbitrary rename does not add protocol support. |
401 or rejected model | Whether the key toggle is enabled, the ID is exact and the model is allowed. |
404 | Effective base URL and actual request path; avoid adding /v1 twice. |
| Chat works but another editor feature fails | Whether that feature supports the selected custom-key model. |
| Local curl works but Cursor cannot connect | Network reachability from Cursor's request path, not only from your terminal. |
Restore and next steps#
To return to the previous setup, restore the original key and base-URL controls and select your previous model. Remove only the custom entries you added.
See OpenAI Chat and Cursor's API-key guide.