ai-cost-optimizer
v1.0.0Cloudflare Workers MCP server: ai-cost-optimizer
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
cost_tracker
Record and retrieve AI API call costs by team. Persists to Cloudflare KV — survives cold starts and scale-out.
| Parameter | Type | Description |
|---|---|---|
action * | string | "record" to log a call, "get" to retrieve recent records |
inputTokens | number | Number of input/prompt tokens consumed |
metadata | object | Optional key-value metadata (request ID, user, feature flag, etc.) |
model | string | Model ID (e.g., claude-3-5-sonnet-20241022, gpt-4o, gemini-2.0-flash) |
outputTokens | number | Number of output/completion tokens generated |
team | string | Team or project identifier (default: "default") |
token_calculator
Calculate cost from token counts for any supported AI model. Stateless — no KV required.
| Parameter | Type | Description |
|---|---|---|
inputTokens * | number | Input token count |
model * | string | Model ID to price |
outputTokens * | number | Output token count |
budget_alert
Set and check budget limits for teams. Raises a flag when a configurable spending threshold is reached.
| Parameter | Type | Description |
|---|---|---|
action * | string | "set" to configure a budget, "check" to get current status |
budgetLimit | number | USD budget cap |
team | string | Team identifier |
threshold | number | Alert threshold percentage 0–100 (default: 80) |
model_breakdown
Analyze costs broken down by model for a given team over a configurable time window.
| Parameter | Type | Description |
|---|---|---|
days | number | Lookback window in days (default: 30) |
team | string | Team identifier |
cost_forecast
Forecast future AI spend based on historical usage patterns using daily-average linear projection.
| Parameter | Type | Description |
|---|---|---|
forecastDays | number | Days to project ahead (default: 7) |
historicalDays | number | Days of history to base the forecast on (default: 30) |
team | string | Team identifier |