$ man llm-cost-estimate
/llm-cost-estimate
PRICE / CALL
$0.005
USDC · base mainnet · scheme: exact
METHOD
POST
CLUSTER
modelrouterCATEGORY
uncategorized
STATUS
● live
NAME
llm-cost-estimate — llm cost estimate api and token cost calculator for comparing inference cost across models before you run a prompt
SYNOPSIS
POST https://x402.agentutility.ai/llm-cost-estimate
Content-Type: application/json
X-PAYMENT: <signed-transferWithAuthorization>
{ ... }↳ first call →
402 Payment Required. Sign USDCtransferWithAuthorization, retry with theX-PAYMENT header.DESCRIPTION
LLM cost estimate API and token cost calculator for comparing inference cost across models before you run a prompt. Send input_tokens and output_tokens (or raw text, auto-estimated at roughly 4 characters per token) plus a list of model names, and get a per-model price breakdown from a built-in snapshot price table, with the cheapest known model called out. Pass price_overrides to price your own negotiated rates or a model missing from the table instead of getting a guess. The table is stamped with an as_of date so you know how fresh the snapshot is. Use it as a token cost calculator, a model price compare tool, or a pre-flight budget check before an LLM run or agent workflow.
INPUT — request schema
| property | type | description | req? |
|---|---|---|---|
| input_tokens | number | Number of input/prompt tokens. Optional if 'text' is given. | optional |
| output_tokens | number | Number of output/completion tokens. Optional, defaults to 0. | optional |
| text | string | Raw prompt text; used to estimate input_tokens (~chars/4) when input_tokens is not given directly. Max 500,000 chars. | optional |
| models | array | Model names to estimate cost for, e.g. ['gpt-4o-mini', 'claude-sonnet-4.5']. Defaults to a small built-in comparison set. Max 30. | optional |
| price_overrides | object | Optional per-model price overrides keyed by model name: { input_per_1m?: number, output_per_1m?: number }. Use for current pricing or models missing from the built-in table. | optional |
OUTPUT — response shape
| field | type | description |
|---|---|---|
| input_tokens | string | — |
| output_tokens | string | — |
| token_source | string | — |
| estimates | string | — |
| cheapest_known | string | — |
| price_table_as_of | string | — |
| note | string | — |
EXAMPLES — two ways to call
EXAMPLE 1 · curl
curl -X POST https://x402.agentutility.ai/llm-cost-estimate \
-H 'Content-Type: application/json' \
-d '{ }'first response =
402 Payment Required with payment requirements; sign + retry with X-PAYMENT.EXAMPLE 2 · mcp
# Install the MCP package for this endpoint's cluster npx -y @agentutility/mcp-<cluster> # Required: EVM private key with USDC on Base export X402_PRIVATE_KEY=0x... # Then call the llm-cost-estimate tool from your MCP-aware agent.
MCP server handles payment automatically — your coding agent just calls the tool by name.
METADATA
- tags
- model-routerllmcostestimatellm-cost-estimate
- methods
- POST
- cluster
- modelrouter
- price
- $0.005 USDC per call
ADJACENT — other endpoints in modelrouter
| endpoint | description | price |
|---|---|---|
| model-route-recommend | Model routing API that answers 'which model should I use' from plain task requirements. | $0.01 |
SEE ALSO