BestLLMfor EN Your hardware. Your LLM. Your call.
FRQuelLLM.fr
Guide · 2026-05-16

Use Your Own Local LLM in Cursor — BYO Model Setup

A verdict-driven 2026 guide to wiring a local model into Cursor, with throughput numbers, the LiteLLM proxy pattern, and the hardware that actually keeps up.

By Mohamed Meguedmi · 11 min read

Key takeaways

  • Cursor only accepts OpenAI-compatible endpoints over HTTPS. Pointing it at http://localhost:1234 will silently fail — you need a tunnel (ngrok, Cloudflare Tunnel, or Tailscale Funnel) or a reverse proxy with a real TLS cert.
  • Tab completion, Agent mode, and Composer stay cloud-only. BYO models work in Chat and inline edits (Cmd+K), but Cursor's autocomplete is a proprietary fine-tune that cannot be swapped.
  • Qwen3-Coder 30B-A3B at Q4_K_M is the 2026 sweet spot — 18 GB VRAM, 95+ tokens/sec on a single RTX 4090, and within 4 points of GPT-4.1 on SWE-bench Verified.
  • Wrap your backend in LiteLLM, not raw Ollama. It normalizes streaming, fixes the tool_calls schema Cursor expects, and lets you hot-swap LM Studio, Ollama, vLLM, or MLX without touching Cursor settings.
  • Expect 30-60% of cloud productivity on a well-tuned local stack. The win is privacy, offline work, and zero per-token cost — not raw speed.

Cursor has shipped four major releases since the BYO model feature first appeared, and the integration story in 2026 is finally stable enough to recommend. This guide walks the editorial team's tested setup: which models to run, which backend to pick, how to expose it to Cursor without leaking traffic, and what to expect from each tier of hardware. If you are budgeting GPUs for this, the BestLLMfor cost calculator models the break-even point against a Cursor Pro subscription.

What Cursor actually lets you replace

The most common misconception in the SERPs is that BYO mode turns Cursor into a fully local IDE. It does not. Cursor's architecture splits into three planes:

FeatureBYO local model supported?Notes
Chat panel (Ask)YesFull streaming, system prompts, file context.
Inline edit (Cmd+K / Ctrl+K)YesWorks with any model that streams diffs cleanly.
Agent mode / ComposerPartialRequires reliable tool_calls; only Qwen3-Coder, DeepSeek-V3.2, and GLM-4.6 are dependable.
Tab autocompleteNoProprietary Cursor model. Cannot be swapped.
Bug Finder, Background AgentsNoServer-side, runs on Cursor's infrastructure only.
Codebase indexing / embeddingsNoEmbeddings still go to Cursor's servers unless Privacy Mode + manual context.

If your goal is total air-gap operation, Cursor is the wrong tool — use Continue.dev, Cline, or Zed with a local backend instead. If you want to keep Cursor's UX and offload reasoning to your own model, read on.

The reference architecture

After testing a dozen permutations, the editorial team settled on a four-layer stack that survives Cursor's quirks:

  1. Inference backend — LM Studio (Mac), Ollama (cross-platform), or vLLM (Linux multi-GPU).
  2. Normalization layerLiteLLM proxy, listening on localhost:4000, exposing a clean /v1/chat/completions surface.
  3. Tunnel / TLS termination — Cloudflare Tunnel for a stable URL, ngrok for ad-hoc sessions, or Tailscale Funnel for team setups.
  4. Cursor — pointed at the HTTPS URL with the model name registered in Settings → Models.

Why LiteLLM in the middle? Cursor expects strict OpenAI Chat Completions semantics. Ollama's native API and LM Studio's older builds both diverge on streaming tool calls and on the finish_reason field for parallel tool calls. LiteLLM patches all of this and adds request logging — invaluable when Agent mode silently breaks.

Picking the right local model

The 2026 lineup has consolidated. Three families dominate Cursor BYO use, and the choice depends almost entirely on VRAM:

ModelQuantVRAMTok/s (RTX 4090)SWE-bench VerifiedCursor Agent compatible
Qwen3-Coder 30B-A3BQ4_K_M18 GB9562.4%Yes
Qwen3-Coder 480B-A35BQ4_K_M270 GB14 (4× H100)69.6%Yes
DeepSeek-V3.2-Coder 236BQ4_K_M140 GB22 (2× H100)67.1%Yes
GLM-4.6 Air 106BQ4_K_M62 GB38 (RTX 6000 Ada)58.9%Yes
Codestral 22B 2025.11Q5_K_M16 GB7849.2%Partial
Llama 3.3 70B InstructQ4_K_M42 GB2644.8%Partial

