denk.halowerk.com/v1/trace-cost-breakdown
Break an agent run down into cost and latency per step, model and tool from token counts and the prices you supply. Takes the steps of one agent run (model, input, cached and output tokens, latency, tool) and the price list in USD per million tokens supplied by the caller (no stale built-in prices) and returns cost per step, totals, cost and time share per model and tool, the five most expensive a
POST
https://denk.halowerk.com/v1/trace-cost-breakdownUptime100% of 3 checks in 30 days
30 days agoToday
Try it
Pays from your browser wallet in USDC on Base or USDG on Robinhood Chain, whichever the endpoint takes. The provider is paid directly; failed calls aren't refunded by Fourohtwo.
The response shows up here.
Call it from an agent
// npm install fourohtwo
import { createPayer } from "fourohtwo";
// One agent key pays USDC on Base or USDG on Robinhood Chain, inside your spending rules.
const pay = createPayer({ privateKey: process.env.AGENT_KEY, maxPerCallUsd: "0.05" });
const res = await pay("https://denk.halowerk.com/v1/trace-cost-breakdown", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"prices":{"model-a":{"cached_input":0.3,"input":3,"output":15}},"steps":[{"input_tokens":12000,"latency_ms":2100,"model":"model-a","name":"plan","output_tokens":800},{"cached_input_tokens":10000,"extra_cost_usd":0.003,"input_tokens":30000,"latency_ms":4300,"model":"model-a","name":"search","output_tokens":500,"tool":"web_search"}]}),
});
console.log(await res.json());Example input
{
"prices": {
"model-a": {
"cached_input": 0.3,
"input": 3,
"output": 15
}
},
"steps": [
{
"input_tokens": 12000,
"latency_ms": 2100,
"model": "model-a",
"name": "plan",
"output_tokens": 800
},
{
"cached_input_tokens": 10000,
"extra_cost_usd": 0.003,
"input_tokens": 30000,
"latency_ms": 4300,
"model": "model-a",
"name": "search",
"output_tokens": 500,
"tool": "web_search"
}
]
}