Local API clients connect to a particular address and port. The LM Studio server can use a port other than its usual 1234 when another service occupies it or a client needs a different endpoint.

The HTTP listener belongs to the LM Studio instance controlled by the current user's lms command. Changing its port changes the URL clients use, while downloaded models and their load state stay separate from that setting.

An available lms command and a running LM Studio app or llmster daemon are prerequisites. On Linux, How to run LM Studio headlessly with llmster covers installation and daemon startup. A model-list request can confirm HTTP access without loading a model for inference.

Steps to set the LM Studio server port:

  1. Check the current LM Studio HTTP server port. Example output:
    $ lms server status
    The server is running on port 1234.

    The reported port is the value to restore if clients cannot move to a new URL. If the server is not running, the start command below creates the listener.

  2. Start the LM Studio HTTP server on loopback port 1235, replacing 1235 with your chosen unused port.

    Changing the port disconnects clients from the old API address. Clients using that address need the new port before they can send requests again.

    $ lms server start --bind 127.0.0.1 --port 1235
    Success! Server is now running on port 1235

    --port selects the HTTP port, and --bind 127.0.0.1 limits access to this machine. The command can change the port of a running server. LM Studio reuses the last-used port when a later start omits --port.
    Related: LM Studio server start reference

  3. Confirm that LM Studio reports the selected port. Example output:
    $ lms server status
    The server is running on port 1235.

    A different port or a stopped status means the intended listener is not active.

  4. Request the model list at the selected port, replacing 1235 if you chose another value. Example output:
    $ curl --fail --silent --show-error --max-time 5 \
      http://127.0.0.1:1235/v1/models
    {
      "data": [
        {
          "id": "text-embedding-nomic-embed-text-v1.5",
          "object": "model",
          "owned_by": "organization_owner"
        }
      ],
      "object": "list"
    }

    The JSON model list confirms that the API answers on the new port. The listed models depend on the installation, and an empty data array is valid. A connection error means the endpoint is unreachable; --fail also reports unsuccessful HTTP responses, and --max-time 5 bounds the wait. For an OpenAI-compatible client, the base URL is now http://127.0.0.1:1235/v1.
    Related: How to install cURL on Ubuntu

Share this guide