ai-token-counter
Cloudflare Workers MCP server: ai-token-counter
我該用這個嗎
品質與安全性
A
根據工具定義與協定合規性的自動化分析。
上下文成本
~421Token(工具定義)
~757 B典型回應大小
極小的注意力影響(128k 上下文的 0.33%)
這是每次將伺服器的工具載入模型上下文時所消耗的約略 token 數量。數量越高,可用於其他工作的注意力就越少。
安裝
一鍵安裝
將以下內容加入你的 `claude_desktop_config.json` 檔案:
{
"mcpServers": {
"ai-token-counter": {
"url": "https://api.lazy-mac.com/ai-token-counter/mcp"
}
}
}遠端端點
https://api.lazy-mac.com/ai-token-counter/mcpstreamable-http它能做什麼
工具清單
工具(4)
🟢 唯讀🟡 寫入🔴 刪除⚪ 未知
🟢count_tokens(model, text, messages)
Count tokens for a text string or chat messages array for any supported AI model (GPT-4o, Claude, Gemini, Mistral, Llama).
輸入結構描述
{
"type": "object",
"properties": {
"model": {
"type": "string",
"description": "Model ID, e.g. gpt-4o, claude-sonnet-4. Defaults to gpt-4o."
},
"text": {
"type": "string",
"description": "Plain text to count tokens for."
},
"messages": {
"type": "array",
"description": "Chat messages array in OpenAI/Anthropic format.",
"items": {
"type": "object"
}
}
}
}⚪estimate_cost(model, input_tokens, output_tokens, text, requests_per_day)
Estimate the cost of an AI API call given model and token counts or text. Returns input/output/total cost and optional monthly projection.
輸入結構描述
{
"type": "object",
"properties": {
"model": {
"type": "string",
"description": "Model ID, e.g. gpt-4o, claude-opus-4, gemini-2.0-flash."
},
"input_tokens": {
"type": "integer",
"description": "Number of input tokens."
},
"output_tokens": {
"type": "integer",
"description": "Number of output tokens."
},
"text": {
"type": "string",
"description": "Text to tokenize for input (if input_tokens not given)."
},
"requests_per_day": {
"type": "number",
"description": "If given, adds daily/monthly/yearly cost projection."
}
},
"required": [
"model"
]
}🟢get_model_pricing(model)
Get input/output pricing per 1M tokens for a specific AI model.
輸入結構描述
{
"type": "object",
"properties": {
"model": {
"type": "string",
"description": "Model ID, e.g. gpt-4o, claude-haiku-3, llama-3-70b."
}
},
"required": [
"model"
]
}🟢list_models
List all supported AI models with their pricing and context windows.
輸入結構描述
{
"type": "object",
"properties": {}
}社群
證據
近期觀測
已驗證未記錄版本4 個工具
已驗證未記錄版本4 個工具
已驗證未記錄版本4 個工具