Cursor Integration
Route Cursor IDE requests through LiteLLM for unified logging, budget controls, and access to any model.
Supported modes: Ask, Plan, Agent. Agent mode requires LiteLLM v1.97.0+, which 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.
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

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β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's model picker can emit thinking and fast variants of a model name, e.g. claude-opus-5-thinking. LiteLLM v1.97.0+ resolves these suffixes to the underlying model automatically, so key scopes and per-model budgets apply to the resolved model and you don't need separate model_list entries for the variants.
4. Testβ
Open Ask mode with Cmd+L / Ctrl+L and select your model.

Send a message. All requests now route through LiteLLM.

Connecting MCP Serversβ
You can also connect MCP servers to Cursor via LiteLLM Proxy.
For official instructions on configuring MCP integration with Cursor, please refer to the Cursor documentation here: https://cursor.com/en-US/docs/context/mcp.
-
In Cursor Settings, go to the "Tools & MCP" tab and click "New MCP Server".
-
In your
mcp.json, add the following configuration:
{
"mcpServers": {
"litellm": {
"url": "http://localhost:4000/everything/mcp",
"type": "http",
"headers": {
"Authorization": "Bearer sk-LITELLM_VIRTUAL_KEY"
}
}
}
}
- LiteLLM's MCP will now appear under "Installed MCP Servers" in Cursor.
Cursor Cloud Agentsβ
LiteLLM can also front the Cursor Cloud Agents API, so agents launched over api.cursor.com get the same credential management and logging. See Cursor Cloud Agents.
Troubleshootingβ
| Issue | Solution |
|---|---|
| Model not responding | Check base URL ends with /cursor and key has model access |
| Auth errors | Regenerate key; ensure it starts with sk- |
| Agent mode not working | Upgrade to LiteLLM v1.97.0+ and confirm the model supports custom API keys in Cursor |