Claude Skill

Anthropic SDK Token Usage Logger

Instruments Anthropic API calls to log token usage, latency, and cost per request using the Anthropic TypeScript SDK. Wraps the anthropic.messages.create method to capture usage.input_tokens, usage.output_tokens, and timing from the API response. Writes structured logs to CloudWa

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download agentskillexchange-skills-skills_anthropic-sdk-token-usage-logger-07beb56.zip · 0 KB
Part of agentskillexchange/skills — 249 skills

Install

skills CLI npx skills add https://github.com/agentskillexchange/skills/tree/main/skills/anthropic-sdk-token-usage-logger
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install agentskillexchange-skills@llmmart
Git git clone https://github.com/agentskillexchange/skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole agentskillexchange/skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Anthropic SDK Token Usage Logger

Instruments Anthropic API calls to log token usage, latency, and cost per request using the Anthropic TypeScript SDK. Wraps the anthropic.messages.create method to capture usage.input_tokens, usage.output_tokens, and timing from the API response. Writes structured logs to CloudWatch Logs via the AWS SDK v3 CloudWatchLogsClient.

Installation

Use the upstream install or setup path that matches your environment:

  • npm install @anthropic-ai/sdk

Requirements and caveats from upstream:

  • Node.js 18+

Basic usage or getting-started notes:

Documentation

Source

Files (skills)
  • SKILL.md 1.8 KB
    ---
    name: "Anthropic SDK Token Usage Logger"
    slug: "anthropic-sdk-token-usage-logger"
    description: "Instruments Anthropic API calls to log token usage, latency, and cost per request using the Anthropic TypeScript SDK. Wraps the anthropic.messages.create method to capture usage.input_tokens, usage.output_tokens, and timing from the API response. Writes structured logs to CloudWatch Logs via the AWS SDK v3 CloudWatchLogsClient."
    github_stars: 1883
    verification: "security_reviewed"
    source: "https://github.com/anthropics/anthropic-sdk-typescript"
    author: "Anthropic"
    category: "Library & API Reference"
    framework: "Claude Code"
    tool_ecosystem:
      github_repo: "anthropics/anthropic-sdk-typescript"
      github_stars: 1883
      npm_package: "@anthropic-ai/sdk"
      npm_weekly_downloads: 14518427
    ---
    
    # Anthropic SDK Token Usage Logger
    
    Instruments Anthropic API calls to log token usage, latency, and cost per request using the Anthropic TypeScript SDK. Wraps the anthropic.messages.create method to capture usage.input_tokens, usage.output_tokens, and timing from the API response. Writes structured logs to CloudWatch Logs via the AWS SDK v3 CloudWatchLogsClient.
    
    ## Installation
    
    Use the upstream install or setup path that matches your environment:
    - npm install @anthropic-ai/sdk
    
    Requirements and caveats from upstream:
    - Node.js 18+
    
    Basic usage or getting-started notes:
    - sh
    - js
    - import Anthropic from '@anthropic-ai/sdk';
    
    - Source: https://github.com/anthropics/anthropic-sdk-typescript
    - Extracted from upstream docs: https://raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/HEAD/README.md
    
    ## Documentation
    
    - https://platform.claude.com/docs/en/api/sdks/typescript
    
    ## Source
    
    - [Agent Skill Exchange](https://agentskillexchange.com/skills/anthropic-sdk-token-usage-logger/)
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related