The verdict for most readers: Qwen3-Coder 30B-A3B Q4_K_M. It fits on a single RTX 4090 or a 32 GB Mac, ships with a 256K context that Cursor will actually fill, and its mixture-of-experts routing means active parameters stay around 3B — that is why throughput beats dense 22B models. Pull it from the official Qwen3-Coder model card on Hugging Face or via ollama pull qwen3-coder:30b-a3b-q4_K_M.

What to avoid

  • Anything below 13B parameters. They hallucinate tool arguments and break Agent mode within five turns.
  • Aggressive quantization (Q2, Q3). The SWE-bench drop is 8-12 points, and Cursor's prompts are long enough that you will feel it immediately.
  • Base (non-Instruct) models. Cursor's prompts assume a chat template.

Step-by-step: LM Studio + LiteLLM + ngrok

This is the path with the fewest moving parts and works identically on macOS, Windows, and Linux.

1. Serve the model

Install LM Studio 0.3.18 or later, load qwen3-coder-30b-a3b-instruct-q4_k_m.gguf, and enable the local server in the Developer tab. Confirm CORS is on and that the endpoint responds:

curl http://localhost:1234/v1/models

2. Stand up LiteLLM

Create litellm.yaml:

model_list:
  - model_name: cursor-local
    litellm_params:
      model: openai/qwen3-coder-30b-a3b
      api_base: http://localhost:1234/v1
      api_key: lm-studio

general_settings:
  master_key: sk-local-cursor-2026
  drop_params: true

Run it: litellm --config litellm.yaml --port 4000. The drop_params: true line silently discards Cursor parameters that LM Studio rejects (such as logit_bias on some builds) and is the single most common fix for the "empty response" bug reported on the Cursor forum.

3. Expose over HTTPS

Cursor refuses plain HTTP. Pick one:

  • ngrok (quickest): ngrok http 4000. Copy the https://*.ngrok-free.app URL.
  • Cloudflare Tunnel (stable URL, free): cloudflared tunnel --url http://localhost:4000.
  • Tailscale Funnel (best for team or always-on): tailscale funnel 4000.

4. Wire it into Cursor

