token-cost-tracking

Track token usage and costs across agents with per-call attribution and budget alerts.

7|1|Updated Dec 26, 2025
One-click install
npx skills add https://github.com/nexus-labs-automation/agent-observability --skill token-cost-tracking
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: token-cost-tracking
Source: https://github.com/nexus-labs-automation/agent-observability/tree/main/skills/token-cost-tracking
Command: npx skills add https://github.com/nexus-labs-automation/agent-observability --skill token-cost-tracking

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Track token usage and costs across agents to enable budgeting and cost optimization.

Core Features & Use Cases

  • Per-call token tracking: capture input, output, and total tokens for each LLM call.
  • Per-call cost: attribute USD cost per call based on model pricing and token usage.
  • Attribution: tag costs with feature, agent, and hashed user/org identifiers for accurate attribution.
  • Budget alerting: define thresholds and trigger alerts when spending exceeds limits.
  • Aggregation levels: collect per-call, per-agent run, per-session, and per-user totals for comprehensive visibility.

Quick Start

Start tracking token usage and costs for a given agent run.

Frequently Asked Questions about token-cost-tracking

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I track LLM token usage and costs across multiple agents?

Aggregate per-call token counters and cost attribution fields across per-agent run, per-session, and per-user contexts. This provides comprehensive visibility into LLM spending for accurate budgeting and cost optimization.

Can I attribute LLM costs to specific features, agents, or users?

Attribute LLM costs by tagging them with feature, agent, and hashed user or organization identifiers. This provides accurate cost attribution across per-call, per-agent run, per-session, and per-user aggregation levels.

Does token cost tracking work with Langfuse, LangSmith, or OpenTelemetry?

Yes, token cost tracking integrates with Langfuse, LangSmith, or OpenTelemetry to provide end-to-end observability. These integrations capture per-call token counters and cost attribution fields for multi-agent systems.

How do I set up budget alerting for LLM API spending?

Set up budget alerting for LLM API spending by defining spending thresholds that trigger alerts when token costs exceed predefined limits. This prevents budget overruns across agents, sessions, or users.

What's the best way to calculate USD cost per LLM call?

Calculate USD cost per LLM call by applying model pricing to captured input and output token usage. This per-call cost data feeds into higher-level aggregations for comprehensive cost analysis and budget management.

What aggregation levels are needed for multi-agent cost analysis?

Multi-agent cost analysis requires aggregation at per-call, per-agent run, per-session, and per-user levels. Collecting totals across these levels delivers comprehensive visibility into token usage and costs.