|
70267
|
2519
|
6
|
2026-05-22T09:40:08.757562+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442808757_m1.jpg...
|
Firefox
|
CloudWatch | eu-west-1 — Work
|
1
|
eu-west-1.console.aws.amazon.com/cloudwatch/home?r eu-west-1.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logsV2:logs-insights$3FqueryDetail$3D~(end~0~start~-43200~timeType~'RELATIVE~tz~'UTC~unit~'seconds~editorString~'fields*20*40timestamp*2c*20*40message*2c*20*40logStream*2c*20*40log*0a*7c*20filter*20*40message*20like*20*2f31264367*2f*20*0a*23*20*7c*20filter*20*40message*20not*20like*20*2fAnalytic*2f*20*7c*20filter*20*40message*20not*20like*20*2fTranscript*2f*0a*23*20*7c*20filter*20*40message*20not*20like*20*2fWebhook*2f*20*7c*20filter*20*40message*20not*20like*20*2fMeetingBot*2f*20*0a*7c*20limit*2010000~queryId~'0551e814-f51a-4339-8372-80d7ba4cef27~source~(~'*2a)~lang~'CWLI~logClass~'STANDARD~accountIDs~(~'All)~queryBy~'allLogGroups)...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
iTerm2ShellEditViewSessionScriptsProfilesWindowHel iTerm2ShellEditViewSessionScriptsProfilesWindowHelplahl•-zshDOCKER0 81DEV (-zsh)O $82APP (-zsh)screenpipe*84-zshAdm1n@DXP4800PLUS-B5F8:~$cd/volume2/docker/polyglothsudodockercompose build[sudo] password for Admin:[+] Building 1.7s (11/11) FINISHED=> [lang-subsinternal]load builddefinition from Dockerfile=>transferring dockerfile:419B→ [lang-subs internal] load metadata for docker.io/library/python:3.12-slim=> [lang-subsinternal]loaddockerignore= => transferring context: 2B= [lang-subs 1/6] FROM docker.io/library/python:3.12-slim@sha256:9d3abd9fc11d06998ccdbdd93b4dd49b5ad7d67fcbbc11c016eb0eb2c2194891=>[lang-subsinternal]load build context=> transferringcontext: 17.29kB=> CACHED [lang-subs 2/6]RUNapt-getupdate && apt-get install-y --no-install-recommendsffmpeg&& rm-rf /var/lib/apt/lists/*=> CACHED [lang-subs 3/6]WORKDIR /app=> CACHED [lang-subs 4/6]COPY requirements.txt=> CACHED [Lang-subs 5/6] RUN pip install--no-cache-dir -r requirements.txt= [lang-subs 6/6] COPY lang_subs.py[lang-subs]exporting toimage= exportinglayers== writingimage sha256:e7b015a420bc2f4a949476ff04d4341276aa701947f508eee59469530f65ee83=>= naming to docker.io/library/polygloth-lang-subsAdm1n@DXP4800PLUS-B5F8:/volume2/docker/polygloth$sudo rm -rf media/.lang_subs_cache/Sto.Para.5.S01E01Adm1n@DXP4800PLUS-B5F8:/volume2/docker/polygloth$sudo./run.sh Sto.Para.5.S01E01.mkv --duration 300Video:Sto.Para.5.S01E01.mkvCache: /media/.lang_subs_cache/Sto.Para.5.S01E01[1/4] Extracting audio...Extracting audio (first 300s)...[2/4] Transcribing...Transcribing with large-v3...Warning: You are sending unauthenticated requests to the HF Hub. Pleaseset a HF_TOKEN to enable higher rate limits and faster downloads.6 segments[3/4] Annotating with Claude...Segments 0-5...[4/4] Rendering outputs...Written: /media/Sto.Para.5.S01E01.assWritten: /media/Sto.Para.5.S01E01.study.mdDone.Adm1n@DXP4800PLUS-B5F8:/volume2/docker/polygloths Connection to [IP_ADDRESS] closed by remote host.Connection to [IP_ADDRESS] closed.lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ |100% <478•Fri 22 May 10:26:32T81-zshdocker:default0.050.050.950.050.050.050.0s0.050.050.0s0.[IP_ADDRESS].150.050.0s...
|
NULL
|
-1390722132940296198
|
NULL
|
click
|
ocr
|
NULL
|
iTerm2ShellEditViewSessionScriptsProfilesWindowHel iTerm2ShellEditViewSessionScriptsProfilesWindowHelplahl•-zshDOCKER0 81DEV (-zsh)O $82APP (-zsh)screenpipe*84-zshAdm1n@DXP4800PLUS-B5F8:~$cd/volume2/docker/polyglothsudodockercompose build[sudo] password for Admin:[+] Building 1.7s (11/11) FINISHED=> [lang-subsinternal]load builddefinition from Dockerfile=>transferring dockerfile:419B→ [lang-subs internal] load metadata for docker.io/library/python:3.12-slim=> [lang-subsinternal]loaddockerignore= => transferring context: 2B= [lang-subs 1/6] FROM docker.io/library/python:3.12-slim@sha256:9d3abd9fc11d06998ccdbdd93b4dd49b5ad7d67fcbbc11c016eb0eb2c2194891=>[lang-subsinternal]load build context=> transferringcontext: 17.29kB=> CACHED [lang-subs 2/6]RUNapt-getupdate && apt-get install-y --no-install-recommendsffmpeg&& rm-rf /var/lib/apt/lists/*=> CACHED [lang-subs 3/6]WORKDIR /app=> CACHED [lang-subs 4/6]COPY requirements.txt=> CACHED [Lang-subs 5/6] RUN pip install--no-cache-dir -r requirements.txt= [lang-subs 6/6] COPY lang_subs.py[lang-subs]exporting toimage= exportinglayers== writingimage sha256:e7b015a420bc2f4a949476ff04d4341276aa701947f508eee59469530f65ee83=>= naming to docker.io/library/polygloth-lang-subsAdm1n@DXP4800PLUS-B5F8:/volume2/docker/polygloth$sudo rm -rf media/.lang_subs_cache/Sto.Para.5.S01E01Adm1n@DXP4800PLUS-B5F8:/volume2/docker/polygloth$sudo./run.sh Sto.Para.5.S01E01.mkv --duration 300Video:Sto.Para.5.S01E01.mkvCache: /media/.lang_subs_cache/Sto.Para.5.S01E01[1/4] Extracting audio...Extracting audio (first 300s)...[2/4] Transcribing...Transcribing with large-v3...Warning: You are sending unauthenticated requests to the HF Hub. Pleaseset a HF_TOKEN to enable higher rate limits and faster downloads.6 segments[3/4] Annotating with Claude...Segments 0-5...[4/4] Rendering outputs...Written: /media/Sto.Para.5.S01E01.assWritten: /media/Sto.Para.5.S01E01.study.mdDone.Adm1n@DXP4800PLUS-B5F8:/volume2/docker/polygloths Connection to [IP_ADDRESS] closed by remote host.Connection to [IP_ADDRESS] closed.lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ |100% <478•Fri 22 May 10:26:32T81-zshdocker:default0.050.050.950.050.050.050.0s0.050.050.0s0.[IP_ADDRESS].150.050.0s...
|
70265
|
NULL
|
NULL
|
NULL
|
|
70266
|
2520
|
5
|
2026-05-22T09:39:43.037764+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442783037_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
6896172417860166294
|
-2451737070350939829
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)...
|
70264
|
NULL
|
NULL
|
NULL
|
|
70265
|
2519
|
5
|
2026-05-22T09:39:42.299597+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442782299_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model)....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How to use it in your setup:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Ollama","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(running the model).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
5762791969126151011
|
-2451665052339289781
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model)....
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70264
|
2520
|
4
|
2026-05-22T09:39:12.664307+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442752664_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
6406779529826580598
|
-183048758144938999
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70263
|
2519
|
4
|
2026-05-22T09:39:12.005821+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442752005_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
8158548937626598731
|
-2451737070350939829
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response...
|
70261
|
NULL
|
NULL
|
NULL
|
|
70262
|
2520
|
3
|
2026-05-22T09:38:42.270552+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442722270_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
1349827235250493119
|
-2488926883046896631
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings...
|
70260
|
NULL
|
NULL
|
NULL
|
|
70261
|
2519
|
3
|
2026-05-22T09:38:41.779321+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442721779_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
3858844299781242768
|
-2451665052339322549
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70260
|
2520
|
2
|
2026-05-22T09:38:12.049244+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442692049_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-3481993138214195528
|
-2489313996919681719
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70259
|
2519
|
2
|
2026-05-22T09:38:11.552044+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442691552_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama)....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-1995155523089323478
|
-2451665121058799285
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama)....
|
70257
|
NULL
|
NULL
|
NULL
|
|
70258
|
2520
|
1
|
2026-05-22T09:37:41.621403+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442661621_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-4546542285391979783
|
-2451737070350939829
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(...
|
70256
|
NULL
|
NULL
|
NULL
|
|
70257
|
2519
|
1
|
2026-05-22T09:37:41.295091+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442661295_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
8480299269412947323
|
-2451174120397518517
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70256
|
2520
|
0
|
2026-05-22T09:37:11.413085+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442631413_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
2059472372394469999
|
-2489032521942841013
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70255
|
2519
|
0
|
2026-05-22T09:37:10.929022+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442630929_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-33540931617047408
|
-2490017667181621941
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse...
|
70253
|
NULL
|
NULL
|
NULL
|
|
70254
|
NULL
|
0
|
2026-05-22T09:36:40.936233+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442600936_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
6675079614995412968
|
-2451737070350939829
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:...
|
70252
|
NULL
|
NULL
|
NULL
|
|
70253
|
NULL
|
0
|
2026-05-22T09:36:40.714486+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442600714_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-6789235161897427252
|
-2451737070350939829
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70252
|
2518
|
34
|
2026-05-22T09:36:10.506518+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442570506_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
1105128055149720637
|
-2489357859289969399
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response....
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70251
|
2517
|
36
|
2026-05-22T09:36:10.424095+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442570424_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
9076617727634157670
|
-183365434673607671
|
idle
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using...
|
70249
|
NULL
|
NULL
|
NULL
|
|
70250
|
2518
|
33
|
2026-05-22T09:35:40.231197+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442540231_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false}]...
|
-6919629553959714201
|
-2489313996919681719
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save...
|
70247
|
NULL
|
NULL
|
NULL
|
|
70249
|
2517
|
35
|
2026-05-22T09:35:40.124833+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442540124_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
1297922265703966617
|
-2451737070350939829
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70248
|
2517
|
34
|
2026-05-22T09:35:37.895641+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442537895_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How to use it in your setup:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-6089285619601383587
|
-2451665121058766517
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:...
|
70246
|
NULL
|
NULL
|
NULL
|
|
70247
|
2518
|
32
|
2026-05-22T09:35:37.794085+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442537794_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
7163174264809183981
|
-2489032521942839989
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70246
|
2517
|
33
|
2026-05-22T09:35:35.992906+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442535992_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How to use it in your setup:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Ollama","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(running the model).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Open WebUI","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
3084943777111868091
|
-2450539152432447221
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70245
|
2518
|
31
|
2026-05-22T09:35:35.888636+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442535888_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
6031579354451643258
|
-184218518559798263
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:...
|
70244
|
NULL
|
NULL
|
NULL
|
|
70244
|
2518
|
30
|
2026-05-22T09:35:33.724960+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442533724_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-7588563028043043975
|
-2490017684378138293
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling....
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70243
|
2517
|
32
|
2026-05-22T09:35:33.619946+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442533619_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
8280811074976715320
|
-2451665052339322549
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting....
|
70242
|
NULL
|
NULL
|
NULL
|
|
70242
|
2517
|
31
|
2026-05-22T09:35:32.165690+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442532165_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI
(to chat with the model visually).
You use the Ollama API directly
(using
curl
or Python) if you need to integrate the model into a custom application, script, or website.
Summary Checklist
Summary Checklist
GOAL
TOOL TO USE
ENDPOINT
ACCESS METHOD...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How to use it in your setup:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Ollama","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(running the model).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Open WebUI","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(to chat with the model visually).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You use the Ollama API directly","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(using","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or Python) if you need to integrate the model into a custom application, script, or website.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Summary Checklist","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Summary Checklist","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GOAL","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"TOOL TO USE","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ENDPOINT","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACCESS METHOD","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
4721122089650532282
|
-2451665121058799349
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI
(to chat with the model visually).
You use the Ollama API directly
(using
curl
or Python) if you need to integrate the model into a custom application, script, or website.
Summary Checklist
Summary Checklist
GOAL
TOOL TO USE
ENDPOINT
ACCESS METHOD...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70241
|
2518
|
29
|
2026-05-22T09:35:31.960210+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442531960_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false}]...
|
-6919629553959714201
|
-2489313996919681719
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save...
|
70239
|
NULL
|
NULL
|
NULL
|
|
70240
|
2517
|
30
|
2026-05-22T09:35:31.110963+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442531110_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI
(to chat with the model visually).
You use the Ollama API directly
(using
curl
or Python) if you need to integrate the model into a custom application, script, or website.
Summary Checklist
Summary Checklist
GOAL
TOOL TO USE
ENDPOINT
ACCESS METHOD
Self-hosted Model Access
Ollama
http://[IP]:11434
REST API (POST requests)
Graphical Chatting
Open WebUI
(Web Interface)
Browser
Programmatic API Calls
curl
or...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How to use it in your setup:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Ollama","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(running the model).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Open WebUI","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(to chat with the model visually).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You use the Ollama API directly","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(using","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or Python) if you need to integrate the model into a custom application, script, or website.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Summary Checklist","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Summary Checklist","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GOAL","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"TOOL TO USE","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ENDPOINT","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACCESS METHOD","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Self-hosted Model Access","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[IP]:11434","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"REST API (POST requests)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Graphical Chatting","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(Web Interface)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Browser","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Programmatic API Calls","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":28,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
1688145356636207531
|
-2451665121054605045
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI
(to chat with the model visually).
You use the Ollama API directly
(using
curl
or Python) if you need to integrate the model into a custom application, script, or website.
Summary Checklist
Summary Checklist
GOAL
TOOL TO USE
ENDPOINT
ACCESS METHOD
Self-hosted Model Access
Ollama
http://[IP]:11434
REST API (POST requests)
Graphical Chatting
Open WebUI
(Web Interface)
Browser
Programmatic API Calls
curl
or...
|
70238
|
NULL
|
NULL
|
NULL
|
|
70239
|
2518
|
28
|
2026-05-22T09:35:31.009057+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442531009_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
6207242801849978895
|
-2489014929756796597
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70238
|
2517
|
29
|
2026-05-22T09:35:29.333834+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442529333_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model)....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How to use it in your setup:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Ollama","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(running the model).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
5762791969126151011
|
-2451665052339289781
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model)....
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70237
|
2518
|
27
|
2026-05-22T09:35:29.231487+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442529231_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
5226888857886296305
|
-2489032521942839991
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d...
|
70235
|
NULL
|
NULL
|
NULL
|
|
70236
|
2517
|
28
|
2026-05-22T09:35:28.005367+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442528005_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-7075496483618393896
|
-2451737070350939829
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:...
|
70234
|
NULL
|
NULL
|
NULL
|
|
70235
|
2518
|
26
|
2026-05-22T09:35:27.893435+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442527893_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-1043008702994169927
|
-2488926883044799479
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings....
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70234
|
2517
|
27
|
2026-05-22T09:35:26.011388+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442526011_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI
(to chat with the model visually).
You use the Ollama API directly
(using
curl
or Python) if you need to integrate the model into a custom application, script, or website.
Summary Checklist
Summary Checklist
GOAL
TOOL TO USE
ENDPOINT
ACCESS METHOD
Self-hosted Model Access
Ollama
http://[IP]:11434
REST API (POST requests)
Graphical Chatting
Open WebUI
(Web Interface)
Browser
Programmatic API Calls
curl
or
Python (
requests
)
/api/chat
or
/api/generate
HTTP Request...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How to use it in your setup:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Ollama","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(running the model).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Open WebUI","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(to chat with the model visually).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You use the Ollama API directly","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(using","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or Python) if you need to integrate the model into a custom application, script, or website.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Summary Checklist","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Summary Checklist","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GOAL","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"TOOL TO USE","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ENDPOINT","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACCESS METHOD","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Self-hosted Model Access","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[IP]:11434","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"REST API (POST requests)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Graphical Chatting","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(Web Interface)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Browser","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Programmatic API Calls","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":28,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python (","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":28,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":27,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"HTTP Request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-2248754897989245558
|
-2451665052335128245
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI
(to chat with the model visually).
You use the Ollama API directly
(using
curl
or Python) if you need to integrate the model into a custom application, script, or website.
Summary Checklist
Summary Checklist
GOAL
TOOL TO USE
ENDPOINT
ACCESS METHOD
Self-hosted Model Access
Ollama
http://[IP]:11434
REST API (POST requests)
Graphical Chatting
Open WebUI
(Web Interface)
Browser
Programmatic API Calls
curl
or
Python (
requests
)
/api/chat
or
/api/generate
HTTP Request...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70233
|
2518
|
25
|
2026-05-22T09:35:25.703047+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442525703_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8794110749422252904
|
-2451174120397518517
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint...
|
70231
|
NULL
|
NULL
|
NULL
|
|
70232
|
2517
|
26
|
2026-05-22T09:35:24.956436+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442524956_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI
(to chat with the model visually).
You use the Ollama API directly
(using
curl
or Python) if you need to integrate the model into a custom application, script, or website.
Summary Checklist
Summary Checklist
GOAL...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How to use it in your setup:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Ollama","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(running the model).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Open WebUI","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(to chat with the model visually).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You use the Ollama API directly","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(using","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or Python) if you need to integrate the model into a custom application, script, or website.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Summary Checklist","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Summary Checklist","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GOAL","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-2282393194155040943
|
-2451735489798782709
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI
(to chat with the model visually).
You use the Ollama API directly
(using
curl
or Python) if you need to integrate the model into a custom application, script, or website.
Summary Checklist
Summary Checklist
GOAL...
|
70230
|
NULL
|
NULL
|
NULL
|
|
70231
|
2518
|
24
|
2026-05-22T09:35:24.642475+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442524642_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
379433908308050886
|
-2489032524107231991
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70230
|
2517
|
25
|
2026-05-22T09:35:23.851705+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442523851_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-9202823230247250657
|
-2451737070350939829
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70229
|
2518
|
23
|
2026-05-22T09:35:23.748745+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442523748_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
7426095932511316833
|
-2489032521942839989
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X...
|
70228
|
NULL
|
NULL
|
NULL
|
|
70228
|
2518
|
22
|
2026-05-22T09:35:20.595846+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442520595_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false}]...
|
-1889492996065155850
|
-2499024866436362933
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70227
|
2517
|
24
|
2026-05-22T09:35:20.492782+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442520492_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI
(to chat with the model visually).
You use the Ollama API directly...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How to use it in your setup:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Ollama","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(running the model).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Open WebUI","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(to chat with the model visually).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You use the Ollama API directly","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-1237160362953915034
|
-2450539152432447221
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI
(to chat with the model visually).
You use the Ollama API directly...
|
70226
|
NULL
|
NULL
|
NULL
|
|
70226
|
2517
|
23
|
2026-05-22T09:35:19.303141+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442519303_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How to use it in your setup:","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Ollama","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(running the model).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You set up Open WebUI","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
3084943777111868091
|
-2450539152432447221
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama).
How to use it in your setup:
You set up Ollama
(running the model).
You set up Open WebUI...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70225
|
2518
|
21
|
2026-05-22T09:35:19.198074+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442519198_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8788282192756342434
|
-184359256048153591
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint...
|
70223
|
NULL
|
NULL
|
NULL
|
|
70224
|
2517
|
22
|
2026-05-22T09:35:17.602240+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442517602_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama)....
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"library, is the easiest way to interact with the Ollama API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"python","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Run","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Run","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","depth":24,"on_screen":false,"value":"import requestsimport json\n# 1. Define the API endpointurl = \"http://localhost:11434/api/generate\"\n# 2. Define the request payload (what you are sending)payload = { \"model\": \"llama3\", \"prompt\": \"Explain the difference between Ollama and Open WebUI.\", \"stream\": False}\n# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print(\"Generated Response:\") print(result.get(\"response\"))\nexcept requests.exceptions.RequestException as e: print(f\"An error occurred: {e}\")","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"import","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 1. Define the API endpoint","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"http://localhost:11434/api/generate\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 2. Define the request payload (what you are sending)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"llama3\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Explain the difference between Ollama and Open WebUI.\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"False","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 3. Make the POST request","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"try","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"post","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"url","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"payload","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"raise_for_status","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Raise an exception for bad status codes (4xx or 5xx)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# 4. Parse the JSON response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"=","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"response","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"()","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"# Print the generated text","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"Generated Response:\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"result","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"get","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"response\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"))","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"except","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"requests","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"exceptions","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":".","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"RequestException","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"as","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"print","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"f\"An error occurred:","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"e","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"4. The Role of Open WebUI","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4. The Role of Open WebUI","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is a powerful frontend tool that provides a graphical interface for chatting.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Does it expose an API?","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Generally,","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"no","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":", not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"with","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"the backend (Ollama).","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-1995155523089323478
|
-2451665121058799285
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the
requests
library, is the easiest way to interact with the Ollama API.
python
Collapse
Collapse
Run
Run
Save
Copy
import requestsimport json
# 1. Define the API endpointurl = "http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)payload = { "model": "llama3", "prompt": "Explain the difference between Ollama and Open WebUI.", "stream": False}
# 3. Make the POST requesttry: response = requests.post(url, json=payload) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) # 4. Parse the JSON response result = response.json() # Print the generated text print("Generated Response:") print(result.get("response"))
except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
import
requests
import
json
# 1. Define the API endpoint
url
=
"http://localhost:11434/api/generate"
# 2. Define the request payload (what you are sending)
payload
=
{
"model"
:
"llama3"
,
"prompt"
:
"Explain the difference between Ollama and Open WebUI."
,
"stream"
:
False
}
# 3. Make the POST request
try
:
response
=
requests
.
post
(
url
,
json
=
payload
)
response
.
raise_for_status
()
# Raise an exception for bad status codes (4xx or 5xx)
# 4. Parse the JSON response
result
=
response
.
json
()
# Print the generated text
print
(
"Generated Response:"
)
print
(
result
.
get
(
"response"
))
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
f"An error occurred:
{
e
}
"
)
4. The Role of Open WebUI
4. The Role of Open WebUI
Open WebUI
is a powerful frontend tool that provides a graphical interface for chatting.
Does it expose an API?
Generally,
no
, not as a primary source for programmatic API calls. Open WebUI acts as a client that communicates
with
the backend (Ollama)....
|
70221
|
NULL
|
NULL
|
NULL
|
|
70223
|
2518
|
20
|
2026-05-22T09:35:17.498248+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442517498_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-5490132755198640179
|
-2489313996936327927
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70222
|
2518
|
19
|
2026-05-22T09:35:15.777201+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442515777_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-4876089211738686386
|
-2488891784337175287
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",...
|
70219
|
NULL
|
NULL
|
NULL
|
|
70221
|
2517
|
21
|
2026-05-22T09:35:15.676353+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442515676_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-5106852212529967994
|
-2489032521959618229
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70220
|
2517
|
20
|
2026-05-22T09:35:12.241260+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442512241_m1.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.48576388,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.5086806,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.53194445,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.5552083,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5784722,"top":0.0,"width":0.022222223,"height":0.035555556},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.6319444,"top":0.0,"width":0.019444445,"height":0.031111112},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"}]...
|
25716445998200176
|
-4796045275549285367
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint...
|
70217
|
NULL
|
NULL
|
NULL
|
|
70219
|
2518
|
18
|
2026-05-22T09:35:12.138955+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442512138_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-1892936976708263018
|
968702985091007497
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation...
|
NULL
|
NULL
|
NULL
|
NULL
|
|
70218
|
2518
|
17
|
2026-05-22T09:35:10.694465+00:00
|
/Users/lukas/.screenpipe/data/data/2026-05-22/1779 /Users/lukas/.screenpipe/data/data/2026-05-22/1779442510694_m2.jpg...
|
Firefox
|
Ollama API Setup 💻 • Open WebUI — Personal
|
1
|
ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371 ai.chat.lakylak.xyz/c/ac2a9877-420f-403e-bc4f-4371a1766cfa...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":4,"bounds":{"left":0.5,"top":0.0518755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nvidia's RTX HDR feature is game-changing (literally) - kovaliklukas@gmail.com - Gmail","depth":5,"bounds":{"left":0.51329786,"top":0.06304868,"width":0.15292554,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ambulatory sheet - Paperless-ngx","depth":4,"bounds":{"left":0.5,"top":0.08459697,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ambulatory sheet - Paperless-ngx","depth":5,"bounds":{"left":0.51329786,"top":0.09577015,"width":0.059507977,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":4,"bounds":{"left":0.5,"top":0.11731844,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"💬1 - Apple MacBook Pro 14\" Space Black M5 Max | Laptop.bg - Технологията с теб","depth":5,"bounds":{"left":0.51329786,"top":0.12849163,"width":0.14727394,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":4,"bounds":{"left":0.5,"top":0.15003991,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа","depth":5,"bounds":{"left":0.51329786,"top":0.16121309,"width":0.2365359,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Welcome to authentik! - authentik","depth":4,"bounds":{"left":0.5,"top":0.18276137,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Welcome to authentik! - authentik","depth":5,"bounds":{"left":0.51329786,"top":0.19393456,"width":0.05900931,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Завеждане на щета онлайн | Euroins","depth":4,"bounds":{"left":0.5,"top":0.21548285,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Завеждане на щета онлайн | Euroins","depth":5,"bounds":{"left":0.51329786,"top":0.22665602,"width":0.0653258,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Screenpipe — Archive","depth":4,"bounds":{"left":0.5,"top":0.2482043,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Screenpipe — Archive","depth":5,"bounds":{"left":0.51329786,"top":0.25937748,"width":0.037898935,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Reminders","depth":4,"bounds":{"left":0.5,"top":0.28092578,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Reminders","depth":5,"bounds":{"left":0.51329786,"top":0.29209897,"width":0.018284574,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Photos - Google Photos","depth":4,"bounds":{"left":0.5,"top":0.31364724,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Photos - Google Photos","depth":5,"bounds":{"left":0.51329786,"top":0.32482043,"width":0.04138963,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"DXP4800PLUS-B5F8","depth":4,"bounds":{"left":0.5,"top":0.3463687,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"DXP4800PLUS-B5F8","depth":5,"bounds":{"left":0.51329786,"top":0.3575419,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.3790902,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.39026338,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Nginx Proxy Manager","depth":4,"bounds":{"left":0.5,"top":0.41181165,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Nginx Proxy Manager","depth":5,"bounds":{"left":0.51329786,"top":0.42298484,"width":0.036901597,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ollama API Setup 💻 • Open WebUI","depth":4,"bounds":{"left":0.5,"top":0.4445331,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ollama API Setup 💻 • Open WebUI","depth":5,"bounds":{"left":0.51329786,"top":0.4557063,"width":0.060837764,"height":0.011572227},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.55651593,"top":0.4517159,"width":0.007978723,"height":0.01915403},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Location Logger","depth":4,"bounds":{"left":0.5,"top":0.4772546,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Location Logger","depth":5,"bounds":{"left":0.51329786,"top":0.4884278,"width":0.028091755,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Sign in – Google accounts","depth":4,"bounds":{"left":0.5,"top":0.509976,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sign in – Google accounts","depth":5,"bounds":{"left":0.51329786,"top":0.5211492,"width":0.04537899,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"New Tab","depth":4,"bounds":{"left":0.5,"top":0.54269755,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"New Tab","depth":5,"bounds":{"left":0.51329786,"top":0.55387074,"width":0.014960106,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"API Keys | Claude Platform","depth":4,"bounds":{"left":0.5,"top":0.575419,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"API Keys | Claude Platform","depth":5,"bounds":{"left":0.51329786,"top":0.5865922,"width":0.046043884,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Notion","depth":4,"bounds":{"left":0.5,"top":0.60814047,"width":0.06881649,"height":0.032721467},"on_screen":true,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Notion","depth":5,"bounds":{"left":0.51329786,"top":0.61931366,"width":0.011469414,"height":0.010774142},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.5028258,"top":0.6424581,"width":0.06333112,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.5028258,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.51379657,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.5249335,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.53607047,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Bitwarden [9+]","depth":6,"bounds":{"left":0.5472075,"top":0.97007185,"width":0.010638298,"height":0.025538707},"on_screen":true,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar New Chat Search Notes Workspace","depth":10,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.9010375},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open Sidebar","depth":12,"bounds":{"left":0.57147604,"top":0.057462092,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"New Chat","depth":12,"bounds":{"left":0.57147604,"top":0.0905826,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Search","depth":12,"bounds":{"left":0.57147604,"top":0.11931365,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Notes","depth":12,"bounds":{"left":0.57147604,"top":0.14804469,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Workspace","depth":12,"bounds":{"left":0.57147604,"top":0.17677574,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Open User Profile Menu","depth":10,"bounds":{"left":0.5728058,"top":0.9648843,"width":0.00930851,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Selected model: gemma4:e2b","depth":16,"bounds":{"left":0.5909242,"top":0.05905826,"width":0.043550532,"height":0.022346368},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"gemma4:e2b","depth":18,"bounds":{"left":0.5915891,"top":0.061851557,"width":0.03557181,"height":0.01715882},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Add Model","depth":16,"bounds":{"left":0.6371343,"top":0.06424581,"width":0.004654255,"height":0.011173184},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Controls","depth":14,"bounds":{"left":0.97207445,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"User menu","depth":13,"bounds":{"left":0.9840425,"top":0.055067837,"width":0.011968086,"height":0.028731046},"on_screen":true,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"User menu","depth":15,"bounds":{"left":0.9896942,"top":0.061053474,"width":0.010305822,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Chat Conversation","depth":15,"bounds":{"left":0.5859375,"top":0.07980846,"width":0.0003324468,"height":0.0007980846},"on_screen":true,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Chat Conversation","depth":16,"bounds":{"left":0.5859375,"top":0.08180367,"width":0.04454787,"height":0.015163607},"on_screen":true,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"gemma4:e2b","depth":21,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Thought for 2 minutes","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is the service that exposes the REST API, while","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Open WebUI","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"is primarily a graphical user interface (GUI) for chatting with those models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Here is a complete guide on how you can access and interact with your self-hosted model via API.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"1. Understanding Ollama as the API Endpoint","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1. Understanding Ollama as the API Endpoint","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"A. Default API URL","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"A. Default API URL","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"By default, Ollama runs on:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"URL:","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://localhost:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if running on the same machine)","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"or","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"http://[Your_Server_IP]:11434","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(if you are accessing it from another device on your local network).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"B. API Methods","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"B. API Methods","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ollama uses standard HTTP methods (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":") to interact with its endpoints. The most common endpoints for generating text are:","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating a single response based on a prompt.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For multi-turn conversations (simulating a chat interface).","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/embeddings","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":": For generating vector embeddings.","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"2. How to Make the REST API Call (Using curl)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2. How to Make the REST API Call (Using","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You can use command-line tools like","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"curl","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to test and interact with the Ollama API directly.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 1: Single Generation Call (/api/generate)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 1: Single Generation Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/generate","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This example sends a prompt to the model and waits for the generated response.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/generate -d '{ \"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral) \"prompt\": \"Write a short poem about self-hosting AI.\", \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/generate","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\", // Replace with the model you have downloaded (e.g., llama3, mistral)","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"prompt\": \"Write a short poem about self-hosting AI.\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Example 2: Chat Completion Call (/api/chat)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Example 2: Chat Completion Call (","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/chat","depth":23,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":")","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"This is better for conversational use, as it maintains context.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"bash","depth":25,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse","depth":24,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Save","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Copy","depth":22,"on_screen":false,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextArea","text":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","depth":24,"on_screen":false,"value":"curl -X POST http://localhost:11434/api/chat -d '{ \"model\": \"llama3\", \"messages\": [ {\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"} ], \"stream\": false}'","help_text":"","role_description":"text entry area","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"curl","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-X","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST http://localhost:11434/api/chat","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"-d","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"'{","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"model\": \"llama3\",","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"messages\": [","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"{\"role\": \"user\", \"content\": \"What are the benefits of using self-hosted models?\"}","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"],","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"\"stream\": false","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"}'","depth":26,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"3. Using Programming Languages (The Professional Way)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3. Using Programming Languages (The Professional Way)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Python Example (Recommended)","depth":21,"on_screen":false,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python Example (Recommended)","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Python, with the","depth":22,"on_screen":false,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8473022311461692248
|
-2488891784471426741
|
typing_pause
|
accessibility
|
NULL
|
Nvidia's RTX HDR feature is game-changing (lit Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Nvidia's RTX HDR feature is game-changing (literally) - [EMAIL] - Gmail
Ambulatory sheet - Paperless-ngx
Ambulatory sheet - Paperless-ngx
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
💬1 - Apple MacBook Pro 14" Space Black M5 Max | Laptop.bg - Технологията с теб
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Apple Mac Studio M4 Max | Desktop.bg - Мощни PC Гейминг конфигурации, Персонални компютри на изплащане за игри и работа
Welcome to authentik! - authentik
Welcome to authentik! - authentik
Завеждане на щета онлайн | Euroins
Завеждане на щета онлайн | Euroins
Screenpipe — Archive
Screenpipe — Archive
Reminders
Reminders
Photos - Google Photos
Photos - Google Photos
DXP4800PLUS-B5F8
DXP4800PLUS-B5F8
New Tab
New Tab
Nginx Proxy Manager
Nginx Proxy Manager
Ollama API Setup 💻 • Open WebUI
Ollama API Setup 💻 • Open WebUI
Close tab
Location Logger
Location Logger
Sign in – Google accounts
Sign in – Google accounts
New Tab
New Tab
API Keys | Claude Platform
API Keys | Claude Platform
Notion
Notion
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Open history (⇧⌘H)
Open bookmarks (⌘B)
Bitwarden [9+]
Open Sidebar New Chat Search Notes Workspace
Open Sidebar
New Chat
Search
Notes
Workspace
Open User Profile Menu
Selected model: gemma4:e2b
gemma4:e2b
Add Model
Controls
User menu
User menu
Chat Conversation
Chat Conversation
How can I access api via url and make rest api call to ollama or open web ui. i want to use selfhosted model
gemma4:e2b
Thought for 2 minutes
This is a very common setup when deploying self-hosted LLMs. The key to accessing your self-hosted model is to understand that
Ollama
is the service that exposes the REST API, while
Open WebUI
is primarily a graphical user interface (GUI) for chatting with those models.
Here is a complete guide on how you can access and interact with your self-hosted model via API.
1. Understanding Ollama as the API Endpoint
1. Understanding Ollama as the API Endpoint
When you install Ollama, it automatically runs a service that exposes a fully compatible REST API. This is the direct endpoint you need to interact with your models.
A. Default API URL
A. Default API URL
By default, Ollama runs on:
URL:
http://localhost:11434
(if running on the same machine)
or
http://[Your_Server_IP]:11434
(if you are accessing it from another device on your local network).
B. API Methods
B. API Methods
Ollama uses standard HTTP methods (
POST
) to interact with its endpoints. The most common endpoints for generating text are:
/api/generate
: For generating a single response based on a prompt.
/api/chat
: For multi-turn conversations (simulating a chat interface).
/api/embeddings
: For generating vector embeddings.
2. How to Make the REST API Call (Using curl)
2. How to Make the REST API Call (Using
curl
)
You can use command-line tools like
curl
to test and interact with the Ollama API directly.
Example 1: Single Generation Call (/api/generate)
Example 1: Single Generation Call (
/api/generate
)
This example sends a prompt to the model and waits for the generated response.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral) "prompt": "Write a short poem about self-hosting AI.", "stream": false}'
curl
-X
POST http://localhost:11434/api/generate
-d
'{
"model": "llama3", // Replace with the model you have downloaded (e.g., llama3, mistral)
"prompt": "Write a short poem about self-hosting AI.",
"stream": false
}'
Example 2: Chat Completion Call (/api/chat)
Example 2: Chat Completion Call (
/api/chat
)
This is better for conversational use, as it maintains context.
bash
Collapse
Collapse
Save
Copy
curl -X POST http://localhost:11434/api/chat -d '{ "model": "llama3", "messages": [ {"role": "user", "content": "What are the benefits of using self-hosted models?"} ], "stream": false}'
curl
-X
POST http://localhost:11434/api/chat
-d
'{
"model": "llama3",
"messages": [
{"role": "user", "content": "What are the benefits of using self-hosted models?"}
],
"stream": false
}'
3. Using Programming Languages (The Professional Way)
3. Using Programming Languages (The Professional Way)
For robust applications, you will typically use a programming language like Python to handle the HTTP requests, JSON parsing, and error handling.
Python Example (Recommended)
Python Example (Recommended)
Python, with the...
|
70216
|
NULL
|
NULL
|
NULL
|