Cursor can use a LiteLLM proxy as an OpenAI-compatible endpoint, letting a team route supported model requests through a centrally managed service. Configure LiteLLM with a model and API key, then point Cursor at the proxy’s reachable base URL; if requests fail, check the endpoint, model name, authentication, and network path first.
How Cursor and LiteLLM fit together
Cursor is an AI coding editor with settings for connecting to models and, in supported configurations, custom OpenAI-compatible providers. LiteLLM is a gateway that can expose configured language models through a common API, apply routing and authentication, and forward requests to provider backends. In this arrangement, Cursor is the client, LiteLLM is the intermediary, and the underlying provider or self-hosted model supplies responses.
This does not mean every Cursor feature automatically works with every LiteLLM model. Cursor may use different request patterns or capabilities for chat, code completion, embeddings, and other features. A model that answers a basic chat request through the proxy may not support every feature Cursor expects. Check current Cursor documentation for custom-model support and the capabilities required for the feature you intend to use.
Configure LiteLLM first
Before changing Cursor settings, make sure LiteLLM itself can reach its backend. A minimal proxy configuration identifies a public model name and the provider model it should route to. The exact fields vary by LiteLLM version and provider, so use the current LiteLLM configuration reference rather than copying an old configuration blindly.
- Choose a backend model and configure its provider credentials in the environment or secrets manager used by the LiteLLM process. Avoid putting real keys in a shared configuration file.
- Define a LiteLLM model entry with a public name that clients can request and the provider-specific model identifier and settings needed by that backend.
- Start the proxy using the configuration file and confirm it reports that it is listening. Bind it to an address reachable by Cursor’s machine; a service bound only to localhost cannot be reached from another computer.
- Set proxy authentication if the service is exposed beyond a trusted local environment. Keep the client-facing proxy key separate from provider keys where the deployment supports that separation.
- Test the proxy independently with an API client or a compatible command-line request before configuring Cursor. Use the proxy’s documented base URL and model identifier.
For example, a local proxy might be reachable at http://localhost:4000, while a hosted proxy might use an HTTPS address on an organization’s domain. These are examples, not universal URLs: use the actual host, port, and route shown by your deployment. Some OpenAI-compatible clients expect a base URL ending in /v1; others append API paths themselves. Follow the current Cursor and LiteLLM instructions to avoid accidentally producing a duplicated or missing path.
Point Cursor at the proxy
In Cursor, open Settings and find the model or provider controls for custom OpenAI-compatible models. Labels and availability can change between releases, so search Settings for “OpenAI,” “API key,” or “base URL” if the exact menu wording differs. Enter the LiteLLM proxy URL as the custom base URL, provide the client-facing key if authentication is enabled, and add the public model name configured in LiteLLM.
- Use the proxy model alias, not necessarily the backend provider’s model name.
- Use the proxy’s client key, not a provider key, unless your setup explicitly requires otherwise.
- Do not add a trailing path or version segment by guesswork; match the endpoint format expected by the current Cursor setting.
- Save the settings and select the custom model for a small test prompt.
If Cursor offers a control to enable custom models or an OpenAI-compatible provider, turn it on as directed by its current interface. A successful connection test is useful, but it does not prove all model features will work. Test the actual workflow—such as a short chat or code question—without including confidential source code until you understand where requests are processed and logged.
Diagnose common connection errors
Start by identifying which component returns the error. Cursor’s message, LiteLLM proxy logs, and provider logs can distinguish a client configuration problem from an upstream failure. Compare timestamps and request IDs where available, but do not post secrets or sensitive prompts in public support channels.
- Connection refused or timeout: Confirm the proxy is running, the host and port are correct, and any firewall or network policy permits access. If Cursor runs on a different machine or inside a container, its “localhost” may refer to that machine or container—not the proxy host.
- 401 or 403: Check whether authentication is enabled and whether Cursor has the correct proxy key. A valid provider key does not automatically authenticate to a protected LiteLLM proxy.
- 404 or model not found: Confirm the configured model alias matches the LiteLLM model name exactly and that the request is going to the intended API route. Check that the model is loaded in the active proxy configuration.
- Provider or upstream error: The proxy may be reachable while its backend credentials, provider account, model identifier, or provider availability is wrong. Inspect LiteLLM’s upstream error details without exposing credentials.
- Works in chat, fails in another feature: The feature may require a capability or endpoint the selected model or compatibility layer does not provide. Try a supported model and consult both products’ current feature requirements.
- Streaming or response-format problems: Client and backend support can differ. Test a simple non-sensitive prompt, check proxy logs and compatibility settings, and avoid assuming that OpenAI-compatible means identical behavior.
After changing a configuration, restart or reload the proxy if required so it uses the updated settings. Then retry with a minimal request. Changing several settings at once makes it harder to tell which change fixed the issue.
Security, reliability, and limits
A proxy centralizes routing, but it also becomes a service that must be protected and maintained. Use HTTPS for traffic that crosses an untrusted network, restrict access to the proxy, rotate exposed credentials, and store keys in an appropriate secret-management mechanism. Review LiteLLM’s logging and retention settings, plus the policies of the underlying model provider, before sending proprietary code or other sensitive data.
Keep Cursor, LiteLLM, and model configuration aligned as they evolve. Compatibility can change with application updates, provider API changes, or LiteLLM releases. Pinning and testing versions may help a managed deployment remain predictable, but upgrades should still be reviewed. A proxy can centralize model selection and credentials; it cannot guarantee that a provider is available, eliminate model limitations, or make unsupported Cursor features work.
Frequently Asked Questions
Can I use LiteLLM with Cursor?
Yes, when your Cursor version and selected feature support a custom OpenAI-compatible endpoint and the LiteLLM proxy exposes a compatible API. Verify support in current documentation and test the specific workflow.
What base URL should I enter?
Enter the URL where Cursor can reach your LiteLLM proxy, with the path format expected by Cursor’s custom-provider setting. A local example is http://localhost:4000, but hosted deployments use their own address and may require an API path.
Which model name belongs in Cursor?
Use the public model name or alias defined in the active LiteLLM configuration. It can differ from the provider’s internal model identifier.
Why does the proxy work in an API test but not Cursor?
Cursor may be using a different URL path, authentication value, model name, or request feature. Compare the successful test’s endpoint and model with Cursor’s settings, then inspect proxy logs for Cursor’s request.
Does LiteLLM make every model feature available in Cursor?
No. Compatibility depends on the Cursor feature, LiteLLM’s supported routes, and the model backend’s capabilities. Basic chat success does not guarantee code completion or other specialized features will work.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Delete Picture Kik? How to Remove Photos
- What Happens to X Replies, DMs, and Followers After Deletion?
- Data Breaches That Shook the World
- Disable Google Assistant: Turn It Off on Android & Home
- Resin vs FDM Printers for Miniatures: Detail, Durability, Cost
- Are Networked Implants Safe? What If One Fails?