agentsclimarketplace

Run1 token usage tracking

Skill cxcscmu/SkillLearnBench/skills/b3-teacher-feedback-gemini-3-flash-preview/enterprise-information-search/run1_token-usage-tracking

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

Install
npx -y skills add cxcscmu/SkillLearnBench --skill run1_token-usage-tracking

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

0.8 KB, 157 tokens by cl100k_base, as published. Nobody here has run it

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.
    # Example for tiktoken
    import tiktoken
    encoding = tiktoken.get_encoding("cl100k_base")
    num_tokens = len(encoding.encode(text_input)) + len(encoding.encode(text_output))
    
  3. Validation: Always ensure the tokens value in the final JSON is a numeric type (e.g., 123) and not a string ("123").

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.