You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.7 KiB
1.7 KiB
Ollama HTTP API — Overview
Base: OLLAMA_BASE_URL (default http://10.100.1.26:11434)
Health / version
curl -s http://10.100.1.26:11434/api/version
# {"version":"0.30.8"}
curl -s http://10.100.1.26:11434/api/tags
Chat (POST /api/chat)
Model: qwen2.5:7b
curl -s http://10.100.1.26:11434/api/chat -d '{
"model": "qwen2.5:7b",
"messages": [{"role": "user", "content": "Halo"}],
"stream": false
}'
Embeddings (POST /api/embeddings)
Model: nomic-embed-text
curl -s http://10.100.1.26:11434/api/embeddings -d '{
"model": "nomic-embed-text",
"prompt": "teks untuk di-embed"
}'
Response: array embedding (768 dimensi untuk nomic-embed-text).
Generate (POST /api/generate)
Alternatif non-chat (prompt tunggal):
curl -s http://10.100.1.26:11434/api/generate -d '{
"model": "qwen2.5:7b",
"prompt": "Jelaskan SPF record",
"stream": false
}'
Integrasi geonet-console
| File | Fungsi |
|---|---|
config/ollama.php |
Env mapping |
app/Services/OllamaService.php |
HTTP client |
Env di server .24 (contoh):
OLLAMA_BASE_URL=http://10.100.1.26:11434
OLLAMA_CHAT_MODEL=qwen2.5:7b
OLLAMA_EMBED_MODEL=nomic-embed-text
OLLAMA_TIMEOUT=120
Error umum
| Gejala | Penyebab | Tindakan |
|---|---|---|
| Connection refused | Ollama down / UFW | systemctl status ollama, cek UFW |
| Timeout | Model besar + prompt panjang | Naik OLLAMA_TIMEOUT, kurangi context |
| 404 model | Belum pull | ollama pull <model> di VM |
Security
- API tanpa auth — andalkan network segmentation (VLAN only)
- Jangan tambahkan reverse proxy publik tanpa auth layer