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
by lazymac2x
Cloudflare Workers MCP server: ai-token-counter
Counts and monitors token usage for AI model requests and responses.
Captured live from the server via tools/list.
Count tokens for a text string or chat messages array for any supported AI model (GPT-4o, Claude, Gemini, Mistral, Llama).
Model ID, e.g. gpt-4o, claude-sonnet-4. Defaults to gpt-4o.
Plain text to count tokens for.
Chat messages array in OpenAI/Anthropic format.
Estimate the cost of an AI API call given model and token counts or text. Returns input/output/total cost and optional monthly projection.
Model ID, e.g. gpt-4o, claude-opus-4, gemini-2.0-flash.
Number of input tokens.
Number of output tokens.
Text to tokenize for input (if input_tokens not given).
If given, adds daily/monthly/yearly cost projection.
Get input/output pricing per 1M tokens for a specific AI model.
Model ID, e.g. gpt-4o, claude-haiku-3, llama-3-70b.
List all supported AI models with their pricing and context windows.
No parameters.
Cloudflare Workers MCP server: ai-token-counter. REST + MCP (JSON-RPC 2.0). Live: api.lazy-mac.com/ai-token-counter
claude_desktop_config.json
{
"mcpServers": {
"ai-token-counter": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://api.lazy-mac.com/ai-token-counter/mcp"
]
}
}
}Desktop config is stdio-only; this bridges via mcp-remote. Native remote: Settings > Connectors.