ai-cost-optimizer
Cloudflare Workers MCP server: ai-cost-optimizer
我該用這個嗎
品質與安全性
A
根據工具定義與協定合規性的自動化分析。
上下文成本
~584Token(工具定義)
~1.1 KB典型回應大小
極小的注意力影響(128k 上下文的 0.46%)
這是每次將伺服器的工具載入模型上下文時所消耗的約略 token 數量。數量越高,可用於其他工作的注意力就越少。
安裝
一鍵安裝
將以下內容加入你的 `claude_desktop_config.json` 檔案:
{
"mcpServers": {
"ai-cost-optimizer": {
"url": "https://api.lazy-mac.com/ai-cost-optimizer/mcp"
}
}
}遠端端點
https://api.lazy-mac.com/ai-cost-optimizer/mcpstreamable-http它能做什麼
工具清單
工具(5)
🟢 唯讀🟡 寫入🔴 刪除⚪ 未知
🟢cost_tracker(action, model, inputTokens, outputTokens, team, ...)
Record and retrieve AI API call costs by team. Persists to Cloudflare KV — survives cold starts and scale-out.
輸入結構描述
{
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"record",
"get"
],
"description": "\"record\" to log a call, \"get\" to retrieve recent records"
},
"model": {
"type": "string",
"description": "Model ID (e.g., claude-3-5-sonnet-20241022, gpt-4o, gemini-2.0-flash)"
},
"inputTokens": {
"type": "number",
"description": "Number of input/prompt tokens consumed"
},
"outputTokens": {
"type": "number",
"description": "Number of output/completion tokens generated"
},
"team": {
"type": "string",
"description": "Team or project identifier (default: \"default\")"
},
"metadata": {
"type": "object",
"description": "Optional key-value metadata (request ID, user, feature flag, etc.)"
}
},
"required": [
"action"
]
}🟢token_calculator(model, inputTokens, outputTokens)
Calculate cost from token counts for any supported AI model. Stateless — no KV required.
輸入結構描述
{
"type": "object",
"properties": {
"model": {
"type": "string",
"description": "Model ID to price"
},
"inputTokens": {
"type": "number",
"description": "Input token count"
},
"outputTokens": {
"type": "number",
"description": "Output token count"
}
},
"required": [
"model",
"inputTokens",
"outputTokens"
]
}🟡budget_alert(action, team, budgetLimit, threshold)
Set and check budget limits for teams. Raises a flag when a configurable spending threshold is reached.
輸入結構描述
{
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"set",
"check"
],
"description": "\"set\" to configure a budget, \"check\" to get current status"
},
"team": {
"type": "string",
"description": "Team identifier"
},
"budgetLimit": {
"type": "number",
"description": "USD budget cap"
},
"threshold": {
"type": "number",
"description": "Alert threshold percentage 0–100 (default: 80)"
}
},
"required": [
"action"
]
}🟢model_breakdown(team, days)
Analyze costs broken down by model for a given team over a configurable time window.
輸入結構描述
{
"type": "object",
"properties": {
"team": {
"type": "string",
"description": "Team identifier"
},
"days": {
"type": "number",
"description": "Lookback window in days (default: 30)"
}
}
}⚪cost_forecast(team, forecastDays, historicalDays)
Forecast future AI spend based on historical usage patterns using daily-average linear projection.
輸入結構描述
{
"type": "object",
"properties": {
"team": {
"type": "string",
"description": "Team identifier"
},
"forecastDays": {
"type": "number",
"description": "Days to project ahead (default: 7)"
},
"historicalDays": {
"type": "number",
"description": "Days of history to base the forecast on (default: 30)"
}
}
}社群
證據
近期觀測
已驗證未記錄版本5 個工具
已驗證未記錄版本5 個工具
已驗證未記錄版本5 個工具