LM Studio serves an OpenAI-compatible API on localhost:1234 by default. If that port is already taken, or you want a predictable port for a script, start the server with a port you choose and confirm it answers there.
What you need
- LM Studio installed with a model already downloaded
- The lms command on your path, or the Developer tab in the app
- A free local port, for example 1234 or 1235
Step 1: Load a model first
Open LM Studio, load a model from the Discover tab or with lms load, and confirm it is loaded with lms ps. The server has nothing to serve until a model is loaded.
Step 2: Start the server on your port
Run lms server start –port 1234, or open the Developer tab and set the port in the server settings. If you do not pin a port, the server may land on a different one, so always confirm which port it used.
Step 3: Confirm the port answers
Run curl http://localhost:1234/v1/models and check the loaded model is listed. If the port is taken, pick another one and start the server again.
Worked example: synthetic server port check
The table below is a synthetic example. It shows the expected result of starting the server; no server was started.
| Port | curl reply | Meaning |
|---|---|---|
| 1234 | Model listed | Server up on 1234 |
| 1235 | Model listed | Server up on 1235 |
| No port pinned | Port varies | Confirm with lms server status |
Expected result (UNTESTED). the server answers on the pinned port and lists the loaded model, and the status command confirms the actual port when none is pinned. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- The server only serves the model that is loaded; loading a different model changes what the endpoint returns.
- Serve on the local network only if you mean to; anyone on the network can then use the API.
- The lms command ships with LM Studio, so bootstrap it once with lms bootstrap if it is not on your path.
