Okay sorry for the slop below but I'm losing my mind with this and I'm hoping someone here has dealt with the same setup. (I asked the AI that let me copy&paste shit for 3 hours to summarise what it asked me to do)
Here's the situation:
- Kobold.cpp is running on Windows
- The OpenAI-compatible API is on port 5001
- It works from PowerShell on Windows, SillyTavern and a Kenshi Mod (SentientSands)
- But WSL cannot connect to it, even though it's the same machine
Kobold.cpp starts normally and shows that the OpenAI-compatible API is running on http://0.0.0.0:5001/v1/.
From PowerShell, this works fine:
bash curl http://127.0.0.1:5001/v1/models and it returns the model list.
From WSL, pwd works normally, but this fails:
bash curl http://127.0.0.1:5001/v1/models with:
bash curl: (7) Failed to connect to 127.0.0.1 port 5001 after 0 ms: Could not connect to server So at this point I know:
- Kobold itself is running fine
- The API endpoint is working on Windows
- The actual problem is specifically WSL trying to reach a service hosted on the Windows side
Things I already tried:
- Binding Kobold to
0.0.0.0instead of only localhost - Changing WSL config to use
networkingMode=mirrored - Running
wsl --shutdownafter changing config - That honestly made things worse, because WSL started acting weird and some commands would just hang
- Then I reverted back to a more normal NAT-style config with
localhostForwarding=true
After reverting, WSL works normally again, but it still cannot access the Windows-hosted Kobold API.
What I'm ultimately trying to do is simple:
I want a service running inside WSL (Hermes / agent setup) to use the local Kobold.cpp OpenAI-compatible endpoint that is running on Windows.
So my questions are:
- What is the current clean/reliable way for WSL to reach a service running on the Windows host?
- Is
127.0.0.1supposed to work for this, or is that still unreliable in WSL2? - Is the best solution just to use the actual Windows host IP instead?
- Do I need an explicit Windows Firewall rule for this, even though it's the same physical machine?
- Has anyone here actually gotten WSL + Windows-hosted Kobold.cpp + OpenAI-compatible API working reliably?
- Is my setup even safe and will the agent be isolated enough?
Thank you very much for reading and any help or advice is highly appreciated! 😞
[link] [comments]