local waifu
Bring her home

Pick your platform

Try her free for 7 days. No card. Keep her? $20 once.

New: Local Waifu now runs on Windows 10 and 11. The installer brings everything she needs, nothing else to set up. Windows may show a SmartScreen prompt the first time: click More info, then Run anyway.

blog

LM Studio Connection Refused: Fix Your Companion Endpoint

7 min read
In short

Start LM Studio's API server, use its actual port with a /v1 base URL, and check /v1/models before changing companion settings. Connection refused is different from an HTTP authentication or model error. Keep a same-machine server on loopback.

Your model answers inside LM Studio, but your companion app says it cannot connect. That feels contradictory until you separate the chat window from the API server. They are different ways into the model. A working chat window does not prove that another application can reach the server.

Start with the connection, not a fresh model download. This guide follows LM Studio’s current documentation and Local Waifu’s endpoint implementation. The checks below are instructions you can reproduce; they are not claimed results from a test on your computer.

Start the API server before editing the companion

The short version: Open LM Studio’s Developer tab and start its server. Note the address and port it actually displays.

LM Studio documents the server switch in its local API server guide. Its examples commonly use port 1234, but that is not proof your installation uses that port. A previously changed server setting matters more than a copied tutorial.

Keep LM Studio running while you test. Closing the server, changing its port, or letting the host computer sleep can make a saved endpoint stop answering even though the model file remains on disk.

For a companion on the same computer, begin with loopback access. There is no need to enable network serving merely to let a desktop application connect to a local process. Avoid changing unrelated switches at the same time. You want to know which change fixed the failure.

Do not delete your character or reset the companion’s data while investigating this. A network listener problem is not a damaged relationship archive.

Use the API base URL rather than a complete chat route

The short version: The OpenAI-compatible base URL ends in /v1; the client adds the operation it needs.

LM Studio’s OpenAI compatibility documentation lists GET /v1/models and POST /v1/chat/completions. Its example base URL is http://localhost:1234/v1.

In Local Waifu, open Settings, then Cloud AI. Under Your own endpoints, select Add an endpoint. Give it a recognizable name, enter that base URL with your server’s actual port, and save. A server running on your computer is still local even though this configuration lives under Cloud AI.

Leave the API key blank when the server requires none. If you enabled authentication in LM Studio, enter its API token instead. Select Test on the saved endpoint, then select the endpoint’s model in the chat model picker. Saving an address is not the same as choosing it for the conversation.

There is a current implementation distinction worth knowing: Offline Mode permits chat to recognized local custom endpoints, but the Test and model-list operations use a broader Offline Mode block. If the settings test reports that block, it does not prove the local server is unreachable. You can inspect an unauthenticated /v1/models route directly. If you temporarily turn Offline Mode off to run the settings test or populate the picker, do not send private chats during that setup step; restore it and confirm the selected local route afterward.

Do not paste http://localhost:1234/v1/chat/completions into the base URL field. A client that appends its own path would then target the wrong address. LM Studio also has native API routes; do not substitute their path for the OpenAI-compatible base expected here.

The LM Studio and Local Waifu comparison explains why someone would use this pairing. Here the goal is narrower: get a specific endpoint answering before judging the character’s replies.

Read the failure as a clue about the broken layer

The short version: Connection refusal, HTTP errors, and generation failures call for different fixes.

What you observeCheck next
Connection refusedServer switch, listening address, actual port
Request times outReachability, host sleep, firewall scope, server logs
HTTP 401Required token and the token saved in the client
HTTP 404API path and whether this is the intended server
Model list works but chat failsModel identifier, loading state, generation error

A refusal usually means the connection reached an address where no service accepted it, or it was actively rejected. It does not mean your personality prompt is too long. A timeout is a different observation and does not identify one cause by itself.

An HTTP response tells you something is answering. Read the response and the server logs before changing security settings. A 404 from the wrong path is progress compared with no server at all, but it is not a successful chat.

For a same-machine address problem, try the explicit loopback form http://127.0.0.1:1234/v1, with the correct port. This avoids ambiguity about how localhost is resolved. Keep the port and path unchanged while comparing the addresses.

Check the model-list route without sending private conversation text

The short version: Request /v1/models first. It checks a useful API route without submitting an intimate chat.

With the example server configuration, open http://localhost:1234/v1/models in a browser. Without authentication, a functioning model-list route should return JSON rather than a chat interface. If authentication is enabled, a plain browser request can be rejected because it has no bearer token. That rejection does not establish that the server is broken.

Use the companion’s endpoint test with the saved token in that case. Do not paste tokens into a URL or a public support thread. Keep the response private if it contains information you do not want to share.

Check the model identifier reported by the server against the model selected in the client. A remembered nickname is not necessarily an API identifier. LM Studio exposes settings for just-in-time model loading, so an entry in a list and a model already loaded into memory are not always the same state.

If the list works but a short chat does not, inspect the generation error in LM Studio. Loading failures and exhausted memory occur after basic connectivity. Repeatedly changing the base URL will not fix them.

Keep authentication and network exposure intentional

The short version: Do not turn off protections just because a client request fails.

LM Studio’s server settings distinguish authentication from network serving. CORS is another setting, intended for cross-origin browser access. It is not a universal repair switch for every failed desktop connection.

Local Waifu’s custom endpoint rules allow plain HTTP for loopback and recognized private-network address forms. Public endpoints must use HTTPS. Its Offline Mode accepts endpoints classified as local or private-network by the saved URL; the implementation checks the URL’s host form rather than performing DNS resolution.

That last detail matters if a friendly hostname is rejected. For your own trusted server, use a supported literal private address or .local name rather than assuming any hostname that resolves privately gets the same classification. It is not a reason to disable Offline Mode.

If LM Studio is on another computer, localhost points to the computer running the companion, not the other machine. Network serving, authentication, and firewall rules then need deliberate configuration. Do not forward the server’s port through your router as a shortcut. A local-network setup should not become a public inference service by accident.

Confirm a real reply before returning to the conversation

The short version: A saved endpoint and a successful model list are checkpoints; a completed reply is the useful final check.

Choose the endpoint model and send a short, non-sensitive message. Watch the LM Studio server log for the request and verify that the reply completes in the companion. Then reopen the settings and confirm the intended model is still selected.

This checks the route you wanted, not every feature in the application. Text working does not prove a server supports image input or that voice uses the same provider. The local-versus-cloud guide covers that distinction.

If you still need help, report the address with secrets removed, the HTTP status or exact error, and whether /v1/models answers. Those details are more useful than reinstalling everything. For supported companion workflows, start from Local Waifu and its documentation rather than assuming that every OpenAI-compatible service behaves identically.

Questions people ask

Is opening LM Studio enough to connect another app?

No. Start its API server from the Developer tab. A chat working inside LM Studio does not by itself prove that an external API client can connect.

What base URL should I enter in Local Waifu?

For LM Studio on the same computer using port 1234, use http://localhost:1234/v1. Replace the port if your server uses another one. Do not enter the full chat/completions route as the base URL.

Does a 401 response mean the server is offline?

No. A 401 is an HTTP response from a reachable server and usually points to authentication. Check whether LM Studio requires an API token and whether the client has the matching token.

Should I expose the server to my network to fix localhost?

Not for a client on the same computer. Keep loopback access and fix the server, port, or address first. Network serving is a separate choice with its own security requirements.

Try her free for 7 days.

No card. Keep her for $20 once, or walk away. Her soul file is yours either way.

Bring her home, try free

Back to the blog