如何使用 LM Studio 在本地執行 OpenPilot 編碼智能體
Run a local coding agent with LM Studio + OpenPilot
OpenPilot 作者示範如何透過 LM Studio 在本地執行 OpenPilot 編碼智能體,並涵蓋模型載入、本地伺服器啟動與連線設定。若不確定裝置可執行的模型規模,指南建議從 Qwen 3 8B 開始,並提高上下文窗口;小型本地模型較適合集中編輯,長多步任務可拆細或改用較大模型。
A few days ago I wrote up how to run OpenPilot with Ollama. I've also been testing it through LM Studio, so here's that version. It's shorter, because LM Studio does most of the work.
Quick context if you haven't seen it: OpenPilot is a small open-source desktop app I built because I wanted something Cursor-style that would run on whatever model I picked, including local ones. The agent works inside a folder you choose, reads and edits files, runs shell commands, and asks before doing anything sensitive.
Why LM Studio
- You can browse and download models from inside the app, no terminal needed.
- It runs an OpenAI-compatible server on your machine, which is exactly what OpenPilot talks to.
- It's easy to see how much memory a model will need before you load it.
Step 1: Get a model
In LM Studio's model search, grab a Qwen 3 model. I've had good results with Qwen 3 8B and Qwen 3 27B. If you're not sure what your machine can handle, start with the 8B.
Step 2: Load it with a bigger context window
This is the one step people miss. When you load the model, raise the context length above the default. An agent sends file contents, tool results and its own history back to the model on every turn, and a small window fills up fast. If replies suddenly get confused or cut off halfway through a task, this is the first thing to check. How high you can go depends on your RAM/VRAM.
Step 3: Start the local server
Open the Developer tab and switch on "Start server", or from a terminal:
lms server start
By default it listens on http://localhost:1234, and the OpenAI-compatible base URL is http://localhost:1234/v1. If you changed the port in LM Studio's server settings, use that one instead.
Step 4: Install OpenPilot
- Windows: OpenPilot-Setup.exe (portable .exe on the releases page too)
- macOS (beta):
.dmgfor Apple Silicon or Intel from Releases - Linux: no installer yet, but
git clone,npm install,npm startworks from source (Node.js 20+)
Neither build is code-signed yet, because I'm one person. On Windows click More info, then Run anyway on the SmartScreen prompt; on macOS right-click the app and choose Open.
Step 5: Connect the model in OpenPilot
On first launch, onboarding asks you to connect a model:
- Name: the model identifier LM Studio shows for the loaded model
- Base URL:
http://localhost:1234/v1 - API key: LM Studio doesn't need one by default, so any placeholder works (if you turned on authentication in LM Studio's server settings, paste that token instead)
You can add more models later in Settings and switch per chat, so it's easy to keep a small fast model and a bigger one side by side.
Step 6: Pick a folder and give it something small
Pick a git-tracked or throwaway project so you can diff or revert anything. Then try something concrete, like:
Look at package.json and add a "Scripts" section to README.md explaining each one.
You'll see the file reads, edits and shell commands as cards, and approve or deny prompts for anything sensitive.
Honest limits
- Small local models are good at focused edits and worse at long multi-step chains. Break big tasks into smaller ones, or switch to a bigger model for those.
- There's no loop guard yet, so a model can occasionally repeat itself. Stop it and rephrase.
- Unsigned builds, macOS is still beta, and no Linux installer.
- Telemetry: anonymous usage data (app opens, which features and models get used, token counts; no chats, files, paths or keys) is on by default. You can turn it off during Getting Started or in Settings, About.
Links
- GitHub: https://github.com/ibmshaikh/OpenPilot
- Site: https://openpilot.in
- The Ollama version of this guide: https://dev.to/openpilot/run-a-local-coding-agent-with-ollama-qwen-3-using-openpilot-3j8n
If a model works well (or badly) for you in LM Studio, please open an issue and say which one. That's the most useful thing I can get right now.
Disclosure: I drafted this post with help from an AI assistant. The steps are based on my own LM Studio testing and LM Studio's docs; if something doesn't match what you see, open an issue and I'll fix it.
來源:DEV Community · dev.to