# Cursor

Cursor can send its chat requests to an OpenAI-compatible endpoint when you give it your own API key and base URL. The Model API answers them at `POST /v1/chat/completions`. Cursor keeps these settings in its own window, not in a file, so the setup is a few clicks. The model is `auto`, which picks a model of the catalogue for the conversation.

## What the override covers

Cursor's **Override OpenAI Base URL** applies to every OpenAI-format request and speaks only Chat Completions.

| Cursor model | Goes through the Model API? |
| --- | --- |
| Model names you add yourself, `auto` among them | Yes |
| Cursor's own OpenAI models | Yes, while the override is on |
| Cursor's own Claude, Gemini, Grok and Composer models | No, they stay on Cursor's backend |
| Tab autocomplete, Apply and inline edit | No, they stay on Cursor's backend |

Cursor sends a request with a custom base URL from its own servers: the Model API key and the prompts pass through Cursor's backend, as with any key of your own in Cursor.

## 1. Create a key

In the [developer console](https://console.samreshuuu.ru), open API keys, keep **Model API key** in the **Access** field and create the key. Copy it: the secret is shown once.

## 2. Configure Cursor

1. Open Cursor Settings (`Cmd+Shift+J` on macOS, `Ctrl+Shift+J` elsewhere), go to **Models** and expand **API Keys**.
2. Paste the key into **OpenAI API Key** and turn on **Use OpenAI API Key**.
3. Turn on **Override OpenAI Base URL** and set it to `https://api.samreshuuu.ru/v1`.
4. With **Add or search model**, add `auto`, and any other id from the [Models](/models) page typed exactly as `GET /v1/models` lists it.
5. Pick the model in the chat's model picker.

You add the models yourself, so a new model of the catalogue does not appear in Cursor until you add it the same way.

## 3. Check the connection

Send a prompt in the chat on `auto`. The call shows up in the call log of the [console](https://console.samreshuuu.ru) with the model `auto` picked and its cost. Tools of the agent mode travel as OpenAI functions; a reasoning level Cursor sends goes on as `reasoning_effort`.

## Undo the setup

On the same settings page, turn off **Use OpenAI API Key** and **Override OpenAI Base URL**, or put back the key and address you had before, and remove the models you added.

## Troubleshooting

| What you see | What to check |
| --- | --- |
| "Invalid API key" | The key was pasted wrong or revoked. Check it under API keys in the console. |
| Cursor cannot find the resource | Cursor got a `404` from the address. The address ends in `/v1` with nothing after it. |
| Cursor says the model does not exist | The id is misspelled or not in the catalogue: copy it from `GET /v1/models`. |
| A request on `auto` never reaches the call log | Cursor took the name for a model of its own: check that the override is on, then remove and add `auto` again. |
| Requests go to OpenAI | **Override OpenAI Base URL** is off, or the address has no `/v1`. |

| HTTP | type | Code | message | Retry |
| --- | --- | --- | --- | --- |
| 401 | `authentication_error` | `invalid_api_key` | The API key is unknown, disabled, revoked or expired. Switch a disabled key back on in the developer console; create a new one in place of a revoked or expired key. | no |
| 404 | `not_found_error` | `model_not_found` | The model does not exist. GET /v1/models lists the models this API sells. | no |
| 400 | `invalid_request_error` | `no_auto_model` | No model meets the request for auto. | no |
| 402 | `billing_error` | `insufficient_balance` | The organization balance does not cover this request (max_tokens is held in full until the answer is settled). Top up the balance or lower max_tokens. | no |
| 402 | `billing_error` | `key_limit_exceeded` | This API key has reached its spending limit. Raise the limit or use another key. | no |

If an error persists, write to support with the `x-request-id` of the answer.
