Wildbox integrates Ollama for local LLM (Large Language Model) processing, providing AI-powered security analysis without sending data to external services.
Ollama is a lightweight, self-hosted LLM runtime that allows you to run models like Llama 2, Code Llama, Mistral, and others locally on your infrastructure.
Privacy: All data stays within your infrastructure Security: No API keys or external dependencies Cost: No per-request charges Speed: Reduced latency for real-time analysis Compliance: Meets data residency requirements
Ollama is already included in docker-compose.yml:
services:
ollama:
image: ollama/ollama:latest
container_name: wildbox-ollama
ports:
- "11434:11434" # Ollama API
environment:
- OLLAMA_ORIGINS=*
volumes:
- llm_cache:/root/.ollama # Model cache
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"]
interval: 30s
timeout: 10s
retries: 3
# Start all services including Ollama
docker-compose up -d
# Verify Ollama is running
curl http://localhost:11434/api/tags
# Pull Llama 2 (recommended for security analysis)
docker exec wildbox-ollama ollama pull llama2
# Or pull a smaller model for faster responses
docker exec wildbox-ollama ollama pull llama2:7b
# For code analysis
docker exec wildbox-ollama ollama pull codellama
| Model | Size | Use Case | Recommended |
|---|---|---|---|
llama2 |
7B/13B/70B | General security analysis | Yes (7B or 13B) |
codellama |
7B/13B | Code review, vulnerability detection | Yes (for code analysis) |
mistral |
7B | Fast general-purpose | ⚡ Good for quick analysis |
phi |
2.7B | Lightweight, fast | For resource-constrained environments |
Note: Larger models provide better analysis but require more RAM (7B ≈ 8GB, 13B ≈ 16GB, 70B ≈ 64GB).
Ollama provides an OpenAI-compatible API endpoint, allowing Wildbox AI services to use it as a drop-in replacement for OpenAI.
In .env:
# Option 1: Use local Ollama (default)
OPENAI_API_KEY=ollama
OPENAI_API_BASE=http://wildbox-ollama:11434/v1
# Option 2: Use OpenAI (requires API key)
OPENAI_API_KEY=sk-your-openai-key
OPENAI_API_BASE=https://api.openai.com/v1
# Test Ollama API (OpenAI-compatible)
curl http://localhost:11434/v1/models
# Test chat completion
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "llama2",
"messages": [{"role": "user", "content": "Analyze this SQL query for injection vulnerabilities: SELECT * FROM users WHERE id = " + userId}]
}'
The AI Agents service automatically uses Ollama for:
Guardian uses LLM for:
If you have an NVIDIA GPU:
services:
ollama:
image: ollama/ollama:latest
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
services:
ollama:
deploy:
resources:
limits:
memory: 16G # Adjust based on model size
reservations:
memory: 8G
docker exec wildbox-ollama ollama list
docker exec wildbox-ollama ollama rm llama2
docker exec wildbox-ollama ollama pull llama2
curl http://localhost:11434/api/tags | jq
docker logs wildbox-ollama --tail 100 -f
docker stats wildbox-ollama
# Check disk space
df -h
# Check network connectivity
docker exec wildbox-ollama curl -I https://ollama.ai
# Retry download
docker exec wildbox-ollama ollama pull llama2
num_thread parameter in model configurationBy default, Ollama is only accessible within the Docker network:
# Good (default): Internal only
networks:
- wildbox-internal
# Bad: Exposed to internet
ports:
- "0.0.0.0:11434:11434" # Don't do this!
Always verify models come from official sources:
# Official Ollama library
docker exec wildbox-ollama ollama pull llama2
# NOT recommended: Unknown sources
# docker exec wildbox-ollama ollama pull untrusted/model
# Create Modelfile
cat > Modelfile <<EOF
FROM llama2
SYSTEM You are a cybersecurity expert specializing in threat detection.
EOF
# Build custom model
docker exec -i wildbox-ollama ollama create my-security-model < Modelfile
Update .env:
OLLAMA_MODEL=my-security-model
| Endpoint | Method | Description |
|---|---|---|
/api/tags |
GET | List installed models |
/api/generate |
POST | Generate text completion |
/api/chat |
POST | Chat completion (multi-turn) |
/api/pull |
POST | Download a model |
/api/delete |
DELETE | Remove a model |
| Endpoint | Method | Description |
|---|---|---|
/v1/models |
GET | List available models |
/v1/chat/completions |
POST | Chat completion (OpenAI format) |
/v1/completions |
POST | Text completion (OpenAI format) |
| Solution | Cost | Privacy | Latency |
|---|---|---|---|
| Ollama (Local) | $0 (hardware only) | 100% private | Low (local) |
| OpenAI GPT-4 | ~$30/1M tokens | Sent to OpenAI | Medium (API call) |
| OpenAI GPT-3.5 | ~$1/1M tokens | Sent to OpenAI | Medium (API call) |
For security-sensitive data, local Ollama is the recommended choice.
Last Updated: November 16, 2025 Status: Production Ready Recommended Model: llama2:7b or llama2:13b for security analysis