Open Cursor → Settings → Models. Disable all OpenAI models you do not want as fallbacks. In the OpenAI API Key section:

  • Override OpenAI Base URL: paste the HTTPS URL with /v1 appended (e.g. https://abc-123.ngrok-free.app/v1).
  • API Key: sk-local-cursor-2026 (the LiteLLM master key).
  • Click Verify. If it fails, check LiteLLM's terminal — 99% of failures are a missing /v1 suffix or CORS disabled in LM Studio.
  • Add a custom model named exactly cursor-local (matching the LiteLLM model_name).

Open the Chat panel, select cursor-local, and send a prompt. First token should appear in under two seconds on a 4090.

Hardware reality check

The single most useful number when planning hardware is tokens per second under a realistic Cursor prompt (8K input, 1K output, streaming). Synthetic single-turn benchmarks lie. The editorial team measured the following on Qwen3-Coder 30B-A3B Q4_K_M:

HardwareApprox. cost (USD, 2026)Tok/sTime-to-first-tokenCursor usability
Apple M4 Max 64 GB (MLX)$3,500721.1 sExcellent
Apple M3 Ultra 96 GB (MLX)$5,2001180.7 sExcellent
RTX 4090 24 GB (llama.cpp)$1,900 (GPU only)950.6 sExcellent
RTX 5080 16 GB$1,200620.9 sGood (offload required)
RTX 4070 Ti Super 16 GB$800481.4 sGood
RTX 3060 12 GB$300 (used)144.2 sPainful — use a 14B model instead

Below 40 tok/s, Cursor's streaming UI starts to feel laggy compared to GPT-5 or Claude Sonnet 4.6. Above 80 tok/s, the gap closes. The detailed benchmarking methodology behind these numbers — prompt construction, warmup, and percentile reporting — is published on the methodology page.

Privacy, billing, and the cloud asterisks

A local backend does not make Cursor itself local. Per the Cursor Privacy documentation, the following still leaves your machine even in BYO mode:

  • Codebase embeddings (unless Privacy Mode is on, in which case indexing is disabled entirely).
  • Telemetry and usage events.
  • Anything routed through Agent mode that calls a Cursor-hosted tool.

If absolute locality is the requirement, run the open-source quelllm-mcp server for tools and use the same model from Continue.dev or Zed. The BestLLMfor public API (CC BY 4.0) ships current model leaderboards you can pipe into your own tooling — useful when picking the next model to swap in.

Billing note

Cursor still counts your BYO requests as "requests" against the free tier limit (50/month at last check) unless you have a Pro subscription. BYO does not unlock unlimited usage; it unlocks private usage. Confirm against your account at cursor.com/settings before assuming you can cancel Pro.

Troubleshooting the four most common failures

  • "Verify" hangs forever. Cursor caches a bad URL. Quit fully (Cmd+Q, not just close window), restart, re-paste URL with /v1.
  • Agent mode returns empty messages. Your backend is not streaming tool_calls with the OpenAI-compliant index field. Upgrade LiteLLM to 1.52+ and set drop_params: true.
  • Cursor falls back to GPT-4.1. You left an OpenAI model enabled. Toggle off every non-local model in Settings → Models.
  • Throughput collapses after ~30K tokens. KV cache is spilling to system RAM. Reduce context window in LM Studio to 64K, or upgrade VRAM.

Verdict — when BYO in Cursor is worth it

Use caseRecommendationWhy
Privacy-bound code (regulated industries, IP-sensitive)BYO Qwen3-Coder 30B + Privacy ModeReasoning stays local; disable indexing.
Offline / travel / spotty connectivityBYO via Tailscale to home boxCursor still needs internet for auth; tab autocomplete will be unavailable.
Cost-cutting solo developerStick with Cursor Pro ($20/mo)Hardware ROI takes 18+ months even on a used 4090.
Team of 5+ with shared GPU servervLLM + LiteLLM + Tailscale FunnelPooled throughput beats per-seat Pro at scale.
Maximum coding qualityStay on cloud (GPT-5, Claude Sonnet 4.6)No 30B local model matches frontier coding accuracy yet.

The honest position: Cursor BYO is excellent for privacy and offline work, mediocre as a cost play, and not a substitute for frontier models on hard tasks. Set realistic expectations, run Qwen3-Coder 30B-A3B behind LiteLLM, and you will get a setup that handles 70-80% of daily coding work without a single token leaving your network.

FAQ

Can I replace Cursor's tab autocomplete with a local model?

No. Cursor's tab model is a proprietary fine-tune served only from their infrastructure and there is no setting to swap it. If autocomplete must be local, switch IDE to Continue.dev, Zed, or Cline.

Does BYO mode work without an internet connection?

Partially. Cursor requires internet for license validation and Privacy Mode sync, but once authenticated, Chat and Cmd+K calls go only to your local URL. Tab autocomplete and codebase indexing stop working offline.

Is ngrok safe to leave running for a local LLM?

Free ngrok URLs are world-reachable. Always set a LiteLLM master key and ngrok basic auth (ngrok http 4000 --basic-auth="user:pass"), or prefer Cloudflare Tunnel with access policies, or Tailscale Funnel which is restricted to your tailnet.

Which local model is closest to Claude Sonnet 4.6 for coding?

Qwen3-Coder 480B-A35B at Q4_K_M is the closest open-weights model on SWE-bench Verified (69.6% vs ~74% for Sonnet 4.6), but it needs four H100s. For single-GPU setups, Qwen3-Coder 30B-A3B is the practical pick.

Why use LiteLLM instead of pointing Cursor straight at Ollama?

Ollama's native API diverges from OpenAI on streaming tool calls and finish reasons. Cursor's Agent mode breaks on those gaps. LiteLLM normalizes the responses, adds logging, and lets you switch backends without reconfiguring Cursor.

Does using a local model count against my Cursor request limit?

Yes. BYO routes the inference to your hardware but the request is still metered against your account tier. The benefit is privacy and unlimited token volume per request, not unlimited requests.

Recommended hardware

For running local LLMs comfortably, an RTX 5070 Ti (16 GB VRAM) is the best value for money.

Amazon Check RTX 5070 Ti price →

As an Amazon Associate, BestLLMfor earns from qualifying purchases, at no extra cost to you. It does not influence our independent rankings.