How to Setup OpenCode with a Local LM Studio Server

shaneprrlt1 pts0 comments

How to Use OpenCode With a Local LM Studio Server | Shane Perreault

← All writingAI-Assisted Software DevelopmentCodingLocal AI<br>How To Setup OpenCode With A Local LM Studio Server<br>I turned my gaming PC into a local LLM server and connected it to OpenCode running on my Mac. Here’s how to set up LM Studio for agentic coding over your local network, plus what I learned testing a 12B model on consumer hardware.<br>SShane Perreault

August 8, 2026·12 min read

Subscribe<br>Never miss a post<br>Practical lessons on building software products, covering MVP strategy, startup architecture, engineering execution, and build stories. No spam, unsubscribe anytime.<br>Email addressSubscribe→Protected by reCAPTCHA. Privacy · Terms

Lately, I’ve been experimenting with LM Studio as a way to host and run smaller LLMs on my gaming PC.<br>The GPU in my PC is by no means a powerhouse for AI inference. It’s primarily a gaming card, but I got curious about what kinds of models and performance I could get out of a GeForce RTX 5070 with 12GB of VRAM.<br>We’re obviously not going to be running 80B parameter models on this thing or competing with frontier models like Fable or GPT-5.6. But it turns out that smaller models in the 4B-15B range, especially when quantized, can run surprisingly well and at token speeds that are actually usable.<br>LM Studio works great as a general-purpose local chatbot, but I was more interested in its inference API. Specifically, I wanted to see how well a locally hosted model could work when paired with an agentic coding harness.<br>My goal was simple:<br>Run LM Studio and the model itself on my Windows gaming PC<br>Expose its inference API across my local network<br>Run OpenCode on my MacBook Pro<br>Use the PC as a remote local-model provider for OpenCode<br>It turned out to be a fun experiment, and getting everything connected was surprisingly straightforward.<br>System Architecture<br>For the model host, I’m using a Windows 11 gaming PC with the following specs:<br>AMD Ryzen 7 9800X3D CPU<br>32GB DDR5 RAM<br>GeForce RTX 5070 GPU with 12GB VRAM<br>2TB M.2 NVMe SSD Storage<br>Definitely respectable for a gaming PC, but by no means a dedicated AI inference rig.<br>I’ll be running OpenCode on my M4 Pro MacBook Pro with 48GB of RAM. The MacBook specs aren’t particularly important here since it isn’t doing the inference, but I wanted to give a complete picture of the setup.<br>Both machines are connected wirelessly to the same LAN.<br>Setting Up LM Studio On My PC<br>I already had LM Studio installed, but if you’re following along, you can download it from:<br>https://lmstudio.ai/<br>Installation is straightforward. Once you open it, you’ll find a familiar chatbot-style interface.<br>Before we can use it, though, we need an LLM.<br>LM Studio has a built-in model catalog that also gives you some indication of how well a model should run on your hardware.<br>For this experiment, I downloaded:<br>Microsoft Phi 4 Reasoning Plus<br>Google Gemma 4 12B QAT<br>Qwen3 4B Thinking 2507<br>These are relatively small models, but we’re working with only 12GB of VRAM. I want to stick primarily to models that can be fully offloaded to the GPU rather than spilling significantly into system RAM.<br>Feel free to experiment with different models and quantization levels to see what works well on your hardware.<br>It’s also worth reiterating what I’m trying to accomplish here. I’m not building a state-of-the-art GPU rig or trying to replace frontier coding models.<br>I want to see what’s possible with a fairly normal gaming PC and hardware I already own.<br>Starting the LM Studio API Server<br>Once your models are downloaded, we can start LM Studio’s local inference server.<br>Click the Developer tab in the sidebar, represented by the little shell icon, and open Local Server .<br>From here, you can configure your API server and choose which model to load. I started with Phi 4 Reasoning Plus.<br>Because we want to reach this server from another machine, we also need to enable Serve on Local Network under Server Settings .<br>Now toggle the server on.<br>Windows Security may prompt you to allow LM Studio through the firewall. Allow it on your private network.<br>LM Studio should now show the full network address where the server is listening.<br>In my case, the server is running on port 1234.<br>Opening Port 1234 in Windows Firewall<br>I also created an inbound Windows Defender Firewall rule allowing TCP traffic on port 1234 from my network.<br>Open PowerShell as Administrator and run:<br>New-NetFirewallRule -DisplayName "Allow Port 1234" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 1234 -Profile Domain, PrivateIf you later want to remove the rule:<br>Remove-NetFirewallRule -DisplayName “Allow Port 1234”With that done, we can test the connection from the Mac.<br>curl 10.0.0.30:1234/api/v1/modelsLM Studio returned the models available through the server, including Gemma, Phi, and Qwen:<br>"models": [<br>"type": "llm",<br>"publisher": "qwen",<br>"key": "qwen/qwen3-4b-thinking-2507",<br>"display_name": "Qwen3 4B Thinking 2507",<br>"architecture": "qwen3",<br>"quantization": {<br>"name":...

studio server local models model opencode

Related Articles