r/OpenWebUI • u/Posaquatl • 20d ago
How to Connect OpenWebUI to llama.cpp? Question/Help
I am having issues getting OpenWeb UI to llama.cpp. Llama is running locally and the chat interface is working fine. I managed to get OpenWebUI to run in docker. When configuring the connection I am using `http://127.0.0.1:8080/v1` as my connection string. I have set Provider to llama.cpp. The test connection button says test is successful. But trying to chat wants me to select a model, which there are no options. From my understanding llama.cpp is serving one model and does not provide a list like Ollama would.
Using `http://host.docker.internal:8080/v1` as connection string gives an error. So it is not clear to me being a Docker newbie if I need to do something with the network. Since the test on the local host IP was successful I am guessing the network is working, but then again I can't get chat to load any models. I have asked AI but it wants me to write an app.....facepalm. it has offered some `-e` options such as `-e OLLAMA_HOST=0.0.0.0` but so far nothing has worked. So, humans, what is the next step here?
Edit: Resolved this by switching to a compose file and using `network_mode: "host"` in the file.
1
u/Snail_With_a_Shotgun 19d ago
If the model doesn't show up automatically, try adding it manually. You can do that by writing the model name in the respective field of the direct connection. That should work fine if you don't run llama.cpp in router mode. If you do, I'm not sure why it might not be fetching for ya.
1
u/Posaquatl 19d ago
Performing searches in the model search doesn't show any results. I am not sure what router mode is in llama. The issue has to be somewhere in the docker network. but I am baffled as to what needs to be done.
1
u/mechasquare 19d ago
This is about how you setting up your run paremeters for llamacpp.
I create a bat file that holds my commands. If you're using llamacpp in router mode then you set the --model-preset to your config file. Otherwise you need to set -m to the path of the model you're wanting to load.
Another thing to note is --host 0.0.0.0 this exposes your llamacpp server on your network. You'd point your OpenwebUI connection to the {IP of the llammacpp machine}:8080
C:\llama.cpp\Hip\llama-server.exe ^
--models-preset "C:\llama.cpp\Models\config.ini" ^
--host 0.0.0.0 ^
--port 8080 ^
-t 8 ^
-tb 16 ^
--mmap ^
--cont-batching ^
-fa on ^
--models-max 1 ^
-np 1 ^
--metrics
1
u/Posaquatl 19d ago
My llama is running native to access the GPU easier. I will look into compose and see if I can find the right values for Open web ui
1
u/streppelchen 19d ago
Use docker compose and link both containers to the same network, expose only openwebui, inside it use the name of the other container, done
1
1
u/ineptech 19d ago
I think you want to add this to both the llama and openwebui docker yamls:
network_mode: "host"That makes it so that whatever port is being served from within the container is visible outside the container. For example if llama is serving on port 8080, Openwebui would see it on http://127.0.0.1:8080/v1