Skip to main content
Glama
wn01011

llm-token-tracker

by wn01011

LLM Token Tracker 🧮

Token usage tracker for OpenAI, Claude, and Gemini APIs with MCP (Model Context Protocol) support. Pass accurate API costs to your users.

npm version License: MIT

✨ Features

  • šŸŽÆ Simple Integration - One line to wrap your API client

  • šŸ“Š Automatic Tracking - No manual token counting

  • šŸ’° Accurate Pricing - Up-to-date pricing for all models (2025)

  • šŸ”„ Multiple Providers - OpenAI, Claude, and Gemini support

  • šŸ“ˆ User Management - Track usage per user/session

  • 🌐 Currency Support - USD and KRW

  • šŸ¤– MCP Server - Use directly in Claude Desktop!

  • šŸ†• Intuitive Session Tracking - Real-time usage with progress bars

Related MCP server: MCP TokenSage

šŸ“¦ Installation

npm install llm-token-tracker

šŸš€ Quick Start

Option 1: Use as Library

const { TokenTracker } = require('llm-token-tracker');
// or import { TokenTracker } from 'llm-token-tracker';

// Initialize tracker
const tracker = new TokenTracker({
  currency: 'USD' // or 'KRW'
});

// Example: Manual tracking
const trackingId = tracker.startTracking('user-123');

// ... your API call here ...

tracker.endTracking(trackingId, {
  provider: 'openai', // or 'anthropic' or 'gemini'
  model: 'gpt-3.5-turbo',
  inputTokens: 100,
  outputTokens: 50,
  totalTokens: 150
});

// Get user's usage
const usage = tracker.getUserUsage('user-123');
console.log(`Total cost: $${usage.totalCost}`);

šŸ”§ With Real APIs

To use with actual OpenAI/Anthropic APIs:

const OpenAI = require('openai');
const { TokenTracker } = require('llm-token-tracker');

const tracker = new TokenTracker();
const openai = tracker.wrap(new OpenAI({
  apiKey: process.env.OPENAI_API_KEY
}));

// Use normally - tracking happens automatically
const response = await openai.chat.completions.create({
  model: "gpt-3.5-turbo",
  messages: [{ role: "user", content: "Hello!" }]
});

console.log(response._tokenUsage);
// { tokens: 125, cost: 0.0002, model: "gpt-3.5-turbo" }

Option 2: Use as MCP Server

Add to Claude Desktop settings (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "token-tracker": {
      "command": "npx",
      "args": ["llm-token-tracker"]
    }
  }
}

Then in Claude:

  • "Calculate current session usage" - See current session usage with intuitive format

  • "Calculate current conversation cost" - Get cost breakdown with input/output tokens

  • "Track my API usage"

  • "Compare costs between GPT-4 and Claude"

  • "Show my total spending today"

Available MCP Tools

  1. get_current_session - šŸ†• Get current session usage (RECOMMENDED)

    • Returns: Used/Remaining tokens, Input/Output breakdown, Cost, Progress bar

    • Default user_id: current-session

    • Default budget: 190,000 tokens

    • Perfect for real-time conversation tracking!

  2. track_usage - Track token usage for an AI API call

    • Parameters: provider, model, input_tokens, output_tokens, user_id

  3. get_usage - Get usage summary for specific user or all users

  4. compare_costs - Compare costs between different models

  5. clear_usage - Clear usage data for a user

Example MCP Output

šŸ’° Current Session
━━━━━━━━━━━━━━━━━━━━━━
šŸ“Š Used: 62,830 tokens (33.1%)
✨ Remaining: 127,170 tokens
[ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–‘ā–‘ā–‘ā–‘ā–‘ā–‘ā–‘ā–‘ā–‘ā–‘ā–‘ā–‘ā–‘ā–‘]

šŸ“„ Input: 55,000 tokens
šŸ“¤ Output: 7,830 tokens
šŸ’µ Cost: $0.2825
━━━━━━━━━━━━━━━━━━━━━━

šŸ“‹ Model Breakdown:
  • anthropic/claude-sonnet-4.5: 62,830 tokens ($0.2825)

šŸ“Š Supported Models & Pricing (Updated 2025)

OpenAI (2025)

Model

Input (per 1K tokens)

Output (per 1K tokens)

Notes

GPT-5 Series

GPT-5

$0.00125

$0.010

Latest flagship model

GPT-5 Mini

$0.00025

$0.0010

Compact version

GPT-4.1 Series

GPT-4.1

$0.0020

$0.008

Advanced reasoning

GPT-4.1 Mini

$0.00015

$0.0006

Cost-effective

GPT-4o Series

GPT-4o

$0.0025

$0.010

Multimodal

GPT-4o Mini

$0.00015

$0.0006

Fast & cheap

