How to Connect LM Studio to Open WebUI: Docker Setup & Fixes

AI Tech Safar editorial guide · Reviewed by Imran Khan Pathan, Editor at AI Tech Safar

Verification method: The setup and API paths below were checked against LM Studio, Open WebUI, and Docker documentation. The screenshots are credited reference images. Commands and sample responses show what to check on your own machine.

To connect LM Studio to Open WebUI, start LM Studio’s local API server, then add its OpenAI-compatible base URL in Open WebUI. LM Studio loads the downloaded model and generates the response. Open WebUI gives you a browser interface to select the model and chat. The detail that most often changes the setup is where the Open WebUI backend runs.

Quick answer: Use http://127.0.0.1:1234/v1 when both applications run directly on the same machine. If Open WebUI runs in Docker Desktop and LM Studio runs on the host, try http://host.docker.internal:1234/v1. A successful GET /v1/models response with a model ID checks discovery. A completed chat checks inference.

Before you connect LM Studio to Open WebUI

Install LM Studio on the machine that will run the model and download one text-capable model sized for that machine. Keep the first test simple. A small model and a short prompt give you a baseline before you try large downloads, document uploads, or tool calling. Open WebUI should already be running, and you need an admin account to add a shared provider connection. For installation, see the Open WebUI Docker setup guide.

Where Open WebUI runsLM Studio API base URLWhat to verify
Directly on the same OShttp://127.0.0.1:1234/v1LM Studio’s port and running status
Docker Desktop on Windows or macOShttp://host.docker.internal:1234/v1Container can reach the host listener
Docker Engine on Linuxhttp://host.docker.internal:1234/v1 with a host-gateway mappingAlias resolves and server listens on a reachable interface
On a separate machinehttp://SERVER_LAN_IP:1234/v1 on a trusted private networkReachable bind address, firewall scope, and authentication

Use the port displayed in LM Studio if it differs from 1234. The URL points to the machine running LM Studio from the perspective of the Open WebUI backend. A browser on the same computer and a Docker container on that computer can see different services at the same loopback address.

Step 1. Start the LM Studio local server

  1. Open LM Studio and confirm the model download is complete.
  2. Open the Developer tab and load one text model manually for your first run. That gives you a known model to look for in both apps.
  3. Turn on Start server. Check the running indicator and note the port or URL displayed by LM Studio.
  4. For a direct same-machine connection, keep the default loopback listener. Use a network-reachable listener only when your chosen backend cannot reach loopback and you have configured authentication and firewall scope.
LM Studio Developer tab showing the running local API server and port 1234
LM Studio Developer tab with the local API running. The example shows a network listener. A native same-machine setup can keep loopback. Screenshot via LM Studio’s DGX Spark guide.

Leave LM Studio open during the walkthrough. If the copied address ends at the port, add /v1 when entering the provider base URL. Keep the server port and Open WebUI’s own browser port separate. Changing the browser port does not change where LM Studio listens.

Step 2. Check the API on the LM Studio computer

Run the following in a terminal on the computer hosting LM Studio. The first command is for macOS or Linux. Use the second in Windows PowerShell. Run the command for your OS.

curl -i http://127.0.0.1:1234/v1/models
curl.exe -i http://127.0.0.1:1234/v1/models

Look for HTTP 200 and at least one ID in the response’s data array. Copy the returned ID if you later need to add a model manually. A model’s display name or the name printed on its download page can differ from the API identifier. With just-in-time loading enabled, the list can include downloaded models that are currently unloaded, so a listed model still needs to complete an inference test.

{"object":"list","data":[{"id":"YOUR_MODEL_ID","object":"model"}]}

The snippet above is an abbreviated example. If you enabled Require Authentication in LM Studio, pass a local LM Studio token. Replace the placeholder and use curl.exe on Windows. Avoid showing the token in screenshots or shared terminal recordings.

curl -i -H "Authorization: Bearer YOUR_LM_STUDIO_TOKEN" http://127.0.0.1:1234/v1/models

A host-side failure is worth fixing immediately. Confirm LM Studio is running, the port matches, and the model is loaded or available for on-demand loading. Once this test works, you have a baseline for comparing what the Docker container can see.

Step 3. Test the Docker route when Open WebUI runs in a container

Docker Desktop documents host.docker.internal as the host address from a container. On Docker Engine for Linux, the existing Open WebUI service may need a host-gateway mapping. These are backend tests. Opening the address in your host browser does not prove the container can reach it. See Docker Desktop networking and Docker Compose networking.

docker ps --format "{{.Names}}"
docker exec open-webui python -c "import urllib.request; print(urllib.request.urlopen('http://host.docker.internal:1234/v1/models', timeout=8).read().decode())"

Use the actual container name from the first command if it differs. The probe assumes the Open WebUI container has a python executable and the model endpoint accepts the request without a token. If you require authentication, HTTP 401 from the probe still shows that a server answered across the route. Verify authenticated access using the token in Open WebUI’s connection settings.

For a Linux Docker Engine installation using Compose, add this service-level setting inside the existing Open WebUI service. Preserve the service’s image, settings, and volume mounts. The snippet shows only the part to merge.

services:
  open-webui:
    extra_hosts:
      - "host.docker.internal:host-gateway"

Run these from the directory containing your Compose project. Substitute your Compose service name in the second command if it is different.

docker compose config
docker compose up -d open-webui

For an existing run-command installation, the equivalent option is --add-host=host.docker.internal:host-gateway on its container creation command. Preserve your current mounts and environment settings if you recreate that container. An alias solves name resolution. The LM Studio listener must also accept traffic arriving on the interface the container uses.

