Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
Ubuntu 24.04 Ollama API Usage: curl /api/tags and /api/chat Guide
Ollama API, qwen3:4b, curl and Ubuntu 24.04

Ollama API on Ubuntu 24.04: curl /api/tags, /api/chat and qwen3:4b Testing Guide

This guide isolates the API layer of our real Ubuntu 24.04.4 LTS + Docker + Ollama qwen3:4b deployment. We verify runtime and model listing through /api/tags, execute a real qwen3:4b inference request through /api/chat with curl, use 127.0.0.1:11434 from the host and http://ollama:11434 from Docker services, and validate CPU/RAM usage plus localhost-only port security with captured test data.

Ubuntu 24.04Ollama APIOllama curlapi/tagsapi/chatqwen3:4bQwen3Local LLM APIDockerSelf Hosted AI11434Linux VPSEKA Sunucu
Ollama / Qwen3 / Open WebUI / Ubuntu 24.04
Host → 127.0.0.1:11434
   ├── GET /api/tags → model list
   └── POST /api/chat → qwen3:4b inference

Docker eka-ai
   └── http://ollama:11434
Ollama0.32.6Open WebUI0.11.0 test
13real WebP screenshots
3TR · EN · DE content
443public HTTPS
127.0.0.1AI service loopback
01/api/tags model listing
02/api/chat real inference
03Host + Docker API addresses
04localhost-only port 11434
00
Table of contents

Ubuntu 24.04 Ollama API usage steps

  1. 01How should the Ollama API be addressed from the host and Docker containers?
  2. 02Verify the Ollama runtime and HTTP access with /api/tags
  3. 03Pull qwen3:4b and verify the model with the Ollama CLI
  4. 04Use /api/tags to verify qwen3:4b as JSON
  5. 05Send a real qwen3:4b message to /api/chat with curl
  6. 06Check model, assistant content and done fields in the chat JSON
  7. 07Monitor post-inference resource usage with ollama ps and Docker stats
  8. 08Use http://ollama:11434 from n8n and Open WebUI containers
  9. 09Keep port 11434 on localhost and verify it is not publicly bound
  10. 10Separate connection-refused, empty-model-list and slow CPU inference cases
  11. 11Keep the essential Ollama API curl and verification commands in one place
  12. 12Make model, volume, logs and API health checks routine
01
API architecture

How should the Ollama API be addressed from the host and Docker containers?

This guide focuses on the HTTP API of the already working Ollama + qwen3:4b stack. Host applications use http://127.0.0.1:11434 while services on the shared eka-ai Docker network can use http://ollama:11434.

This distinction matters because localhost inside a container refers to that container. Separate n8n or Open WebUI containers reach Ollama by the Docker DNS hostname ollama, while the host port remains loopback-only.

Command 1
Host API:   http://127.0.0.1:11434
Docker API: http://ollama:11434
02
First API test

Verify the Ollama runtime and HTTP access with /api/tags

Before any model was downloaded, the real /api/tags request returned HTTP 200 with an empty models array. That proved the HTTP runtime was healthy even though no model was installed yet.

When troubleshooting, run this test before investigating a model problem. If the endpoint does not answer, check the container, port binding and Ollama logs first.

Command 1
curl -sS -w "\nHTTP %{http_code}\n" http://127.0.0.1:11434/api/tags
Command 2
docker logs --tail 80 ollama
03
Model preparation

Pull qwen3:4b and verify the model with the Ollama CLI

After the API was reachable we pulled qwen3:4b inside the container. The real model list showed a size of roughly 2.5 GB.

Our captured API metadata reported parameter_size 4.0B, Q4_K_M quantization and completion, tools and thinking capabilities for the tested model version.

Command 1
docker exec ollama ollama pull qwen3:4b
Command 2
docker exec ollama ollama list
04
JSON model list

Use /api/tags to verify qwen3:4b as JSON

The CLI list is convenient for humans, while /api/tags exposes a JSON model list that integrations can consume. In our real test qwen3:4b appeared with its name, size and model details.

If Open WebUI or n8n cannot see models, call the same endpoint from the host and, when needed, from the relevant container to separate Ollama problems from Docker-network problems.

Command 1
curl -sS http://127.0.0.1:11434/api/tags
Command 2
docker exec ollama ollama list
05
Real inference

Send a real qwen3:4b message to /api/chat with curl

A model appearing in a list does not prove inference works. We therefore sent a real user message to /api/chat and used stream:false to obtain one JSON response.

The real assistant content was EKA-OLLAMA-TEST-BASARILI and the request finished with done:true. This CPU-based test took about 18 seconds.

Command 1
curl -sS http://127.0.0.1:11434/api/chat -H 'Content-Type: application/json' -d '{"model":"qwen3:4b","messages":[{"role":"user","content":"Write only EKA-OLLAMA-TEST-BASARILI."}],"stream":false}'
06
Read the response

Check model, assistant content and done fields in the chat JSON

For the end-to-end check we verified model=qwen3:4b, message.role=assistant, the expected message.content and done:true.

The captured Qwen3 response also included a thinking field. If your application only needs the user-facing answer, message.content is the cleaner field to render.

Command 1
Core fields to inspect:
model
message.role
message.content
done
done_reason
total_duration
07
Running model

Monitor post-inference resource usage with ollama ps and Docker stats

After the real chat request, ollama ps showed qwen3:4b loaded on CPU. In the captured moment the context was 4096 and processor was reported as 100% CPU.

Docker stats showed roughly 3.059 GiB used by the Ollama container. These numbers are only the recorded test moment and vary with prompt length, context, model and concurrency.

