Vibe Coding for Production
Local models

LM Studio

Install LM Studio, load a local model, and serve OpenAI- and Anthropic-compatible APIs on port 1234.

LM Studio is a desktop app to download or import already-quantized models, chat with them, and serve them locally, including through OpenAI-compatible and Anthropic-compatible HTTP APIs. Developer-focused details live in LM Studio developer docs.

Use this page to stand up Gemma 4 E2B (or the closest GGUF / MLX build LM Studio lists for gemma4 / Gemma 4) and expose http://localhost:<port>/v1 for tools that expect an OpenAI client.

Install LM Studio

Download the app from lmstudio.ai for macOS, Windows, or Linux and complete first launch.

Optional CLI lms: documented under LM Studio CLI, useful for scripted downloads and headless server control.

Get Gemma 4 E2B (or equivalent)

Open LM Studio's model search / hub UI and search for "Gemma 4" or gemma4 (exact package names change as publishers update).

Prefer the E2B or edge variant if you want parity with ollama pull gemma4:e2b in Ollama.

Download a quantization that fits your RAM/VRAM (smaller Q4 variants for laptops; larger Q8/BF16 if you have headroom).

CLI download (pattern from LM Studio docs, replace with the identifier LM Studio shows for your chosen build):

lms get <publisher>/<gemma4-e2b-build>@<quantization>

If lms get with no args prompts staff picks, use that flow interactively the first time, see lms get in CLI local models.

Run the local server

From the GUI: load the model, open the Developer tab, and start the server. The default port is often 1234.

From the CLI (developer docs):

lms server start

Optional port:

lms server start --port 1234

OpenAI-compatible base URL

LM Studio's OpenAI-style clients should use /v1 on your server port, see OpenAI API compatibility.

Typical client setup (from LM Studio docs):

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:1234/v1",
    api_key="lm-studio",
)

completion = client.chat.completions.create(
    model="<model-identifier-from-lm-studio>",
    messages=[{"role": "user", "content": "Say this is a test"}],
    temperature=0.7,
)
print(completion.choices[0].message)

Use the exact model string LM Studio displays for the loaded checkpoint (copy from the server or chat UI). api_key is often a dummy value for local use unless you enabled auth in settings.

cURL pattern (adapt host, port, and model id):

curl http://localhost:1234/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<model-identifier-from-lm-studio>",
    "messages": [{"role": "user", "content": "Say this is a test!"}],
    "temperature": 0.7
  }'

Next: use with Claude Code

LM Studio now exposes an Anthropic-compatible POST /v1/messages endpoint, so Claude Code can connect directly without LiteLLM:

export ANTHROPIC_BASE_URL=http://localhost:1234
export ANTHROPIC_AUTH_TOKEN=lmstudio
export CLAUDE_CODE_ATTRIBUTION_HEADER=0
claude --model <model-identifier-from-lm-studio>

If you enabled Require Authentication, use an LM Studio API token instead of lmstudio. Choose a model with enough context for agent work; LM Studio recommends more than roughly 25K tokens. See Use Claude Code with LM Studio and Anthropic compatibility.

Use Hijacking Claude Code when you want Ollama, LiteLLM, multiple backends, or centralized auth and metering.

LM Studio's UI labels and default ports can shift between versions, verify in-app.

On this page