If the host probe works and the container reports connection refused, check the port and server bind address first. LM Studio’s Serve on Local Network setting makes the listener reachable beyond loopback. If you need it, enable authentication and restrict the port to the trusted network or container route you intend to use. Avoid forwarding port 1234 through your router for this setup.

Step 4. Add the OpenAI-compatible connection

  1. In Open WebUI, open Admin Panel → Settings → Connections. Locate the OpenAI-compatible or OpenAI API connection area and add a connection.
  2. Enter the base URL for your topology, ending in /v1. For Docker Desktop that is usually http://host.docker.internal:1234/v1. Keep /models for terminal checks.
  3. If LM Studio requires authentication, enter the LM Studio token. Otherwise, leave the key field blank or use the documented lm-studio placeholder if the interface requires an entry.
  4. Keep the model list or allowlist empty on the first attempt so you can check automatic discovery. Save the connection, then open a new chat and check the model selector.
Open WebUI Add Connection dialog with fields for an OpenAI-compatible API URL and model IDs
The Add Connection dialog shown in a different provider setup. Use your LM Studio URL and local authentication settings in these fields. Screenshot via ClickHouse documentation.

Open WebUI’s compatible-provider documentation also describes an optional LM Studio provider setting under Advanced. On builds offering that option, it enables additional model-management controls for admins. The base URL and a working chat are enough to establish the basic integration before you try those controls.

Step 5. Verify your first chat

Open a fresh chat and select the LM Studio model you identified earlier. Send a short prompt such as What is 17 plus 25? Reply with just the number. The expected answer is 42. Check LM Studio’s server activity while you send it. A matching request in LM Studio gives you a way to verify which provider handled the prompt when Open WebUI lists models from several connections.

An entry in the selector proves the interface can offer the model. A completed response proves that the backend can generate a reply for that request. If the model appears but the first chat stalls, load it manually in LM Studio, open a fresh chat, and repeat the short test. This reduces the effects of a cold load and accumulated conversation context.

Fix LM Studio models not showing in Open WebUI

SymptomLikely layerNext action
Connection refusedListener or portConfirm the server is running and the bind address is reachable from the caller.
Cannot resolve hostDocker DNSOn Linux check the host-gateway mapping and confirm the container was recreated with it.
TimeoutNetwork path or firewallCompare the host and container probes. Inspect the local firewall or VPN route before changing an application timeout.
401 UnauthorizedAuthenticationEnter the current LM Studio API token for that provider and save again.
404 Not FoundEndpoint path or wrong serviceCheck the port and the /v1 base URL. Test /v1/models separately.
200 with an empty data arrayModel discovery on LM StudioLoad a compatible downloaded model manually and repeat the request.
API returns model IDs, but selector is emptyConnection filtering or permissionsCheck the provider is enabled, model filters are clear, and the test account has access.
Model shows, but replies failInferenceTry one loaded text model in a fresh chat and inspect LM Studio’s server activity.

A useful rule is to stop at the first failed layer. If the host probe never reaches the API, editing Open WebUI’s model allowlist will not help. If the host sees model IDs and the container cannot connect, stay with network and bind settings. If both probes return IDs, investigate the saved Open WebUI connection before downloading another model.

When only regular users are affected, reproduce the problem from an administrator account before changing the server. An admin seeing the model while another user cannot points toward model visibility or permissions. When both see it and both get the same chat failure, look at LM Studio’s request activity and try a model that already works in LM Studio’s own chat.

What to record before changing anything else

Save the working API base URL without its token, the exact model ID, the Open WebUI container or service name, and whether the server uses authentication. Keep one short test prompt alongside those details. After a restart or update, repeat the host probe, the container probe if applicable, and one new chat. That sequence helps you distinguish a stopped local server from a changed port or an inference problem.

If you use Ollama and LM Studio side by side, choose the provider deliberately when testing a model. A successful response from a similarly named model on Ollama can make a broken LM Studio connection look healthy. Check the provider label or the LM Studio server activity before you mark the test as passed.

Frequently asked questions

Can I keep Ollama and LM Studio in the same Open WebUI instance?

Yes. Keep your Ollama connection and add LM Studio separately as an OpenAI-compatible connection. Where available, a connection prefix can help distinguish models with similar names.

Can someone use Open WebUI from a phone without an LM Studio app?

Yes, if the phone can reach the Open WebUI instance and the user can sign in. The Open WebUI backend makes the request to LM Studio. A WebUI instance published only on host loopback remains reachable only from that host.

Will deleting the Open WebUI connection delete my downloaded models?

Removing the connection removes the route used by Open WebUI. Model files are managed by LM Studio on its host. You can reconnect to the same local model files later.

Can I use a vision model with this connection?

LM Studio’s Chat Completions API supports image inputs with compatible models. Choose a model that supports vision and verify image support in your Open WebUI model settings with a small test image.

Does restoring an Open WebUI backup restore LM Studio’s models too?

Back up LM Studio’s model files and app settings separately if they live on the host. A backup of the Open WebUI data volume covers the WebUI side of the setup.

Do I need an OpenAI account or credits for the local connection?

The OpenAI-compatible setting describes the API format. With the base URL pointing to LM Studio, requests for that connection go to LM Studio. Other models or optional integrations configured in Open WebUI may have their own billing or data handling.

Related links

Sources

Related AI Articles

Leave a Reply

Your email address will not be published. Required fields are marked *