{"id":"a7ab42e6-9dde-4ed4-a8aa-533846f09e80","shortId":"Qrrck4","kind":"skill","title":"Anthropic SDK Token Usage Logger","tagline":"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","description":"# Anthropic SDK Token Usage Logger\n\nInstruments 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.\n\n## Installation\n\nUse the upstream install or setup path that matches your environment:\n- npm install @anthropic-ai/sdk\n\nRequirements and caveats from upstream:\n- Node.js 18+\n\nBasic usage or getting-started notes:\n- sh\n- js\n- import Anthropic from '@anthropic-ai/sdk';\n\n- Source: https://github.com/anthropics/anthropic-sdk-typescript\n- Extracted from upstream docs: https://raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/HEAD/README.md\n\n## Documentation\n\n- https://platform.claude.com/docs/en/api/sdks/typescript\n\n## Source\n\n- [Agent Skill Exchange](https://agentskillexchange.com/skills/anthropic-sdk-token-usage-logger/)","tags":["anthropic","sdk","token","usage","logger","skills","agentskillexchange","agent-skills","ai-agents","ai-tools","awesome-list","claude-code"],"capabilities":["skill","source-agentskillexchange","skill-anthropic-sdk-token-usage-logger","topic-agent-skills","topic-ai-agents","topic-ai-tools","topic-awesome-list","topic-claude-code","topic-codex","topic-cursor","topic-llm","topic-mcp","topic-npx-skills","topic-openclaw","topic-skills-catalog"],"categories":["skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/agentskillexchange/skills/anthropic-sdk-token-usage-logger","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add agentskillexchange/skills","source_repo":"https://github.com/agentskillexchange/skills","install_from":"skills.sh"}},"qualityScore":"0.454","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 8 github stars · SKILL.md body (1,004 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:09:21.987Z","embedding":null,"createdAt":"2026-05-18T13:15:04.265Z","updatedAt":"2026-05-18T19:09:21.987Z","lastSeenAt":"2026-05-18T19:09:21.987Z","tsv":"'/anthropics/anthropic-sdk-typescript':140 '/anthropics/anthropic-sdk-typescript/head/readme.md':147 '/docs/en/api/sdks/typescript':151 '/sdk':113,136 '/skills/anthropic-sdk-token-usage-logger/)':158 '18':120 'agent':153 'agentskillexchange.com':157 'agentskillexchange.com/skills/anthropic-sdk-token-usage-logger/)':156 'ai':112,135 'anthrop':1,7,21,45,51,65,111,131,134 'anthropic-ai':110,133 'anthropic.messages.create':26,70 'api':8,38,52,82 'aw':92 'basic':121 'call':9,53 'captur':29,73 'caveat':116 'cloudwa':44 'cloudwatch':88 'cloudwatchlogscli':95 'cost':16,60 'doc':144 'document':148 'environ':107 'exchang':155 'extract':141 'get':125 'getting-start':124 'github.com':139 'github.com/anthropics/anthropic-sdk-typescript':138 'import':130 'instal':96,100,109 'instrument':6,50 'js':129 'latenc':14,58 'log':11,42,55,86,89 'logger':5,49 'match':105 'method':27,71 'node.js':119 'note':127 'npm':108 'path':103 'per':17,61 'platform.claude.com':150 'platform.claude.com/docs/en/api/sdks/typescript':149 'raw.githubusercontent.com':146 'raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/head/readme.md':145 'request':18,62 'requir':114 'respons':39,83 'sdk':2,23,46,67,93 'setup':102 'sh':128 'skill':154 'skill-anthropic-sdk-token-usage-logger' 'sourc':137,152 'source-agentskillexchange' 'start':126 'structur':41,85 'time':35,79 'token':3,12,31,33,47,56,75,77 'topic-agent-skills' 'topic-ai-agents' 'topic-ai-tools' 'topic-awesome-list' 'topic-claude-code' 'topic-codex' 'topic-cursor' 'topic-llm' 'topic-mcp' 'topic-npx-skills' 'topic-openclaw' 'topic-skills-catalog' 'typescript':22,66 'upstream':99,118,143 'usag':4,13,48,57,122 'usage.input':30,74 'usage.output':32,76 'use':19,63,97 'v3':94 'via':90 'wrap':24,68 'write':40,84","prices":[{"id":"a49ed993-fefc-4bae-85e5-8a25f9a267b2","listingId":"a7ab42e6-9dde-4ed4-a8aa-533846f09e80","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"agentskillexchange","category":"skills","install_from":"skills.sh"},"createdAt":"2026-05-18T13:15:04.265Z"}],"sources":[{"listingId":"a7ab42e6-9dde-4ed4-a8aa-533846f09e80","source":"github","sourceId":"agentskillexchange/skills/anthropic-sdk-token-usage-logger","sourceUrl":"https://github.com/agentskillexchange/skills/tree/main/skills/anthropic-sdk-token-usage-logger","isPrimary":false,"firstSeenAt":"2026-05-18T13:15:04.265Z","lastSeenAt":"2026-05-18T19:09:21.987Z"}],"details":{"listingId":"a7ab42e6-9dde-4ed4-a8aa-533846f09e80","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"agentskillexchange","slug":"anthropic-sdk-token-usage-logger","github":{"repo":"agentskillexchange/skills","stars":8,"topics":["agent-skills","ai-agents","ai-tools","awesome-list","claude-code","codex","cursor","llm","mcp","npx-skills","openclaw","skills-catalog"],"license":"mit","html_url":"https://github.com/agentskillexchange/skills","pushed_at":"2026-05-18T19:02:17Z","description":"The open catalog of AI agent skills — 2,000+ security-scanned skills for Claude Code, Cursor, Codex, and more.","skill_md_sha":"914c37eff3d5609f772e078b24fc93e5beea77a0","skill_md_path":"skills/anthropic-sdk-token-usage-logger/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/agentskillexchange/skills/tree/main/skills/anthropic-sdk-token-usage-logger"},"layout":"multi","source":"github","category":"skills","frontmatter":{"name":"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."},"skills_sh_url":"https://skills.sh/agentskillexchange/skills/anthropic-sdk-token-usage-logger"},"updatedAt":"2026-05-18T19:09:21.987Z"}}