[PR #13213] Add /api/models/size endpoint to report total storage usage #19391

Open
opened 2026-04-16 07:05:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13213
Author: @cd-Ishita
Created: 11/23/2025
Status: 🔄 Open

Base: mainHead: add-models-size-endpoint


📝 Commits (1)

  • 89cf599 Add /api/models/size endpoint to report total storage usage

📊 Changes

5 files changed (+342 additions, -0 deletions)

View changed files

📝 api/client.go (+14 -0)
📝 api/client_test.go (+107 -0)
📝 docs/api.md (+25 -0)
📝 server/routes.go (+17 -0)
📝 server/routes_test.go (+179 -0)

📄 Description

Description

Adds a new /api/models/size endpoint that returns the total disk space used by all downloaded models.

Motivation

Users often need to quickly check how much storage their Ollama models are consuming without parsing the full model list. This endpoint provides a simple way to get total storage metrics.

Changes

  • Added ModelsStorageHandler server handler
  • Registered new GET endpoint at /api/models/size
  • Returns JSON with total_size_bytes and models_count
  • Added unit tests
  • Updated API documentation

Testing

  • Manual testing with local endpoint
  • Unit tests pass (go test ./server/...)
  • Documentation updated

Example Response

{
  "total_size_bytes": 4661229568,
  "models_count": 3
}

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13213 **Author:** [@cd-Ishita](https://github.com/cd-Ishita) **Created:** 11/23/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `add-models-size-endpoint` --- ### 📝 Commits (1) - [`89cf599`](https://github.com/ollama/ollama/commit/89cf599b3fd2f25b2f9893a5291f9cd2ac77b350) Add /api/models/size endpoint to report total storage usage ### 📊 Changes **5 files changed** (+342 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `api/client.go` (+14 -0) 📝 `api/client_test.go` (+107 -0) 📝 `docs/api.md` (+25 -0) 📝 `server/routes.go` (+17 -0) 📝 `server/routes_test.go` (+179 -0) </details> ### 📄 Description ## Description Adds a new `/api/models/size` endpoint that returns the total disk space used by all downloaded models. ## Motivation Users often need to quickly check how much storage their Ollama models are consuming without parsing the full model list. This endpoint provides a simple way to get total storage metrics. ## Changes - Added `ModelsStorageHandler` server handler - Registered new GET endpoint at `/api/models/size` - Returns JSON with `total_size_bytes` and `models_count` - Added unit tests - Updated API documentation ## Testing - [x] Manual testing with local endpoint - [x] Unit tests pass (`go test ./server/...`) - [x] Documentation updated ## Example Response ```json { "total_size_bytes": 4661229568, "models_count": 3 } ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 07:05:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#19391