AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

View Usage

skill-berriai-litellm-skills-view-usage · by BerriAI

>

— No reviews yet
0 installs
41 views
0.0% view→install

Install

$ agentstack add skill-berriai-litellm-skills-view-usage

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • ✓ Prompt-injection patterns
  • ✓ Secret / credential exfiltration
  • ✓ Dangerous shell & filesystem operations
  • ✓ Untrusted network calls
  • ✓ Known-malicious package signatures

What it can access

  • ● Network access Used
  • ✓ Filesystem access No
  • ✓ Shell / process execution No
  • ✓ Environment & secrets No
  • ✓ Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-berriai-litellm-skills-view-usage)

Reliability & compatibility

✓ Security review passed
0 installs to date
— no reviews yet
○ 4mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of View Usage? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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 key

API reference: https://docs.litellm.ai/docs/proxy/users#get-user-spend

Ask the user

  1. View by — overall / user / team / org / tag / job (default: overall)
  2. Date range — default to current month if not given
  3. Filter by model? (optional)
  4. Job tag(s)? (optional) — for job cost attribution, ask which request

tag identifies the job, for example job:nightly-eval or job=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: and then query tag APIs:

  • Use /tag/daily/activity?tags= for daily spend, tokens, request count,

and model/provider breakdowns for one or more job tags.

  • Use /global/spend/tags?tags= for a top-level spend total by tag over a

date range.

  • 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 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=&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD" \
  -H "Authorization: Bearer $KEY"

By org

curl -s "$BASE/organization/daily/activity?organization_ids=&start_date=YYYY-MM-DD&end_date=YYYY-MM-DD" \
  -H "Authorization: Bearer $KEY"

By user

curl -s "$BASE/user/daily/activity?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=&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=&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('{:10} {:>12} {:>10}'.format('Date', 'Requests', 'Tokens', 'Spend'))
print('-' * 46)
total_spend = 0
for r in rows:
    m = r.get('metrics', {})
    print('{: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('{: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

  1. Ask for date range — default to current month.
  2. Run the appropriate endpoint. For job attribution, prefer tag endpoints and

ask for the job tag if it was not provided.

  1. Print a table: Date | Requests | Tokens | Spend.
  2. Show totals row at the bottom.
  3. Highlight any days with failed_requests > 0.
  4. If metadata.total_pages > 1, offer to fetch remaining pages.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.