view-usage
Skill84 starsChanged 7 months agoMITView on GitHub
Query spend and token activity on a live LiteLLM proxy. Shows daily usage broken down by user, team, org, tag, job, or model. Use when the user wants to see costs, token counts, request volume, or job-level attribution for a given date range.
- Reads credentials
In this repository20 other files it gives its agents.
- add-agentSkill
- add-keySkill
- add-mcpSkill
- add-modelSkill
- add-orgSkill
- add-teamSkill
- add-userSkill
- delete-agentSkill
- delete-keySkill
- delete-mcpSkill
- delete-modelSkill
- delete-orgSkill
- delete-teamSkill
- delete-userSkill
- update-agentSkill
- update-keySkill
- update-mcpSkill
- update-modelSkill
- update-teamSkill
- update-userSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Ask for these if not already known:
- Very specific: line 44
Use /tag/daily/activity?tags=<tag> for daily spend, tokens, request count, and model/provider breakdowns for one or more job tags.
- Very specific: line 46
Use /global/spend/tags?tags=<tag> for a top-level spend total by tag over a date range.
- Very specific: line 48
If the user asks "which jobs cost the most?", call /global/spend/tags without a tags filter, sort by spend descending, and present the top …
- Distinctive: line 162
Before processing results, check the HTTP status:
- Distinctive: line 169
Ask for date range — default to current month.
- Distinctive: line 170
Run the appropriate endpoint.
- Very specific: line 175
If metadata.total_pages > 1, offer to fetch remaining pages.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
View Usage
Query daily activity and spend data from a live LiteLLM proxy.
Setup
Ask for these if not already known:
LITELLM_BASE_URL — e.g. https://my-proxy.example.com
LITELLM_API_KEY — proxy admin keyAPI reference: https://docs.litellm.ai/docs/proxy/users#get-user-spend
Ask the user
- View by — overall / user / team / org / tag / job (default: overall)
- Date range — default to current month if not given
- Filter by model? (optional)
- Job tag(s)? (optional) — for job cost attribution, ask which request
tag identifies the job, for example
job:nightly-evalorjob=batch-import.
Job cost attribution
LiteLLM attributes per-request costs through request tags. For LLM jobs, prefer
tagging requests with a stable job label such as job:<job-name> and then query
tag APIs:
- Use
/tag/daily/activity?tags=<tag>for daily spend, tokens, request count, and model/provider breakdowns for one or more job tags. - Use
/global/spend/tags?tags=<tag>for a top-level spend total by tag over a date range. - If the user asks "which jobs cost the most?", call
/global/spend/tagswithout atagsfilter, sort by spend descending, and present the top tags that look like job labels.
Endpoints
Overall spend (across all users)
curl -s "$BASE/user/daily/activity?start_date=YYYY-MM-DD&end_date=YYYY-MM-DD&page_size=30" \
-H "Authorization: Bearer $KEY"Overall request and token volume
curl -s "$BASE/global/activity?start_date=YYYY-MM-DD&end_date=YYYY-MM-DD" \
-H "Authorization: Bearer $KEY"By team
curl -s "$BASE/team/daily/activity?team_ids=<team_id>&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD" \
-H "Authorization: Bearer $KEY"By org
curl -s "$BASE/organization/daily/activity?organization_ids=<org_id>&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD" \
-H "Authorization: Bearer $KEY"By user
curl -s "$BASE/user/daily/activity?user_id=<user_id>&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD" \
-H "Authorization: Bearer $KEY"By tag or job
curl -s "$BASE/tag/daily/activity?tags=<tag>&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD&page_size=30" \
-H "Authorization: Bearer $KEY"For multiple tags, pass a comma-separated list:
curl -s "$BASE/tag/daily/activity?tags=job:nightly-eval,job:batch-import&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD&page_size=30" \
-H "Authorization: Bearer $KEY"Top tag spend
curl -s "$BASE/global/spend/tags?start_date=YYYY-MM-DD&end_date=YYYY-MM-DD" \
-H "Authorization: Bearer $KEY"Filter to a specific job tag:
curl -s "$BASE/global/spend/tags?tags=<tag>&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD" \
-H "Authorization: Bearer $KEY"Response shape
{
"results": [
{
"date": "2026-03-14",
"metrics": {
"spend": 1.23,
"prompt_tokens": 45000,
"completion_tokens": 12000,
"total_tokens": 57000,
"api_requests": 120,
"successful_requests": 118,
"failed_requests": 2
},
"breakdown": {
"models": { "gpt-4o": { "metrics": { "spend": 1.23, ... } } }
}
}
],
"metadata": { "page": 1, "page_size": 10, "total_count": 31 }
}Note: top-level key is results (not data).
Summarize with python3
curl -s "$BASE/user/daily/activity?start_date=YYYY-MM-DD&end_date=YYYY-MM-DD&page_size=30" \
-H "Authorization: Bearer $KEY" | python3 -c "
import sys, json
d = json.load(sys.stdin)
rows = d.get('results', [])
print('{:<12} {:>10} {:>12} {:>10}'.format('Date', 'Requests', 'Tokens', 'Spend'))
print('-' * 46)
total_spend = 0
for r in rows:
m = r.get('metrics', {})
print('{:<12} {:>10} {:>12} ${:>9.4f}'.format(
r.get('date', ''),
m.get('api_requests', 0),
m.get('total_tokens', 0),
m.get('spend', 0),
))
total_spend += m.get('spend', 0)
print('-' * 46)
print('{:<12} {:>10} {:>12} ${:>9.4f}'.format('TOTAL', '', '', total_spend))
"Error handling
Before processing results, check the HTTP status:
- 401/403 — invalid or expired
LITELLM_API_KEY; ask the user to verify - 404 — endpoint not available; check LiteLLM proxy version supports activity endpoints
- Empty results — no activity in the given date range; confirm dates are correct
Instructions
- Ask for date range — default to current month.
- Run the appropriate endpoint. For job attribution, prefer tag endpoints and ask for the job tag if it was not provided.
- Print a table: Date | Requests | Tokens | Spend.
- Show totals row at the bottom.
- Highlight any days with
failed_requests > 0. - If
metadata.total_pages > 1, offer to fetch remaining pages.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

