Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add latestaiagents/agent-skills --skill token-cost-analyzergit clone --depth 1 https://github.com/latestaiagents/agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/latestaiagents/agent-skills/token-cost-analyzer)<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/token-cost-analyzer"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/token-cost-analyzer/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/token-cost-analyzer"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/token-cost-analyzer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00052 | $0.02874 |
| Opus 5 | $0.00026 | $0.01437 |
| Sonnet 5 | $0.00010 | $0.00575 |
| Haiku 4.5 | $0.00005 | $0.00287 |
Grade A, and why
token-cost-analyzer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 394 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Token Cost Analyzer
Audit, analyze, and optimize your LLM API spending.
When to Use
- Monthly AI bill higher than expected
- Need to understand where tokens are spent
- Optimizing prompts for cost efficiency
- Setting up cost monitoring
- Budgeting for AI features
Token Pricing Reference (2026)
Anthropic Claude
| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|---|---|
| Claude 3 Opus | $15.00 | $75.00 |
| Claude 3.5 Sonnet | $3.00 | $15.00 |
| Claude 3 Haiku | $0.25 | $1.25 |
OpenAI
| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|---|---|
| GPT-4 Turbo | $10.00 | $30.00 |
| GPT-4o | $5.00 | $15.00 |
| GPT-4o mini | $0.15 | $0.60 |
| o1 | $15.00 | $60.00 |
| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|---|---|
| Gemini 1.5 Pro | $3.50 | $10.50 |
| Gemini 1.5 Flash | $0.075 | $0.30 |
Cost Calculation
interface TokenUsage {
inputTokens: number;
outputTokens: number;
cachedTokens?: number;
}
interface ModelPricing {
inputPer1M: number;
outputPer1M: number;
cachedPer1M?: number;
}
function calculateCost(usage: TokenUsage, pricing: ModelPricing): number {
const inputCost = (usage.inputTokens / 1_000_000) * pricing.inputPer1M;
const outputCost = (usage.outputTokens / 1_000_000) * pricing.outputPer1M;
const cachedCost = usage.cachedTokens
? (usage.cachedTokens / 1_000_000) * (pricing.cachedPer1M || pricing.inputPer1M * 0.1)
: 0;
return inputCost + outputCost + cachedCost;
}
// Example
const usage = { inputTokens: 50000, outputTokens: 10000 };
const claude35Sonnet = { inputPer1M: 3.00, outputPer1M: 15.00 };
const cost = calculateCost(usage, claude35Sonnet);
// $0.15 + $0.15 = $0.30
Cost Tracking System
interface UsageRecord {
timestamp: Date;
model: string;
operation: string;
userId?: string;
inputTokens: number;
outputTokens: number;
cost: number;
metadata: Record<string, unknown>;
}
class CostTracker {
private records: UsageRecord[] = [];
record(usage: Omit<UsageRecord, 'timestamp' | 'cost'>): void {
const pricing = this.getPricing(usage.model);
const cost = calculateCost(
{ inputTokens: usage.inputTokens, outputTokens: usage.outputTokens },
pricing
);
this.records.push({
...usage,
timestamp: new Date(),
cost
});
}
// Aggregation methods
getTotalCost(since: Date): number {
return this.records
.filter(r => r.timestamp >= since)
.reduce((sum, r) => sum + r.cost, 0);
}
getCostByOperation(): Map<string, number> {
const byOp = new Map<string, number>();
for (const r of this.records) {
byOp.set(r.operation, (byOp.get(r.operation) || 0) + r.cost);
}
return byOp;
}
getCostByModel(): Map<string, number> {
const byModel = new Map<string, number>();
for (const r of this.records) {
byModel.set(r.model, (byModel.get(r.model) || 0) + r.cost);
}
return byModel;
}
getTopExpensiveOperations(limit: number = 10): UsageRecord[] {
return [...this.records]
.sort((a, b) => b.cost - a.cost)
.slice(0, limit);
}
}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 394 lines · 52 tokens per session scan A c7ec3ae9b6f0
token-cost-analyzer is a skill published in the GitHub repository latestaiagents/agent-skills (5 stars, last pushed 4mo ago), licensed MIT. It adds 52 tokens to every session and 2,874 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
ai-enterprise-ai-usecase-priority-assessment
A business-diagnosis helper for deciding which enterprise AI use cases deserve attention first. It turns supplied information into a summary, findings, recommended actions, and reusable deliverables.
mem0-integration
Mem0 memory layer integration for AI agents. Implement persistent, semantic memory for long-term context retention and personalization.
chroma-integration
Chroma local vector database setup and operations for development and production.
few-shot-example-gen
Few-shot example generation and optimization for improved LLM performance.
llm-classifier
LLM-based zero-shot and few-shot classification for flexible intent detection.
fw-review
Full Freshworks marketplace app review — iparams, frontend, serverless, FDK, security, and structured text report output — in one skill.