@girish Perfect thank you! This actually made it work for me!
Steps:
Generate an API key in your OpenWebUI.
Add the header Authorization: Bearer {{api_key}} to a post request to {{OpenWebUI_URL}}/ollama/api/generate and a body of
{
"model": "llama2",
"prompt": "Why is the sky blue?"
}
From there I get the response via the api.
To use it with n8n I can just use the regular request node.
The URL
{{OpenWebUI_URL}}/ollama/
gets forwarded to the internal Ollama endpoint. So if you want to access other aspects of the Ollama api you can just use their documentation at https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-completion.
In the docs replace "localhost:11434/api/" with "{{OpenWebUI_URL}}/ollama/api/"