cxcscmu/skilllearnbench/run1-token-usage-tracking

Claude Code and agent skill by cxcscmu/skilllearnbench

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Methods for calculating or retrieving the number of tokens consumed during an LLM inference task.

Install

npx vskill@latest install cxcscmu/skilllearnbench/run1-token-usage-tracking

SKILL.md

The same SKILL.md was published earlier as cxcscmu/skilllearnbench/run1-token-usage-tracking.

To meet the requirement of logging consumed tokens:

  1. API Metadata: If using an external API (like OpenAI or Anthropic), retrieve usage.total_tokens from the response object.
  2. Local Calculation: If using a local model or needing a manual count, use a library like tiktoken or the model's native tokenizer.

``python # Example for tiktoken import tiktoken encoding = tiktoken.get_encoding("cl100k_base") num_tokens = len(encoding.encode(text_input)) + len(encoding.encode(text_output)) ``

  1. Validation: Always ensure the tokens value in the final JSON is a numeric type (e.g., 123) and not a string ("123").

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/cxcscmu/skilllearnbench/run1-token-usage-tracking/badge)](https://verified-skill.com/skills/cxcscmu/skilllearnbench/run1-token-usage-tracking)

Something wrong with this skill or its page? Tell us.