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 CrestApps/CrestApps.AgentSkills --skill crestapps-core-ai-usage-meteringgit clone --depth 1 https://github.com/CrestApps/CrestApps.AgentSkillsWrote 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/crestapps/crestapps.agentskills/crestapps-core-ai-usage-metering)<a href="https://agentmods.dev/skills/crestapps/crestapps.agentskills/crestapps-core-ai-usage-metering"><img src="https://agentmods.dev/badge/skills/crestapps/crestapps.agentskills/crestapps-core-ai-usage-metering/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/crestapps/crestapps.agentskills/crestapps-core-ai-usage-metering"><img src="https://agentmods.dev/badge/skills/crestapps/crestapps.agentskills/crestapps-core-ai-usage-metering.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.00194 | $0.02212 |
| Opus 5.5 | $0.00078 | $0.00885 |
| Sonnet 5.5 | $0.00039 | $0.00442 |
| Haiku 4.5 | $0.00019 | $0.00221 |
Grade A, and why
crestapps-core-ai-usage-metering 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 yesterday.
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 — 180 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CrestApps.Core AI Usage Metering
Every client IAIClientFactory returns meters its own requests by wrapping the provider's client and reading the provider-agnostic UsageDetails on each response. That covers every provider, including custom IAIClientProvider implementations, with no provider code.
Guidelines
- Turn metering on with
GeneralAIOptions.EnableAIUsageTracking = true. It is off by default. - A record is written per request sent to the provider, not per user turn. Planning, query rewrites, vision calls, each tool-calling round trip, each embedding batch and each realtime response are separate records, so the request count equals billed requests.
- Metering sits below every middleware you add, so
UseFunctionInvocation()yields one record per round trip and a cached response yields none. - Label your own requests with
UseUsageLabels(...)on the client pipeline, or anAIUsageScopearound a call into a service that creates the client for you. Labels never reach the provider. - A client you build without the factory is not metered until you wrap it with
AIUsageMetering.Meter(...).
Enable Metering and Storage
using CrestApps.Core.AI.Models;
builder.Services.Configure<GeneralAIOptions>(options =>
{
options.EnableAIUsageTracking = true;
});
Each record goes to every registered IAICompletionUsageObserver. The default IAICompletionUsageService is one of them and saves through IAICompletionUsageStore. The YesSql chat-session stores (AddCoreAIChatSessionStoresYesSql(), which calls AddCoreAICompletionUsageStoresYesSql()) and the EntityCore chat-session stores (AddCoreAIChatSessionStoresEntityCore()) register a store. A record whose scope was already disposed when the response finished is dropped rather than failing the answer.
What a Record Holds
| Property | Meaning |
|---|---|
OperationType |
AIUsageOperationTypes.Chat, Embedding, Image, SpeechToText, TextToSpeech, Realtime or RealtimeTranscription |
ClientName, ConnectionName, DeploymentName, ModelName |
Where the request went; ModelName is what the provider reported, else the deployment |
InputTokenCount, OutputTokenCount, TotalTokenCount |
Tokens in and out |
CachedInputTokenCount, ReasoningTokenCount |
Discounted cached input; reasoning output tokens |
InputAudioTokenCount, OutputAudioTokenCount |
Audio tokens, billed at their own rate |
AudioDurationMs, CharacterCount, ImageCount |
Duration-, character- and image-billed units |
ContextType, Purpose |
Category of feature and reason for the request |
SessionId, ProfileId, InteractionId, UserId, VisitorId, ResponseLatencyMs, IsStreaming |
Attribution and timing |
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.
- yesterday First seen · 180 lines · 194 tokens per session scan A f51eb53a6546
crestapps-core-ai-usage-metering is a skill published in the GitHub repository CrestApps/CrestApps.AgentSkills (13 stars, last pushed yesterday), licensed MIT. It adds 194 tokens to every session and 2,212 once invoked, about $0.0008 per session on Opus 5.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-10-22.
Other skills, from other repositories
powerpoint-cli
Discover and use the PowerPoint CLI plugin to automate a live PowerPoint desktop session. Use for terminal, PowerShell, batch, and coding-agent tasks; not general presentation design. Triggers: pptcli, PowerPoint command line, presentation automation script.
powerpoint-deck-design
Plan or improve the visual design of a PowerPoint presentation: layout, typography, color, hierarchy, accessibility, and consistency. Use when the user asks to create, redesign, or review how a deck looks; not for general PowerPoint automation or content-only edits.
home-memory-documentation
Do not load unless the request or established context explicitly identifies Home Memory (HM) and requires a documentation decision about record boundaries, relationships or information placement. If the product is ambiguous, ask whether the user means Home Memory or Smartconstruct and load neither product skill first.…
dotnet-debugging
Debug .NET applications using debug-mcp MCP tools — launch processes, set breakpoints, step through code, inspect variables, evaluate expressions, and analyze exceptions. Use this skill when debugging .NET/C# applications, investigating runtime behavior, diagnosing exceptions, inspecting object state, or performing…
sast-missingauth
Detect missing authentication and broken function-level authorization vulnerabilities in a codebase using a three-phase approach: recon (map endpoints and the role/permission system), batched verify (check auth/authz in parallel subagents, 3 endpoints each), and merge (consolidate batch results). Covers…
sast-analysis
Perform codebase analysis and architecture mapping as the first phase of a security assessment. Explores the tech stack, frameworks, entry points, data flows, and trust boundaries. Outputs sast/architecture.md. Run this before any vulnerability detection skill. Use when asked to analyze a codebase for security or when…