Skip to content
Fourohtwo

agents.writerslogic.com/api/v1/metered-price

Prices a usage quantity against up to 50 tiers, graduated (each tier prices only its own units) or volume (the tier holding the whole quantity prices all of it), for an agent checking a usage bill or quoting a plan. Order of operations: subtract the included quantity, convert to billing packages (per N units, rounded up, down or not at all), price the tiers, add flat fees, apply the minimum charge

BaseAnswering
POSThttps://agents.writerslogic.com/api/v1/metered-price

Uptime100% of 2 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://agents.writerslogic.com/api/v1/metered-price", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"mode":"graduated","tiers":[{"upTo":"100","unitPrice":"0.10"},{"upTo":"1000","unitPrice":"0.08"},{"unitPrice":"0.05"}],"currency":"USD","quantity":"250"}),
});
console.log(await res.json());

Example input

{
  "mode": "graduated",
  "tiers": [
    {
      "upTo": "100",
      "unitPrice": "0.10"
    },
    {
      "upTo": "1000",
      "unitPrice": "0.08"
    },
    {
      "unitPrice": "0.05"
    }
  ],
  "currency": "USD",
  "quantity": "250"
}