usage: continuous Ollama Cloud usage sampling + delta report
- scripts/ollama_usage_poll.py: per-minute cron sample into db/ollama_usage.sqlite, write-on-change; meta table records every poll so a data gap can be told apart from a failed or missed poll - scripts/ollama_usage_report.py: delta report keyed on per-model request_count (limits.*.usage has 0.1 % resolution, short-interval deltas are noise) - SKILL.md: Continuous sampling section
This commit is contained in:
@@ -46,6 +46,22 @@ UTC. Rationale: session usage climbed in real time during testing (rolling
|
||||
window), weekly changes slowly — consistent with hourly/weekly windows.
|
||||
If the window turns out not to be calendar-based, fix `until_next_*`.
|
||||
|
||||
## Continuous sampling
|
||||
|
||||
A cron job runs `scripts/ollama_usage_poll.py` every minute and appends to
|
||||
`db/ollama_usage.sqlite` whenever anything changed (table `samples`; table `meta`
|
||||
records every poll, so a gap can be told apart from a failed poll).
|
||||
|
||||
For a delta report over that data:
|
||||
|
||||
```bash
|
||||
uv run skills/usage/scripts/ollama_usage_report.py [--since ISO] [--until ISO]
|
||||
```
|
||||
|
||||
Default window is the last 24 hours. Per-model **request counts** are the exact
|
||||
figure there — `limits.*.usage` has a resolution of 0.1 %, so short-interval
|
||||
percentage deltas are noise.
|
||||
|
||||
## Notes
|
||||
|
||||
- Endpoint: `GET https://ollama.com/api/usage`, header
|
||||
|
||||
Reference in New Issue
Block a user