import ArticleFAQ from "@/components/blog/ArticleFAQ";
"I'd rather not watch the API invoice climb every time an Agent runs overnight." That's the quiet worry most of us have after a few weeks with Antigravity. I spent several months of daily prototyping landing on the same setup: LM Studio serving a local model as Antigravity's default provider.
This article isn't a pure tutorial. Setup is the easy part — the harder questions are which model to load, how to keep a stable session across hours of editing, and what to do when the connection suddenly misbehaves on a Monday morning. I'll focus on those.
Why this pairing, specifically?
Antigravity is tuned for Gemini and Claude, but because it honors the OpenAI-compatible protocol, pointing it at a local server is mostly a matter of replacing the base URL. Ollama works the same way, but I still reach for LM Studio most days for three reasons.
- Model management is visible. Downloads, quantization variants, and context-length changes are all one-click affairs. No
modelfileediting, no restart gymnastics - The Developer server is predictable. LM Studio 0.3.x starts an OpenAI-compatible endpoint with a clear status UI, verbose logs, and an obvious "stop" button
- The chat pane acts as a scratch space. I can try a prompt in LM Studio's own chat before wiring it into Antigravity — that dry run saves a surprising amount of debugging
That said, Ollama wins when you want containerized deployment or to script setups across several machines. Compare notes with my Ollama integration guide before committing either way.
Picking your first model
The decision gets easier if you answer three questions.
- How much RAM does your machine have? 16 GB handles 7B-class models at Q4_K_M. 24 GB+ opens the door to 12B-class models comfortably
- What kind of task dominates? Coding and refactors lean toward Gemma 4. Structured output flows (JSON schemas, tool calls) prefer Qwen 2.5-Coder. Long-form Japanese text tilts toward Llama 3.3 70B quantized variants
- How long are your sessions? If you need 128k context, Gemma 4 12B at Q4 is a realistic ceiling on consumer hardware
My daily driver is Gemma 4 12B Instruct at Q4_K_M. It stays within memory on a 16 GB MacBook Air and produces the kind of code quality I want inside Antigravity's Plan Mode. The Gemma 4 complete guide covers model variants in more depth.
A quick note on quantization
- Q4_K_M: Best balance — start here
- Q5_K_M: Slight quality bump for code tasks, if RAM allows
- Q8_0: Keep it for evaluation tasks, not everyday coding
The alphabet soup looks intimidating, but "pick the K_M line" is almost always the right answer for Antigravity use.
Setting up the LM Studio side
Open the Developer tab in the left sidebar and configure the server.
# LM Studio: Developer tab — recommended settings
Server Port: 1234 # default is fine
Cross-Origin-Resource-Sharing (CORS): Enable # so Antigravity can reach it
Verbose Server Logs: Enable # indispensable for first-run debuggingWhen you hit Start Server, the log pane shows something like:
Server started on http://localhost:1234/v1
Listening on 0.0.0.0:1234
Loaded model: gemma-3-12b-it-Q4_K_M (8.2 GB)A smoke test with curl now will save you from later confusion:
# Confirm the OpenAI-compatible server is responsive
curl -s http://localhost:1234/v1/models | jq '.data[].id'
# Expected:
# "gemma-3-12b-it-Q4_K_M"If that model ID comes back, the server is speaking the right protocol.
Wiring it into Antigravity
In Antigravity, go to Settings → Models → Custom Provider and fill in:
Provider Name: LM Studio (Local)
Base URL: http://localhost:1234/v1
API Key: lm-studio # any non-empty string
Model ID: gemma-3-12b-it-Q4_K_M # must match the ID shown in LM Studio exactlyLM Studio doesn't validate the API key, but Antigravity won't accept an empty string, so something like lm-studio is enough.
Click Test Connection and you should get a confirmation within a few seconds. If not, skip to the troubleshooting section below.
Multiple providers for faster switching
Antigravity lets you register several providers, so splitting LM Studio into purpose-built entries pays off quickly.
LM Studio - Code (Gemma 4 12B Q4)— daily coding and refactorsLM Studio - Fast (Gemma 4 4B Q5)— snappy Plan Mode interactionsLM Studio - JA (Qwen2.5-Coder 7B)— Japanese comments and docs
Since all of them point at the same LM Studio server, switching the Model ID triggers an automatic load/unload behind the scenes — you never have to leave the editor.
Three things that will catch you later
1. The connection "silently" goes away
If it worked yesterday and doesn't today, the server has probably stopped. LM Studio shuts down the server when the GUI closes, so enable Start Server on Launch and, on macOS, turn on the menu-bar mode so it stays resident.
Even when the server is up, the model itself can be unloaded. LM Studio 0.3.x auto-unloads models after idle periods; if that timing clashes with your workflow, adjust Developer → Settings → Auto-Unload. If the model disappears from Antigravity's list, the LM Studio model-not-visible fix walks through the common causes.
2. Responses truncate mid-thought
If a long session suddenly cuts off, the first suspect is LM Studio's Context Length setting. The default of 4096 tokens vanishes quickly in Plan Mode's structured prompts.
Gemma 4 12B at Q4 happily runs at Context Length: 32768 even on 16 GB machines, so setting it between 16384 and 32768 keeps long coding sessions stable. Memory pressure goes up correspondingly, so if you tend to keep Chrome and Figma open, 8192 is a safer middle ground.
3. Streaming stalls after a few seconds
A stream that pauses after 3–5 seconds usually isn't a software bug — it's thermal throttling. On macOS, sustained inference can trip the Performance State down. sudo powermetrics --samplers smc -n 1 -i 1000 | grep -i temp will reveal if the CPU is too hot, and sometimes pointing a fan at the machine is enough.
It sounds absurd, but during Tokyo summers my MacBook Air needs physical cooling to keep a 12B model steady. The real fix is running inference on a desktop with better thermal headroom, but don't dismiss the fan trick in the meantime.
A minimal morning routine
When LM Studio and Antigravity are your defaults, a five-minute morning check keeps the rest of the day friction-free. Mine looks like this: open LM Studio, glance at whether the server is already green from overnight, hit curl http://localhost:1234/v1/models in a terminal alias, then open Antigravity and fire a throwaway prompt like "say hello in one sentence." If any of those three steps misbehaves, I deal with it then — not at 3 p.m. when I'm deep in a refactor.
It's the kind of habit that looks silly written out, but it catches auto-unload surprises, silent OS updates that reset network permissions, and the occasional VPN that's decided to route localhost through its tunnel. Thirty seconds of prevention, no lost afternoon.
Wrapping up — pick one thing for today
The LM Studio + Antigravity pairing rewards incremental tuning. Don't try to optimize everything at once; pick one change for today. For example: load Gemma 4 12B Q4 and turn on "Start Server on Launch." That single tweak changes how tomorrow morning feels.
Layer improvements week by week — a second provider entry for Fast Mode, a bumped context length, a cooling pad — and within a month you'll have a workstation where you can kick off Agents without thinking about the invoice.
<ArticleFAQ title="FAQ" items={[ { question: "Between LM Studio and Ollama, which should I pair with Antigravity?", answer: "LM Studio fits if you want a GUI-driven workflow and quick context-length tweaks. Ollama is easier when you need to reproduce the same configuration across several machines or run it in a container. I use LM Studio on my primary laptop and Ollama on CI or shared servers." }, { question: "Agent latency is a concern. Should I downgrade to a smaller model?", answer: "Usually not. Start by reducing the Context Length to the minimum your session needs — that tends to help more than swapping to a smaller model. If it's still slow, split tasks: Gemma 4 4B for completion, 12B for planning." } ]} />