Catalog/llm-cost-estimate

LLM

LLM cost estimator API

Estimates an LLM call cost from token counts and caller-supplied per-1K rates (separate input, output, and cached-read rates), returning the line-item breakdown, total, and blended cost-per-1K — provider-agnostic and keyless. Answers 'what does this LLM call cost?', 'how do I price input vs output vs cached tokens?'.

Price$0.02per request
MethodPOST
Route/v1/llm/cost-estimate
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
llmcostpricingtokensestimatebillingspendagent
API URLhttps://x402.hexl.dev/v1/llm/cost-estimate
Integration docs
Example request
{
  "inputTokens": 1000,
  "outputTokens": 500,
  "inputRatePer1k": 0.003,
  "outputRatePer1k": 0.015
}
Example response
{
  "inputTokens": 1000,
  "outputTokens": 500,
  "cachedTokens": 0,
  "inputCost": 0.003,
  "outputCost": 0.0075,
  "cachedCost": 0,
  "totalCost": 0.0105,
  "currency": "USD",
  "costPer1kTotal": 0.007
}
Input schema
{
  "type": "object",
  "required": [
    "inputTokens",
    "outputTokens",
    "inputRatePer1k",
    "outputRatePer1k"
  ],
  "properties": {
    "inputTokens": {
      "type": "number",
      "examples": [
        1000
      ]
    },
    "outputTokens": {
      "type": "number",
      "examples": [
        500
      ]
    },
    "cachedTokens": {
      "type": "number",
      "default": 0
    },
    "inputRatePer1k": {
      "type": "number",
      "examples": [
        0.003
      ]
    },
    "outputRatePer1k": {
      "type": "number",
      "examples": [
        0.015
      ]
    },
    "cachedRatePer1k": {
      "type": "number"
    },
    "currency": {
      "type": "string",
      "default": "USD"
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}