Cursor Integration
Route Cursor IDE requests through LiteLLM for unified logging, budget controls, and access to any model. To connect Cursor to MCP tools, use the direct-client URL and headers in the MCP Configuration Reference
Supported modes: Ask, Plan, Agent. With the base URL override, agent mode works Since v1.97.0 because LiteLLM translates the Responses API request shapes Cursor's agent sends to the chat completions path. Cursor gates custom API keys by mode and model on its side, so coverage follows what Cursor enables.
Cursor documents LLM gateway network configuration. The setup below uses its custom OpenAI base URL. The Cursor CLI uses a separate native relay, see Cursor CLI.
Newer Cursor builds no longer show the Override OpenAI Base URL setting on every plan. If your Cursor does not have it, use the Azure OpenAI fallback below instead of the setup in this section.
Quick Reference
| Setting | Value |
|---|---|
| Base URL | <LITELLM_PROXY_BASE_URL>/cursor |
| API Key | Your LiteLLM Virtual Key |
| Model | Public Model Name from LiteLLM |
Setup
1. Configure Base URL
Open Cursor → Settings → Cursor Settings → Models.

Enable Override OpenAI Base URL and enter your proxy URL with /cursor:
https://your-litellm-proxy.com/cursor
The proxy must be reachable from the internet: Cursor sends the requests from its own servers, not from your machine, with User-Agent: Cursor/1.0. A proxy behind a VPN or an IP allowlist, or on a private address, fails from Cursor's side before any request reaches LiteLLM; Troubleshooting lists what Cursor shows in each case.

2. Create Virtual Key
In LiteLLM Dashboard, go to Virtual Keys → + Create New Key.

Name your key and select which models it can access.

Click Create Key then copy it immediately, since you won't see it again.

Paste it into the OpenAI API Key field in Cursor.

3. Add Custom Model
Click + Add Custom Model in Cursor Settings.

Get the Public Model Name from LiteLLM Dashboard → Models + Endpoints.

Paste the name in Cursor and enable the toggle.

Cursor rejects a custom model whose name matches one of its built-in models with The model "X" is already available as "Y". Cursor runs this check locally, before any request reaches LiteLLM. Add a model_list entry with a distinct public model name for the same deployment and use that name in Cursor:
model_list:
- model_name: litellm-claude-sonnet-5
litellm_params:
model: anthropic/claude-sonnet-5
Cursor's model picker can emit thinking and fast variants of a model name, e.g. claude-opus-5-thinking-high or claude-opus-5-fast. Since v1.97.0 LiteLLM strips a trailing -fast and a -thinking-<effort> suffix, where <effort> is a reasoning_effort value (none, minimal, low, medium, high, xhigh, max) that LiteLLM forwards as the request's reasoning effort unless the request already sets one. Key scopes and per-model budgets apply to the resolved model, so you don't need separate model_list entries for these variants. A bare -thinking suffix with no effort level, e.g. claude-opus-5-thinking, is not resolved and returns Invalid model name unless it has its own model_list entry
4. Test
Open Ask mode with Cmd+L / Ctrl+L and select your model.

Send a message. All requests now route through LiteLLM.

Fallback: Azure OpenAI settings
If your Cursor build has no Override OpenAI Base URL setting, Cursor's Azure OpenAI settings still accept a custom base URL and route traffic to your LiteLLM proxy. This path uses LiteLLM's Azure-compatible /openai/deployments/<deployment>/chat/completions route, which has been in LiteLLM since 2023, so it needs no proxy upgrade. Ask, Plan, and Agent modes all work over it (verified on Cursor 3.17.21); Cursor's Azure client sends plain chat completions requests for agent mode too, so the v1.97.0 requirement from the base URL override path does not apply here.
| Setting | Value |
|---|---|
| Base URL | <LITELLM_PROXY_BASE_URL> (no /cursor suffix) |
| Deployment Name | Public Model Name from LiteLLM |
| API Key | Your LiteLLM Virtual Key |