Command 1
docker exec ollama ollama ps
Command 2
docker stats --no-stream ollama
08
Container integration

Use http://ollama:11434 from n8n and Open WebUI containers

127.0.0.1 is correct from the host, but localhost inside another container does not point to Ollama. On a shared user-defined network, Docker DNS resolves the hostname ollama.

Our final test summary confirmed http://127.0.0.1:11434 for the host and http://ollama:11434 inside Docker. The same pattern was later used for Open WebUI and n8n integrations.

Command 1
docker network inspect eka-ai
Command 2
docker exec n8n node -e "fetch('http://ollama:11434/api/tags').then(r=>r.text()).then(console.log)"
09
API security

Keep port 11434 on localhost and verify it is not publicly bound

Instead of publishing Ollama directly to the Internet, the real deployment used 127.0.0.1:11434:11434. The ss output confirmed the port only listened on the loopback address.

If remote systems need access, plan TLS, authentication, reverse proxy, VPN or a private network instead of simply binding 0.0.0.0:11434.

Command 1
ss -lntp | grep ':11434'
Command 2
docker ps --filter name='^/ollama$'
10
Troubleshooting

Separate connection-refused, empty-model-list and slow CPU inference cases

If curl cannot connect, first verify the container and the 127.0.0.1:11434 binding. If /api/tags returns HTTP 200 but models is empty, the runtime is up but a model may not be installed yet.

If the model is listed but chat fails, inspect docker logs ollama. If chat works but is slow, use ollama ps and docker stats to inspect CPU and memory; CPU-only inference can have additional model-load latency.

Command 1
docker ps --filter name='^/ollama$'
Command 2
curl -sS http://127.0.0.1:11434/api/tags
Command 3
docker logs --tail 150 ollama
Command 4
docker exec ollama ollama ps
docker stats --no-stream ollama
11
Quick command set

Keep the essential Ollama API curl and verification commands in one place

Model listing and a real chat request are the two fastest integration checks. Add the running-model, container-log and socket checks to quickly identify which layer is failing.

The following commands summarize the host and Docker access pattern used in our real Ubuntu 24.04 test.

Command 1
curl -sS http://127.0.0.1:11434/api/tags
Command 2
curl -sS http://127.0.0.1:11434/api/chat -H 'Content-Type: application/json' -d '{"model":"qwen3:4b","messages":[{"role":"user","content":"Hello"}],"stream":false}'
Command 3
docker exec ollama ollama ps
Command 4
ss -lntp | grep ':11434'
12
Maintenance and production

Make model, volume, logs and API health checks routine

The ollama_data volume keeps model files persistent independently of the container. Define a volume-backup and VPS-snapshot strategy before image updates or container recreation.

After reboot or upgrades, re-check the container, /api/tags, a real /api/chat request and the 11434 binding. That validates the actual inference chain rather than only confirming that a process exists.

Command 1
docker ps --filter name='^/ollama$'
Command 2
curl -sS http://127.0.0.1:11434/api/tags
Command 3
docker exec ollama ollama list
Command 4
ss -lntp | grep ':11434'
Production checklist

Ollama API production security checklist

Do not publish port 11434 directly on 0.0.0.0.
Keep the host API on 127.0.0.1 or a private network.
Use a user-defined Docker network and Docker DNS for container integrations.
Back up the ollama_data volume.
Review model and API logs after updates.
Monitor CPU, memory and disk usage.
Add TLS, authentication, VPN or reverse proxy controls for remote API access.
After reboot, run /api/tags and a real /api/chat test.
R
Official sources

Official Ollama API and model resources

+
EKA Sunucu

Related EKA Sunucu Ollama, Open WebUI and n8n guides

?
FAQ

Frequently asked questions about Ollama API, curl and qwen3:4b

Which port does the Ollama API use?

In this real deployment the host API was used at 127.0.0.1:11434.

What does /api/tags do?

We used it to list installed Ollama models as JSON and quickly verify HTTP runtime access.

What does an empty models array from /api/tags mean?

Our first real test returned HTTP 200 with models:[], showing the runtime was available before a model was installed.

How do I test /api/chat?

POST JSON containing model, messages and stream:false to /api/chat with curl.

What did the qwen3:4b API test return?

The real assistant content returned EKA-OLLAMA-TEST-BASARILI.

Why use stream:false?

We used it to receive one JSON response that was easy to validate in the test.

What is the host-side Ollama API URL?

This architecture uses http://127.0.0.1:11434.

What URL should another Docker container use?

On the eka-ai network we used http://ollama:11434.

Why does localhost fail from another container?

localhost refers to that container itself; use the Ollama container DNS name on a shared Docker network.

How large was qwen3:4b?

The captured ollama list output showed roughly 2.5 GB.

How much RAM did inference use?

At the captured test moment the Ollama container used about 3.059 GiB.

Should port 11434 be public?

We did not expose it publicly; it remained on 127.0.0.1. Add proper controls for remote access.

What should I check if chat is slow?

Use ollama ps and docker stats to inspect CPU and memory. CPU-only inference can be slower depending on model and context.

What should I test after a reboot?

Re-check the container, /api/tags, a real /api/chat request, model listing and the loopback binding.

EKA YAZILIM VE BİLİŞİM SİSTEMLERİ

Need a Linux VPS for Ollama API and local LLM services?

Run Ollama, Qwen3, Open WebUI, n8n and other self-hosted AI services on your own EKA Sunucu Linux VPS.

Updated: 10.08.2026
View Linux VPS PlansLinux & VPS Guides
Top