If you are lazy as me here is the summay for this brilliant insights of this thread:
Enable json format for search in SearXNG (will not make the search interface public):
Edit settings.yml:
Open the settings.yml file.
Add json in search under the formats
Example:
formats:
- html
- json <-- add this
Note the Port in the settings.yml file of the SearXNG App (via File Manager)
OpenWebUI Setup
In OpenWebUI, go to Admin Settings → Web Search
Enter URL: Paste the Searxng URL but replace <searx app id> and <searx port>
http://<searx app id>:<searx port>/search?q=<query>&language=auto&time_range=&safesearch=0&categories=social+media,map,it,general,science,news&format=json
This bypasses OAuth internally so that OpenWebUI directly accesses SearXNG