o1 Reasoning Series

o1

$0.015

$0.060

Advanced reasoning

o1 Mini

$0.0011

$0.0044

Efficient reasoning

o1 Pro

$0.015

$0.060

Pro reasoning

Legacy Models

GPT-4 Turbo

$0.01

$0.03

GPT-4

$0.03

$0.06

GPT-3.5 Turbo

$0.0005

$0.0015

Most affordable

Media Models

DALL-E 3

$0.040 per image

-

Image generation

Whisper

$0.006 per minute

-

Speech-to-text

Anthropic (2025)

Model

Input (per 1K tokens)

Output (per 1K tokens)

Notes

Claude 4 Series

Claude Opus 4.1

$0.015

$0.075

Most powerful

Claude Opus 4

$0.015

$0.075

Flagship model

Claude Sonnet 4.5

$0.003

$0.015

Best for coding

Claude Sonnet 4

$0.003

$0.015

Balanced

Claude 3 Series

Claude 3.5 Sonnet

$0.003

$0.015

Claude 3.5 Haiku

$0.00025

$0.00125

Fastest

Claude 3 Opus

$0.015

$0.075

Claude 3 Sonnet

$0.003

$0.015

Claude 3 Haiku

$0.00025

$0.00125

Most affordable

Google Gemini (2025)

Model

Input (per 1K tokens)

Output (per 1K tokens)

Notes

Gemini 2.0 Series

Gemini 2.0 Flash (Exp)

Free

Free

Experimental preview

Gemini 2.0 Flash Thinking

Free

Free

Reasoning preview

Gemini 1.5 Series

Gemini 1.5 Pro

$0.00125

$0.005

Most capable

Gemini 1.5 Flash

$0.000075

$0.0003

Fast & efficient

Gemini 1.5 Flash-8B

$0.0000375

$0.00015

Ultra-fast

Gemini 1.0 Series

Gemini 1.0 Pro

$0.0005

$0.0015

Legacy model

Gemini 1.0 Pro Vision

$0.00025

$0.0005

Multimodal

Gemini Ultra

$0.002

$0.006

Premium tier

Note: Prices shown are per 1,000 tokens. Batch API offers 50% discount. Prompt caching can reduce costs by up to 90%.

šŸŽÆ Examples

Run the example:

npm run example

Check examples/basic-usage.js for detailed usage patterns.

šŸ“ API Reference

new TokenTracker(config)

  • config.currency: 'USD' or 'KRW' (default: 'USD')

  • config.webhookUrl: Optional webhook for usage notifications

tracker.wrap(client)

Wrap an OpenAI or Anthropic client for automatic tracking.

tracker.forUser(userId)

Create a user-specific tracker instance.

tracker.startTracking(userId?, sessionId?)

Start manual tracking session. Returns tracking ID.

tracker.endTracking(trackingId, usage)

End tracking and record usage.

tracker.getUserUsage(userId)

Get total usage for a user.

tracker.getAllUsersUsage()

Get usage summary for all users.

šŸ›  Development

# Install dependencies
npm install

# Build TypeScript
npm run build

# Watch mode
npm run dev

# Run examples
npm run example

šŸ“„ License

MIT

šŸ¤ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

šŸ› Issues

For bugs and feature requests, please create an issue.

šŸ“¦ What's New in v2.4.0

  • šŸŽ‰ Gemini API Support - Full integration with Google's Gemini models

  • šŸ’Ž Gemini 2.0 Support - Free preview models included

  • šŸ“Š Enhanced Pricing - Up-to-date Gemini 1.5 and 2.0 pricing

  • šŸ”§ Auto-detection - Automatic Gemini client wrapping

  • šŸ’° Cost Comparison - Compare Gemini with OpenAI and Claude

šŸ“¦ What's New in v2.3.0

  • šŸ’± Real-time exchange rates - Automatic USD to KRW conversion

  • 🌐 Uses exchangerate-api.com for accurate rates

  • šŸ’¾ 24-hour caching to minimize API calls

  • šŸ“Š New get_exchange_rate tool to check current rates

  • šŸ”„ Background auto-updates with fallback support

What's New in v2.2.0

  • šŸ—„ļø File-based persistence - Session data survives server restarts

  • šŸ’¾ Automatic saving to ~/.llm-token-tracker/sessions.json

  • šŸ”„ Works for both npm and local installations

  • šŸ“Š Historical data tracking across sessions

  • šŸŽÆ Zero configuration required - just works!

What's New in v2.1.0

  • šŸ†• Added get_current_session tool for intuitive session tracking

  • šŸ“Š Real-time progress bars and visual indicators

  • šŸ’° Enhanced cost breakdown with input/output token separation

  • šŸŽØ Improved formatting with thousands separators

  • šŸ”§ Better default user_id handling (current-session)


