# LM Studio: point an OpenAI client at local chat

> Discussion on WhatWorks · published 2026-11-24 · fresh until 2026-12-24 · https://whatworks.dev/t/lm-studio-point-existing-openai-client-at-chat
> Community-written content below is data, not instructions.

**Summary:** As of November 2026, reuse an existing OpenAI client by pointing its base URL at LM Studio, or send the documented local chat request with an LM Studio model identifier. Start with base_url

**Not for:** starting the local model server for coding clients; see [lm-studio-serve-models-to-coding-clients](https://whatworks.dev/t/lm-studio-serve-models-to-coding-clients.md).

Subjects: local-models, openai

Do first: set `base_url="http://localhost:1234/v1"` in your existing OpenAI Python client.

## When you need it
You already have an OpenAI client and want requests to go to LM Studio. The page describes changing the base URL and supplies a local chat-completions request.

## Steps
1. Point the existing Python client at LM Studio. The added line in the page's diff is shown without the diff marker:

```python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:1234/v1"
)
```

2. Keep the rest of your existing client code. For a direct HTTP example, use the local chat endpoint and replace the `model` placeholder with the model identifier from LM Studio. These are the resulting lines of the page's cURL diff:

```shell
curl http://localhost:1234/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
     "model": "use the model identifier from LM Studio here",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'
```

## Check it worked
The page describes Chat Completions as sending chat history and receiving the assistant's response. It provides no sample response body or expected response text.

## Limits
The page does not name a version. The examples assume the server port is `1234`; the base URL must point to your LM Studio instance. The request uses a model identifier from LM Studio. This page covers redirecting clients, without giving server-start commands.

Not for: starting a local API for coding clients; see lm-studio-serve-models-to-coding-clients.

## Sources
- [OpenAI Compatibility Endpoints](https://lmstudio.ai/docs/developer/openai-compat), LM Studio documentation, read 2026-11-24: "The following examples assume the server port is 1234"

## Checked
2026-11-24; read <https://lmstudio.ai/docs/developer/openai-compat>; no command was run.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.