59trust / 100

Dev Llm Cost Calculator

by AgentTools in AI models & inference

x402 APIFailing, checked 3 h ago

Calculate the API cost of an LLM call: input and output tokens × published per-million prices for 15 current models (OpenAI, Anthropic, Google, DeepSeek, xAI, Meta). Batch multiplier included for monthly estimates. Use this when an agent needs to tokens × current per-model prices = USD.

GET https://agenttools-hub.vercel.app/api/v1/dev/llm-cost-calculator

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
25.0%
Response time
153 ms typical, 153 ms slowest 5%
Last check
3 h ago: Expected HTTP 402, got 308
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X GET "https://agenttools-hub.vercel.app/api/v1/dev/llm-cost-calculator?calls=1&inputTokens=12000&model=gpt-4o&outputTokens=1500"
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagenttools-hub.vercel.app%2Fapi%2Fv1%2Fdev%2Fllm-cost-calculator
const res = await pay("https://agenttools-hub.vercel.app/api/v1/dev/llm-cost-calculator?calls=1&inputTokens=12000&model=gpt-4o&outputTokens=1500");
console.log(await res.json());

Example input

{
  "calls": 1,
  "inputTokens": 12000,
  "model": "gpt-4o",
  "outputTokens": 1500
}

Example output

{
  "result": {
    "answer": "$0.0450",
    "answerLabel": "Cost — OpenAI gpt-4o",
    "details": [
      {
        "label": "Input cost",
        "value": "$0.030000 (12,000 tok × $2.5/M)"
      },
      {
        "label": "Output cost",
        "value": "$0.015000 (1,500 tok × $10/M)"
      },
      {
        "label": "Per call",
        "value": "$0.045000"
      },
      {
        "label": "Projected monthly (1 call/day)",
        "value": "$1.3500"
      }
    ],
    "steps": [
      "input: 12,000 ÷ 1e6 × $2.5",
      "output: 1,500 ÷ 1e6 × $10",
      "× 1 call(s) = total"
    ],
    "table": {
      "columns": [
        "Model",
        "Vendor",
        "$/M input",
        "$/M output"
      ],
      "rows": [
        [
          "gpt-5",
          "OpenAI",
          1.25,
          10
        ],
        [
          "gpt-5-mini",
          "OpenAI",
          0.25,
          2
        ],
        [
          "gpt-4.1",
          "OpenAI",
          2,
          8
        ],
        [
          "gpt-4.1-mini",
          "OpenAI",
          0.4,
          1.6
        ],
        [
          "gpt-4o",
          "OpenAI",
          2.5,
          10
        ],
        [
          "o4-mini",
          "OpenAI",
          1.1,
          4.4
        ],
        [
          "claude-opus-4",
          "Anthropic",
          15,
          75
        ],
        [
          "claude-sonnet-4",
          "Anthropic",
          3,
          15
        ],
        [
          "claude-haiku-4",
          "Anthropic",
          0.8,
          4
        ],
        [
          "gemini-2.5-pro",
          "Google",
          1.25,
          10
        ],
        [
          "gemini-2.5-flash",
          "Google",
          0.3,
          2.5
        ],
        [
          "gemini-2.0-flash",
          "Google",
          0.1,
          0.4
        ],
        [
          "deepseek-v3",
          "DeepSeek",
          0.27,
          1.1
        ],
        [
          "grok-3",
          "xAI",
          3,
          15
        ],
        [
          "llama-4-maverick",
          "Meta",
          0.22,
          0.88
        ]
      ]
    },
    "value": 0.045
  },
  "tool": "llm-cost-calculator"
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
3 h agoExpected HTTP 402, got 30830820 ms-
7 h agoExpected HTTP 402, got 308308105 ms-
12 h agoExpected HTTP 402, got 30830812 ms-
15 h agoExpected HTTP 402, got 30830812 ms-
20 h agoExpected HTTP 402, got 30830817 ms-
22 h agoExpected HTTP 402, got 30830812 ms-
25 h agoPassed402672 ms$0.002
31 h agoPassed402153 ms$0.002