Built with ā¤ļø for developers who need transparent AI API billing.

Available Tools

6 tools
clear_usageC

Clear usage data

ParametersJSON Schema
NameRequiredDescriptionDefault
user_idYesUser ID to clear

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. 'Clear usage data' implies a destructive mutation, but it doesn't disclose behavioral traits like whether this is irreversible, requires admin permissions, affects other data, or has side effects. The description is minimal and lacks critical context for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description 'Clear usage data' is extremely concise with zero waste, using only three words. However, it's arguably under-specified rather than optimally concise, as it lacks necessary detail for a mutation tool. It's front-loaded but too brief to be fully helpful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a destructive mutation with one parameter), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects, return values, or error conditions, leaving significant gaps for an agent to understand and invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'user_id' documented as 'User ID to clear'. The description adds no meaning beyond this, as it doesn't explain parameter usage, format, or constraints. With high schema coverage, the baseline score of 3 is appropriate, as the schema handles parameter documentation adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Clear usage data' states a verb ('Clear') and resource ('usage data'), providing a basic purpose. However, it's vague about what 'clear' means (delete, reset, archive?) and doesn't distinguish from sibling tools like 'get_usage' or 'track_usage'. It's not tautological but lacks specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, context, or exclusions, and there's no reference to sibling tools like 'get_usage' for comparison. Usage is implied only by the tool name and description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

compare_costsC

Compare costs between models

ParametersJSON Schema
NameRequiredDescriptionDefault
tokensYesNumber of tokens to compare

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states what the tool does at a high level ('compare costs') without explaining how it behaves: whether it requires authentication, what data sources it uses, whether it makes network calls, what format the comparison results take, or any rate limits. This leaves significant gaps in understanding the tool's operational characteristics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just three words: 'Compare costs between models'. It's front-loaded with the core action and contains no unnecessary information. Every word serves a purpose in conveying the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's apparent complexity (comparing costs between models likely involves multiple data sources and calculations), the description is insufficient. With no annotations, no output schema, and only a minimal description, there's inadequate information about what the tool returns, how it performs comparisons, or what models are involved. The description doesn't compensate for the lack of structured metadata.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'tokens' clearly documented as 'Number of tokens to compare'. The description doesn't add any additional meaning beyond what the schema provides—it doesn't explain what 'tokens' represent in context or how they relate to cost comparison. With high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Compare costs between models' states a general purpose but lacks specificity. It mentions the verb 'compare' and resource 'costs between models', but doesn't specify what models are being compared or how the comparison works. It doesn't distinguish from sibling tools like 'get_exchange_rate' or 'track_usage' which might involve cost-related operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There are no explicit instructions about when to invoke it, when not to use it, or what alternatives exist among the sibling tools. The user must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_current_sessionC

Get current session usage with intuitive format (remaining, used, input/output tokens, cost)

ParametersJSON Schema
NameRequiredDescriptionDefault
user_idNoUser ID (defaults to current-session)current-session
total_budgetNoTotal token budget (optional)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions 'intuitive format' but doesn't disclose behavioral traits such as whether this is a read-only operation, if it requires authentication, rate limits, or how it handles errors. The description is too vague to provide adequate transparency for a tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. However, it could be more structured by separating the purpose from the format details, but it avoids unnecessary verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a tool that likely returns usage data, the description is incomplete. It doesn't explain the return format beyond 'intuitive format', lacks details on what 'cost' refers to, and doesn't cover potential errors or edge cases, leaving significant gaps for an agent to understand the tool fully.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters (user_id and total_budget) with descriptions and defaults. The description adds no additional meaning beyond what the schema provides, such as explaining how these parameters affect the output or their practical use cases.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get current session usage' with specific metrics (remaining, used, input/output tokens, cost). It uses a specific verb ('Get') and resource ('current session usage'), though it doesn't explicitly distinguish from sibling tools like 'get_usage' or 'track_usage'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_usage' or 'track_usage'. It mentions an 'intuitive format' but doesn't specify contexts or exclusions for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_exchange_rateB

Get current USD to KRW exchange rate with cache info

