Date: 2025-06-11
Performed a major cleanup of ollama models, removing 57 unused models and freeing up 1,165GB (over 1TB) of disk space. Also resolved OpenCode configuration issues with local ollama models.
- Total models: 123
- Total size: 1,561GB
- Many models hadn't been used in months
- Total models: 66
- Total size: 396GB
- Space saved: 1,165GB
Focused on removing:
- Large models over 20GB that weren't actively used
- Medium models (10-20GB) from months ago
- Duplicate/alternative quantizations of the same base models
- Experimental models that didn't pan out
Kept essential models:
deepseek-r1:32b-qwen-distill-q4_K_M(main reasoning model)llama3-groq-tool-use:8b(for tool calling)qwen2.5-coder:7b(coding assistance)- Other actively used models
OpenCode couldn't connect to local ollama models. Key findings:
- Tool/Function Calling Required: OpenCode requires models that support OpenAI's tool/function calling API
- DeepSeek models don't support tools: None of the DeepSeek models (including the excellent deepseek-r1) support tool calling
- Configuration quirks: The
.opencode.jsonfile gets auto-modified, removing custom endpoints
Found that llama3-groq-tool-use:8b specifically supports tool calling. Working configuration:
{
"providers": {
"local": {
"endpoint": "http://llm:11434/v1",
"disabled": false
}
},
"agents": {
"coder": {
"model": "local.llama3-groq-tool-use:8b",
"maxTokens": 8192
}
}
}Always set environment variable for reliability:
export LOCAL_ENDPOINT="http://llm:11434/v1"
opencodeFor deepseek-r1 usage (which is superior for reasoning but lacks tool support):
- Use ollama directly:
ollama run deepseek-r1:32b-qwen-distill-q4_K_M - Consider alternative inference engines (vLLM, TGI) with better OpenAI compatibility
- Use OpenRouter for cloud-based access with tool support
Created several utility scripts in /dev-tools/:
ollama-status.sh- Interactive status monitor with nice TUIollama-quick-status.sh- Quick non-interactive status checkollama-api-cleanup.sh- The cleanup script that removed 1TB of modelsopencode-ollama-working-config.sh- Documents the working configuration
- Regular cleanup is essential - Models accumulate quickly when experimenting
- Tool support varies widely - Many models don't support OpenAI's function calling
- API beats CLI - Using ollama's REST API for deletion was more reliable than CLI
- Documentation saves debugging - Creating reference scripts helps future troubleshooting
- Monitor disk usage more regularly
- Consider implementing automated cleanup policies
- Investigate alternative inference engines for better tool support
- Keep exploring models that balance capability with tool compatibility
The cleanup was overdue but successful - recovering over 1TB of space while preserving all actively used models.