modelcostsaver

v0.1.1
io.github.sachinuppal/modelcostsaver Checked 4 days ago Published 5 months ago

Offline MCP: predict LLM call cost 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.

estimate_cost Estimate cost

Estimate the cost of a single LLM call for one model from known or estimated token counts. Offline, no keys.

ParameterTypeDescription
model *stringModel alias or full id, e.g. "sonnet" or "claude-sonnet-4-6".
charsPerTokennumberOverride the chars-per-token heuristic divisor.
expectedOutputTextstringExpected output text; estimated if outputTokens is absent.
inputTextstringPrompt text; estimated to tokens if inputTokens is absent.
inputTokensintegerExact input tokens; optional if inputText is given.
outputTokensintegerExact output tokens; defaults to the model output cap.

predict_cost Predict cost

Forecast the cost of a prompt across candidate models before the call. Returns a cheapest-first ranking with assumptions. Offline.

ParameterTypeDescription
candidatesarrayCandidate models (alias or id); defaults to all chat-capable.
charsPerTokennumber
contextTokensintegerKnown context tokens already loaded.
expectedOutputTokensintegerExact output tokens; else inferred from taskClass/model.
includeLocalboolean
inputTokensintegerExact input tokens (skips prompt estimation).
promptstringThe prompt to forecast; estimated to tokens if inputTokens absent.
providersarrayAxis 1: provider availability allowlist (spec 5.4).
targetstringAxis 2: "self" (default) applies the client scope; "code" considers all providers.
taskClassstringDrives the default output cap.

select_optimal_model Select optimal model

Pick the single cheapest model that meets the task tier, capabilities, and budget, with full reasoning and a fallbackChain. Offline.

ParameterTypeDescription
estimatedInputTokens *integerEstimated input tokens for the forecast.
estimatedOutputTokens *integerEstimated output tokens for the forecast.
includeLocalboolean
maxCostUsdnumberBudget ceiling for the predicted call cost.
providersarrayAxis 1: provider availability allowlist (spec 5.4).
requiredCapabilitiesarrayCapabilities the model must support.
targetstringAxis 2: "self" (default) applies the client scope; "code" considers all providers.
taskstringFree-text task; used for the tier heuristic when taskClass is absent.
taskClassstringExplicit task class; overrides the heuristic.

compare_models Compare models

Compare models side by side for a fixed token shape, cheapest first, with the multiple of the cheapest. Offline.

ParameterTypeDescription
inputTokens *integerInput tokens for the comparison.
models *arrayModels to compare (alias or id).
outputTokens *integerOutput tokens for the comparison.
providersarrayAxis 1: provider availability allowlist (spec 5.4).
targetstringAxis 2: "self" (default) applies the client scope; "code" considers all providers.

list_models List models / pricing

Return the model catalog with pricing, optionally filtered. capabilities are arrays. Offline.

ParameterTypeDescription
capabilitystringRequire a capability.
includeLocalbooleanInclude local / self-hosted $0 models (off by default).
maxInputPerMillionnumberOnly models at or below this input price per 1M tokens.
providerstringFilter to a single provider.
tierstringFilter to a single tier.

get_pricing List models / pricing

Return the model catalog with pricing, optionally filtered. capabilities are arrays. Offline.

ParameterTypeDescription
capabilitystringRequire a capability.
includeLocalbooleanInclude local / self-hosted $0 models (off by default).
maxInputPerMillionnumberOnly models at or below this input price per 1M tokens.
providerstringFilter to a single provider.
tierstringFilter to a single tier.

optimize_request Optimize request

Check whether a cheaper capable model exists for a call you plan to make, and report the savings. Offline.

ParameterTypeDescription
currentModel *stringThe model you plan to call (alias or id).
inputTokens *integerInput tokens for the call.
outputTokens *integerOutput tokens for the call.
crossProviderbooleanConsider other providers too (may need a different API key). Default false.
includeLocalboolean
providersarrayAxis 1: provider availability allowlist (spec 5.4).
targetstringAxis 2: "self" (default) applies the client scope; "code" considers all providers.
taskClassstringTask class; sets the tier the recommendation must still meet.