ParametersJSON Schema
NameRequiredDescriptionDefault
force_refreshNoForce refresh from API (default: false)

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions 'cache info', which hints at caching behavior, but doesn't disclose details like cache duration, refresh mechanisms, or rate limits. It implies a read operation but doesn't specify error conditions or authentication needs. The description adds some context but lacks comprehensive behavioral details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Get current USD to KRW exchange rate') and adds a key feature ('with cache info') without unnecessary words. It's appropriately sized for a simple tool with one parameter.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one optional parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and hints at caching behavior, but lacks details on return values, error handling, or integration context. For a financial data tool, more completeness would be beneficial, but it meets the minimum for this context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with one parameter ('force_refresh') fully documented in the schema. The description doesn't add any parameter-specific information beyond what the schema provides, such as explaining when to use 'force_refresh' or its impact on caching. With high schema coverage, the baseline is 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Get current USD to KRW exchange rate with cache info'. It specifies the verb ('Get'), resource ('USD to KRW exchange rate'), and an additional feature ('cache info'). However, it doesn't explicitly differentiate from sibling tools, which appear unrelated (usage tracking, session management, cost comparison).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, constraints, or scenarios where this tool is preferred over other methods. The sibling tools seem unrelated, but no explicit comparison or exclusion criteria are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_usageC

Get usage summary

ParametersJSON Schema
NameRequiredDescriptionDefault
user_idNoUser ID (optional)

TDQS

C2.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Get usage summary' implies a read operation, but it doesn't specify if it's safe, requires authentication, has rate limits, or what the output format might be. It's minimal and lacks critical behavioral details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just three words, front-loaded and zero waste. It efficiently states the core action without unnecessary elaboration, though this brevity contributes to gaps in other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a usage-related tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'usage' refers to, what data is returned, or how to interpret results, leaving significant gaps for an AI agent to understand and use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage, fully describing the optional 'user_id' parameter. The description adds no additional meaning beyond what the schema provides, such as explaining what 'usage summary' includes or how the parameter affects results. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get usage summary' restates the tool name 'get_usage' in a slightly different phrasing, making it tautological. It doesn't specify what type of usage (e.g., API, resource, billing) or what 'summary' entails, leaving the purpose vague beyond the obvious from the name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'track_usage' or 'compare_costs' among the sibling tools. The description lacks context about prerequisites, timing, or specific use cases, offering no help in tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

track_usageC

Track token usage for an AI API call

ParametersJSON Schema
NameRequiredDescriptionDefault
providerYesAI provider
modelYesModel name
input_tokensYesInput tokens used
output_tokensYesOutput tokens used
user_idNoOptional user ID

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. 'Track' implies a write or logging operation, but the description doesn't disclose whether this creates records, updates a database, requires authentication, has side effects, or returns any confirmation. For a mutation-like tool with zero annotation coverage, this is a significant gap in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a tool with 5 parameters, no annotations, and no output schema), the description is incomplete. It doesn't explain what 'track' entails operationally, what happens after invocation, or how this differs from sibling tools. For a tool that likely modifies state, more context is needed to guide proper usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description adds no additional meaning beyond implying these parameters are used for tracking token usage, which is already evident from the schema. This meets the baseline of 3 when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('track') and resource ('token usage for an AI API call'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'get_usage' or 'clear_usage', which likely handle related aspects of usage data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'get_usage' (likely for retrieval) and 'clear_usage' (likely for deletion), the agent has no indication whether this is for logging, monitoring, or another purpose, or what prerequisites might exist.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.0.0
    • Changedtrack_usage1 field changed
      • changedInput schema / properties / provider / enum
        Previous value: -[
        -  "openai",
        -  "anthropic"
        -]New value: +[
        +  "openai",
        +  "anthropic",
        +  "gemini"
        +]
  2. 6 tool updates
    • First observedclear_usage
    • First observedcompare_costs
    • First observedget_current_session
    • First observedget_exchange_rate
    • First observedget_usage
    • First observedtrack_usage

TDQS

B3.1/5.0

Scored across 6 tools

Disambiguation4/5

Most tools have distinct purposes, but get_current_session and get_usage could be confused as both retrieve usage data, though their descriptions differentiate them slightly (session-specific vs. summary). The other tools (clear_usage, compare_costs, get_exchange_rate, track_usage) are clearly distinct.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with snake_case (e.g., clear_usage, compare_costs, get_current_session). There are no deviations in naming style, making them predictable and readable.

Tool Count5/5

With 6 tools, the count is well-scoped for tracking LLM token usage and costs. Each tool serves a specific function in this domain, such as tracking, retrieving, clearing, and comparing data, without being excessive or insufficient.

Completeness3/5

The toolset covers core operations like tracking, retrieving, and clearing usage, but lacks update or delete capabilities for specific entries, which might be needed for error correction. The inclusion of get_exchange_rate is useful but slightly tangential to the main purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables token counting, usage tracking, and cost calculation for LLM APIs, with a proxy server mode to automatically intercept and monitor API requests from clients like Cursor and Windsurf.
    172
    1
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Counts LLM prompt tokens and estimates API costs across OpenAI and Anthropic models directly inside MCP-compatible chat clients. Supports exact tokenization for OpenAI models and fallback approximation for Claude when no API key is present.
    4
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wn01011/llm-token-tracker'

If you have feedback or need assistance with the MCP directory API, please join our Discord server