Ai Token Counter

io.github.lazymac2xPublished by GitHub account lazymac2xv1.0.0Updated Oct 24, 2026

Cloudflare Workers MCP server: ai-token-counter

VerifiedStreamable HTTPWeb executableData & AnalyticsAI & ML

Overview

AI-generated overview

A remote MCP server that counts tokens and estimates API costs for major AI models such as GPT-4o, Claude, Gemini, Mistral and Llama.

What you can do
Count tokens for a text string or a chat messages array for supported AI models, including GPT-4o, Claude, Gemini, Mistral and Llama. Estimate the input, output and total cost of an AI API call from a model and token counts or text, with an optional monthly projection. Look up input and output pricing per million tokens for a specific model. List all supported models with their pricing and context windows.
When to use it
Useful when you want to check prompt or conversation size against a model's context window, or compare and budget API costs across providers before making calls.
Requirements
A remote endpoint; no local runtime, account, API key or environment variable is declared. Network access to the hosted service is needed.
Before you install
Text and chat messages sent for counting are transmitted to a third-party hosted service. Pricing figures are informational and may not match current provider rates, so verify costs before relying on them for billing.

Installation

In SourceWeft

  1. Open Ai Token Counter in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Web executable via Streamable HTTP. Remote servers run from the web runtime once configured in a workspace.

Use with an agent

Paste this prompt into Claude Code, Codex, Cursor or another agent — or into SourceWeft chat. The agent reads this server's install guide, shows you its publisher, endpoint and sign-in, and adds it to your client once you agree. Keys never go into a command.

Read https://sourceweft.com/mcp/io.github.lazymac2x%2Fai-token-counter/install.md and connect the MCP server it describes to my client. Before changing any config, show me its publisher, endpoint and sign-in method and wait for my OK. Never put an API key in a command or in a file I would commit; ask me where it should come from.

Read the install guide the agent follows

Other MCP clients

Add this to your client's mcpServers config.

{
  "mcpServers": {
    "ai-token-counter": {
      "type": "http",
      "url": "https://api.lazy-mac.com/ai-token-counter/mcp"
    }
  }
}

README

ai-token-counter-api

Cloudflare Workers MCP server: ai-token-counter. REST + MCP (JSON-RPC 2.0). Live: api.lazy-mac.com/ai-token-counter

Source: README.md at commit aa1e26a

Tools

4

count_tokens

Count tokens for a text string or chat messages array for any supported AI model (GPT-4o, Claude, Gemini, Mistral, Llama).

Parameterstextmodelmessages

estimate_cost

Estimate the cost of an AI API call given model and token counts or text. Returns input/output/total cost and optional monthly projection.

Parameterstextmodelrequiredinput_tokensoutput_tokensrequests_per_day

get_model_pricing

Get input/output pricing per 1M tokens for a specific AI model.

Parametersmodelrequired

list_models

List all supported AI models with their pricing and context windows.

Takes no parameters.

Version history

1
  1. v1.0.0LatestSep 16, 2026

Score

90% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 daysRequired25 pts
  • Auth declaredRequired10 pts
  • Tools listedRequired15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

    Declare a license in the repository or the registry entry.