mcp-token-optimizer
v0.1.1Cut LLM token costs: count tokens, estimate cost, slim prompts, and pick the cheapest capable model.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
count_tokens
Count the tokens in a piece of text and show the input cost across common LLM models (or one model if specified). Use before sending a prompt to know its size and price.
| Parameter | Type | Description |
|---|---|---|
text * | string | The text/prompt to measure. |
model | string | Optional model id (e.g. gpt-4o, claude-sonnet-4). Omit to compare across common models. |
estimate_cost
Estimate the per-call and monthly cost of a prompt for a given model, including assumed completion tokens and call volume. Use to forecast LLM spend.
| Parameter | Type | Description |
|---|---|---|
text * | string | The input prompt. |
completion_tokens | number | Assumed output tokens per call (default 0). |
model | string | Model id (default gpt-4o). |
monthly_calls | number | Calls per month, to project monthly/yearly spend (default 0). |
slim_prompt
Compress a prompt with safe, meaning-preserving rules (shorten verbose phrases, drop filler, dedupe lines, normalize whitespace) and report tokens and dollars saved. Use to cut token costs without an LLM call.
| Parameter | Type | Description |
|---|---|---|
text * | string | The prompt to slim down. |
model | string | Model id used to price the savings (default gpt-4o). |
monthly_calls | number | Calls per month, to project monthly savings (default 0). |
compare_model_costs
Compare the per-call cost of a prompt across many models and recommend the cheapest. Use to route work to the cheapest capable model.
| Parameter | Type | Description |
|---|---|---|
text * | string | The input prompt. |
completion_tokens | number | Assumed output tokens per call (default 0). |
models | array | Optional subset of model ids to compare. Omit for all known models. |