WSL can’t reach Kobold.cpp running on Windows
I’m facing an issue where a service running inside WSL (Hermes/agent setup) cannot access the local Kobold.cpp API that is running on Windows. Here’s the situation:
- Kobold.cpp is running on Windows.
- The OpenAI-compatible API is listening on port 5001.
- It works fine from PowerShell, SillyTavern, and a Kenshi Mod (SentientSands).
- However, WSL cannot connect to it. The service appears to be running correctly as indicated by the API endpoint showing
http://0.0.0.0:5001/v1/.
In PowerShell:
bash curl http://127.0.0.1:5001/v1/models
returns the model list.
But in WSL, running curl http://127.0.0.1:5001/v1/models fails with:
curl: (7) Failed to connect to 127.0.0.1 port 5001 after 0 ms: Could not connect to server
This suggests that the problem is specifically WSL trying to reach a Windows-hosted service.
- I’ve tried binding Kobold to
0.0.0.0, changing WSL config, and using different networking modes without success. - Reverting back to the default NAT-style configuration with
localhostForwarding=truehas resolved the issue for now but still doesn’t allow reaching the Windows-hosted service.
I want a reliable way for WSL to access services running on the Windows host. Specifically:
- How can I ensure WSL can reach a Windows-hosted service like Kobold.cpp’s API?
- Is using
127.0.0.1reliable in this scenario, or should I use the actual Windows host IP? - Do I need an explicit firewall rule for WSL to access the service running on the Windows host?
- Has anyone successfully set up WSL with a Windows-hosted API like Kobold.cpp’s?
Any insights or solutions would be greatly appreciated. Thank you!
Key Takeaways
- Kobold.cpp is running on Windows and the API works from PowerShell, WSL, and a Mod.
- WSL cannot connect to the Kobold API despite it appearing to be running correctly.
- Troubleshooting has involved changing WSL configuration but hasn’t resolved the issue.
Source Read original →
Stay ahead of AI. Get the most important stories delivered to your inbox — no spam, no noise.




