ai-cost-optimizer-api
Cloudflare Workers MCP server: ai-cost-optimizer. REST + MCP (JSON-RPC 2.0). Live: api.lazy-mac.com/ai-cost-optimizer
by lazymac2x
Cloudflare Workers MCP server: ai-cost-optimizer
Optimizes AI and cloud service costs through analysis and recommendations.
Captured live from the server via tools/list.
Record and retrieve AI API call costs by team. Persists to Cloudflare KV — survives cold starts and scale-out.
"record" to log a call, "get" to retrieve recent records
Model ID (e.g., claude-3-5-sonnet-20241022, gpt-4o, gemini-2.0-flash)
Number of input/prompt tokens consumed
Number of output/completion tokens generated
Team or project identifier (default: "default")
Optional key-value metadata (request ID, user, feature flag, etc.)
Calculate cost from token counts for any supported AI model. Stateless — no KV required.
Model ID to price
Input token count
Output token count
Set and check budget limits for teams. Raises a flag when a configurable spending threshold is reached.
"set" to configure a budget, "check" to get current status
Team identifier
USD budget cap
Alert threshold percentage 0–100 (default: 80)
Analyze costs broken down by model for a given team over a configurable time window.
Team identifier
Lookback window in days (default: 30)
Forecast future AI spend based on historical usage patterns using daily-average linear projection.
Team identifier
Days to project ahead (default: 7)
Days of history to base the forecast on (default: 30)
Cloudflare Workers MCP server: ai-cost-optimizer. REST + MCP (JSON-RPC 2.0). Live: api.lazy-mac.com/ai-cost-optimizer
claude_desktop_config.json
{
"mcpServers": {
"ai-cost-optimizer": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://api.lazy-mac.com/ai-cost-optimizer/mcp"
]
}
}
}Desktop config is stdio-only; this bridges via mcp-remote. Native remote: Settings > Connectors.