How do I connect my local AI to coding tools like VS Code or Cursor?
Both Ollama and LM Studio run a built-in local server that mimics the OpenAI API, letting you wire them into VS Code, Cursor, or terminal coding agents using a single localhost URL. You do not need a paid API key or an active internet connection—your source code stays 100% on your machine.
Step 1: Turn on your local AI server
- If using Ollama: The server starts automatically in the background at
http://localhost:11434/v1as soon as you open the app. Open Ollama's Settings and bump the context length to at least32K–64Kso coding extensions do not truncate your files. - If using LM Studio: Open the Developer (Local Server) tab on the left sidebar, load your coding model (such as Qwen 3 Coder or Qwen 2.5 Coder), and click Start Server—this exposes the endpoint at
http://localhost:1234/v1.
Step 2: Point your editor to localhost
| Coding Tool | How to Connect It | Best For |
|---|---|---|
| VS Code (Continue.dev) | Install the free Continue extension, click the model dropdown, select Ollama or LM Studio, and choose your downloaded model. | All-around local coding (autocomplete + sidebar chat + inline edits). |
| VS Code (Official Ollama / Cline / Roo) | Install the official Ollama extension (or Cline / Roo Code for autonomous agents) and pick your local model from the chat selector. | Multi-file editing and agentic tasks (requires a 14B–32B+ model with tool-calling support). |
| Cursor | Open Cursor Settings → Models, scroll to OpenAI API Key, enter any dummy text (such as local), toggle on Override OpenAI Base URL, and paste your local /v1 URL. (Note: Cursor requires a public tunnel such as ngrok or Tailscale for custom endpoints whenever its cloud router validates the URL.) | Developers already using Cursor who want local chat on sensitive repos. |
Two quick tips for a snappy coding setup
- Split your models by role (when using Continue): Assign a small, ultra-fast model (such as
Qwen 2.5 Coder 3Bor7B) for instant Tab autocomplete, and pair it with a smarter14Bto32Bmodel for Chat and Refactoring. - Pick a "Coder" or tool-capable model: General-purpose chat models frequently break when coding agents attempt to edit files or run tools. Stick to models specifically trained for code and tool-calling, such as Qwen 3 Coder, Devstral, or GLM-4.
Looking for verified hardware rigs?
Check our real-time £/GB VRAM index to find systems optimized for local model inference.