QUICK REFERENCE
Commands and patterns to copy/paste.
OLLAMA COMMANDS
# Start the server
ollama serve
# Check if running
curl http://localhost:11434/api/tags
# List installed models
ollama list
# Download a vision model
ollama pull ministral
ollama pull llava
ollama pull minicpm-v
BASE64 ENCODING
# Encode an image (macOS/Linux)
base64 -i image.png
# Encode without whitespace (for JSON)
base64 -i image.png | perl -pe's~\s~~g'
# Store in a variable
IMAGE_B64=$(base64 -i image.png | perl -pe's~\s~~g')
# Check it worked (shows length)
echo ${#IMAGE_B64}
# Check terminal character limit
getconf ARG_MAX
# Resize if image is too large
sips --resampleHeightWidthMax 768 image.png --out resized.png
RAW CURL REQUEST
IMAGE_B64=$(base64 -i image.png | perl -pe's~\s~~g')
curl -s http://localhost:11434/api/generate \
-H "Content-Type: application/json" \
-d '{
"model": "ministral",
"prompt": "Describe this image",
"images": ["'"$IMAGE_B64"'"],
"stream": false
}' | jq -r '.response'
DESCRIPTION PROMPT
Describe this image. Use plain text only. DO NOT use asterisks,
bold, or any markdown formatting.
List these aspects with a dash prefix:
- SUBJECT:
- SETTING:
- COLORS:
- CLOTHING:
- OBJECTS:
- MOOD:
Keep each line brief. No sub-bullets.
MODERATION PROMPT
Answer YES or NO only for each question.
1. NUDE_CHEST: Is bare chest, breasts, or nipples visible?
2. NUDE_LOWER: Is bare buttocks or genitals visible?
3. WEAPON: Is the person holding a weapon (gun, knife, etc)?
NUDE_CHEST: YES or NO
NUDE_LOWER: YES or NO
WEAPON: YES or NO
REGEX PATTERNS
Bash (grep):
# Check for a value
echo "$RESPONSE" | grep -qi "NUDE_CHEST: YES"
# -q = quiet (no output)
# -i = case-insensitive
# With extended regex for flexible whitespace
echo "$RESPONSE" | grep -Ei "NUDE_CHEST:\s*YES"
JSON REQUEST FORMAT
{
"model": "ministral",
"prompt": "Your question here",
"images": ["base64_data_here"],
"stream": false,
"options": {
"temperature": 0.1
}
}
JSON RESPONSE FORMAT
{
"model": "ministral",
"response": "The model's answer...",
"done": true
}
DIRECTORY STRUCTURE
2026-01-08-ai-watchman/
01-overview.txt
02-technology-stack.txt
03-base64-encoding.txt
04-first-vision-request.txt
05-structured-prompting.txt
06-pattern-matching.txt
08-building-your-own.txt
09-troubleshooting.txt
10-glossary.txt
11-quick-reference.txt <- You are here
LINKS
Ollama: https://ollama.com
API Docs: https://github.com/ollama/ollama/blob/main/docs/api.md
Regex tester: https://regex101.com
Techalicious: https://techalicious.club