What LiteLLM adds
Give each developer a LiteLLM key for Cursor CLI. You can revoke gateway access, limit request rates, and keep request logs alongside the other tools that use your gateway.
Keep using your Cursor account
Sign in with Cursor and use the models available on your plan. Streaming replies, file reads, and tool follow-ups continue through the CLI. Cursor handles your subscription allowance and login refresh.
You do not need to add a model or save a Cursor credential on the proxy.
How to set it up
Available in 1.112. You need Cursor CLI, a Cursor subscription, and your LiteLLM gateway URL and key.
Sign in to Cursor
Run this once. Skip it if you are already signed in.
agent login
Enable HTTP/1.1
Add this setting to ~/.cursor/cli-config.json. Merge it with your existing configuration and keep the other settings.
{
"network": {
"useHttp1ForAgent": true
}
}
Start Cursor through LiteLLM
Set your gateway URL and virtual key, then run this command from your project directory. Use the gateway root URL without /v1.
The key must have no model restrictions, token limits, or spend budgets. Your administrator can issue a key that meets these requirements.
To save the command for daily use, see the shell function in the setup guide.
export LITELLM_PROXY_API_BASE="https://gateway.example.com"
export LITELLM_PROXY_API_KEY="sk-<your-litellm-virtual-key>"
agent \
--agent-endpoint "${LITELLM_PROXY_API_BASE%/}/cursor-cli" \
--header "x-litellm-api-key: Bearer $LITELLM_PROXY_API_KEY" \
--model auto
Check that it works
Ask Cursor to read a file that exists in your project. For a project with a README, try this prompt.
Read README.md with the read-file tool and summarize how to run this project. Do not change any files.
Confirm that the read tool completes and Cursor replies using the file’s contents. You can then ask a follow-up question in the same session.
In your LiteLLM request logs, look for calls under /cursor-cli. These logs show request status. Check Cursor’s reply to confirm the task itself succeeded.
Supported controls and limits
LiteLLM supports virtual keys, request logs, request-rate limits, and concurrency limits. Cursor manages your login, models, and subscription allowance.
LiteLLM forwards the native session without inspecting its contents. Token and spend tracking, model restrictions, and content guardrails are not supported. Keys or gateway configurations that require these controls are rejected.
Request-rate and concurrency limits apply to individual calls, rather than whole sessions. Allow overlapping requests so Cursor can send tool results while a response is streaming.
This setup is for Cursor CLI. The Cursor desktop integration uses models configured on your gateway. See the setup guide for troubleshooting and the full list of limits.
