Hi all. Have OpenHands running locally (local back...
# questions
a
Hi all. Have OpenHands running locally (local backend) inside a Docker container with agent-canvas, was described here: https://docs.openhands.dev/openhands/usage/agent-canvas/overview Downloaded LM-Studio and a local model following this: https://docs.openhands.dev/openhands/usage/llms/local-llms All seems to work (connection from OpenHands-Docker container to LM-Studio on my mac is ok), but the conversion in the OpenHands UI tells me: litellm.InternalServerError: InternalServerError: OpenAIException - Connection error. Anyone having the same issue?
m
Hey @aloof-island-48601 šŸ‘‹ that Connection error is almost always networking in this exact setup, not your model config. The key thing to know: in OpenHands v1.x (agent-canvas / local backend), the LLM call isn't made from the openhands-app container, but it's made from the agent-server (sandbox) that runs your conversation. So openhands-app can reach LM Studio doesn't prove the agent-server can. Quick checklist 1. Verify the agent-server (not just openhands-app) can reach LM Studio. While a conversation is open, find the sandbox container
Copy code
docker ps --filter "name=oh-agent-server-" --format '{{.Names}}'
Then from inside it:
Copy code
docker exec -it <oh-agent-server-...> curl -s <http://host.docker.internal:1234/v1/models>
• If this fails: it's networking (points 2–3). • If it succeeds: jump to point 4. • If
docker ps
shows no
oh-agent-server-
container, your local backend is running the agent in-process inside openhands-app — in that case run the same curl from inside the openhands-app container.) 2. Make sure LM Studio is bound to
0.0.0.0
, not
127.0.0.1
. In LM Studio's Developer/Server tab, enable "Serve on Local Network" (and make sure the server is on). If it's only listening on
127.0.0.1
, the Mac's loopback isn't reachable from a Docker container even via
host.docker.internal
. Confirm on the Mac with:
lsof -iTCP -sTCP:LISTEN -P | grep 1234
— you want to see
*:1234
or
0.0.0.0:1234
, not
127.0.0.1:1234
. 3. Check the Mac firewall. System Settings → Network → Firewall. Either turn it off briefly to test, or allow incoming connections for LM Studio. 4. Double-check your OpenHands LLM settings (Advanced enabled) match the docs exactly: • Custom Model:
openai/qwen/qwen3.6-35b-a3b
. The
openai/
prefix is required so LiteLLM uses the OpenAI-compatible path. • Base URL:
<http://host.docker.internal:1234/v1>
. The
/v1
suffix is important. • API Key: anything non-empty, e.g. local-llm (LiteLLM rejects an empty key even though LM Studio doesn't check it).
a
Hi Vasco and thanks for this answer. I double checked it all and everything is exactly configured and working as described by you. Firewall is deactivated entirely but even this isn't working. The only thing that's a bit strange is that LM studio seems to be reachable at 192.168.178.52 even though serving on local network. Shouldn't this be 0.0.0.0?
m
The only thing that's a bit strange is that LM studio seems to be reachable at 192.168.178.52 even though serving on local network. Shouldn't this be 0.0.0.0
I believe the
192.168.178.52
you see is just LM Studio's UI showing a routable IP, under the hood it should still be bound to
0.0.0.0
. Since you've confirmed LM Studio is reachable at 192.168.178.52:1234, point OpenHands straight at that instead of `host.docker.internal`:
Copy code
Base URL: <http://192.168.178.52:1234/v1>
However, I'm not super expert in LM studio. Perhaps, @calm-artist-7206 know something more.
a
configuring the IP in OpenHands to 192.168.178.52:1234/v1 worked. This is somewhat confusing since the curl to the docker.host dns worked from inside the agent container šŸ¤” But thanks anyway
m
Cool :) Agree with you