{"id":26739416,"url":"https://github.com/ai-mindset/modelmeter","last_synced_at":"2026-04-13T20:02:23.743Z","repository":{"id":284345066,"uuid":"954614415","full_name":"ai-mindset/ModelMeter","owner":"ai-mindset","description":"A lightweight, cross-platform utility that calculates the total storage footprint of locally installed large language models managed through Ollama","archived":false,"fork":false,"pushed_at":"2025-03-25T11:46:50.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T12:36:21.877Z","etag":null,"topics":["deno","go","gola","javascr","llms","local","ollama","on-prem","on-premise","python","storage"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ai-mindset.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-25T10:58:15.000Z","updated_at":"2025-03-25T11:48:45.000Z","dependencies_parsed_at":"2025-03-25T12:47:16.776Z","dependency_job_id":null,"html_url":"https://github.com/ai-mindset/ModelMeter","commit_stats":null,"previous_names":["ai-mindset/modelmeter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-mindset%2FModelMeter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-mindset%2FModelMeter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-mindset%2FModelMeter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-mindset%2FModelMeter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ai-mindset","download_url":"https://codeload.github.com/ai-mindset/ModelMeter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245969577,"owners_count":20702246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","go","gola","javascr","llms","local","ollama","on-prem","on-premise","python","storage"],"created_at":"2025-03-28T04:28:48.343Z","updated_at":"2026-04-13T20:02:23.716Z","avatar_url":"https://github.com/ai-mindset.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ModelMeter\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n**ModelMeter** is a lightweight, cross-platform utility that calculates the total storage footprint of locally installed large language models managed through Ollama.\n\n## 📋 Overview\n\nManaging multiple large language models locally can quickly consume significant disk space. ModelMeter provides a simple command-line tool to instantly determine exactly how much storage your LLM collection is using, helping you manage system resources effectively.\n\n## 🚀 Quick Start\n\n```bash\n# Python\n./py/ollama_total.py\n\n# Deno (JavaScript)\ndeno run --allow-run ./js/ollama_total.js\n\n# Go\n./go/ollama_total\n\n# Example output\n26.8 GB\n```\n\n## ✨ Features\n\n- **Accurate Size Calculation:** Precisely measures total storage used by all installed Ollama models\n- **Smart Unit Formatting:** Automatically selects the most appropriate unit (MB, GB, TB)\n- **Multiple Language Implementations:** Choose from Python, Deno (JavaScript), or Go\n- **Simple Integration:** Use as a standalone command or integrate into larger workflows\n- **Minimal Dependencies:** Relies only on standard libraries in each language\n\n## ❓ Why ModelMeter?\n\nWhile you could manually add up model sizes from `ollama list` output, ModelMeter:\n- Saves time with instant calculations\n- Eliminates human error in size conversions and addition\n- Provides consistent formatting across different model sizes\n- Enables easy integration into monitoring scripts and dashboards\n- Serves as a building block for more complex LLM resource management tools\n\n## 💻 Installation\n\n### System Requirements\n- **Python:** Python 3.10+\n- **JavaScript:** Deno 2.0+\n- **Go:** Go 1.16+\n- **All implementations:** Ollama must be installed and in your PATH\n\n### Python Implementation\n\n```bash\n# Clone the repository\ngit clone https://github.com/ai-mindset/ModelMeter.git\ncd ModelMeter/py\n\n# Make the Python script executable\nchmod +x ollama_total.py\n\n# Optional: Add to your PATH\nln -s $(pwd)/ollama_total.py /usr/local/bin/ollama_total\n```\n\n### Deno Implementation\n\n```bash\n# Clone the repository\ngit clone https://github.com/ai-mindset/ModelMeter.git\ncd ModelMeter/js\n\n# Make the JavaScript file executable\nchmod +x ollama_total.js\n\n# Run with Deno\ndeno run --allow-run ollama_total.js\n\n# Optional: Install as a command\ndeno install --allow-run --name ollama_total ollama_total.js\n```\n\n### Go Implementation\n\n```bash\n# Clone the repository\ngit clone https://github.com/ai-mindset/ModelMeter.git\ncd ModelMeter/go\n\n# Build the Go binary\ngo build -o ollama_total ollama_total.go\n\n# Move to a directory in your PATH\nsudo mv ollama_total /usr/local/bin/\n```\n\n## 💻 Usage\n\n### Basic Command\n\n```bash\nollama_total\n```\n\n### Integrating Into Scripts\n\n#### Python\n\n```python\nfrom ollama_total import get_ollama_total\n\n# Get the total storage used by Ollama models\ntotal = get_ollama_total()\nprint(f\"Your Ollama models are using {total}\")\n```\n\n#### Deno (JavaScript)\n\n```javascript\nimport { getOllamaTotal } from \"./ollama_total.js\";\n\n// Get the total storage used by Ollama models\nconst total = await getOllamaTotal();\nconsole.log(`Your Ollama models are using ${total}`);\n```\n\n#### Go\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"path/to/modelMeter\"\n)\n\nfunc main() {\n    total, err := getOllamaTotal()\n    if err != nil {\n        fmt.Printf(\"Error: %s\\n\", err)\n        return\n    }\n    fmt.Printf(\"Your Ollama models are using %s\\n\", total)\n}\n```\n\n## 🔍 Technical Details\n\n### How It Works\n\nModelMeter executes the `ollama list` command, parses the output to extract size information, converts all sizes to bytes for accurate summation, and then converts the total back to the most appropriate unit.\n\n### Size Conversion and Parsing\n\n- Uses SI units: 1 MB = 10^6 bytes, 1 GB = 10^9 bytes, 1 TB = 10^12 bytes (matching Ollama's output)\n- Regex pattern `(\\d+(?:\\.\\d+)?) (MB|GB|TB)` extracts size values and units\n- Results are formatted with one decimal place precision for readability\n\n## ⚠️ Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| `Command not found: ollama` | Ensure Ollama is installed and in your PATH |\n| No output displayed | Check if you have any models installed with `ollama list` |\n| Permission denied | Run `chmod +x` on the script file |\n| Incorrect total | Ensure no other process is installing/removing models during calculation |\n| Deno security errors | Ensure you've provided the `--allow-run` flag when using Deno |\n\n## 🔄 Alternatives\n\n| Approach | Pros | Cons |\n|----------|------|------|\n| ModelMeter | Automatic calculation, multiple languages, formatting | Additional tool to install |\n| Manual addition from `ollama list` | No installation needed | Time-consuming, error-prone |\n| Shell one-liner[^1] | Quick for one-time use | Complex syntax, limited formatting |\n| Disk usage tools (du) | System-wide analysis | Includes non-model files, less precise |\n\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## 🙏 Acknowledgments\n\n- [Ollama](https://github.com/ollama/ollama) - For making local LLM deployment accessible\n\n---\n[^1]: Example shell one-liner: `ollama list | awk 'NR\u003e1 {size=$3; if($4==\"GB\") size*=1000; if($4==\"TB\") size*=1000000; sum+=size} END {printf \"%.1f %s\\n\", sum\u003e=1000000 ? sum/1000000 : sum\u003e=1000 ? sum/1000 : sum, sum\u003e=1000000 ? \"TB\" : sum\u003e=1000 ? \"GB\" : \"MB\"}'`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fai-mindset%2Fmodelmeter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fai-mindset%2Fmodelmeter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fai-mindset%2Fmodelmeter/lists"}