agents.writerslogic.com/api/v1/price-change-attribution
Explains why a total moved between two versions of a quote, order or invoice (up to 300 lines each), for an agent that must say how much of the change came from quantity, unit price, exchange rate, new lines and dropped lines. Lines are matched by key. Matched lines are decomposed by sequential substitution in the declared factor order (default quantity, then price, then fx), so the effects sum to
POST
https://agents.writerslogic.com/api/v1/price-change-attributionUptime100% 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/price-change-attribution", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"after":[{"key":"widget","quantity":"120","unitPrice":"2.10"},{"key":"gizmo","quantity":"5","unitPrice":"4.00"}],"before":[{"key":"widget","quantity":"100","unitPrice":"2.00"},{"key":"gadget","quantity":"10","unitPrice":"9.99"}],"currency":"USD","statedAfterTotal":"272.00","statedBeforeTotal":"299.90"}),
});
console.log(await res.json());Example input
{
"after": [
{
"key": "widget",
"quantity": "120",
"unitPrice": "2.10"
},
{
"key": "gizmo",
"quantity": "5",
"unitPrice": "4.00"
}
],
"before": [
{
"key": "widget",
"quantity": "100",
"unitPrice": "2.00"
},
{
"key": "gadget",
"quantity": "10",
"unitPrice": "9.99"
}
],
"currency": "USD",
"statedAfterTotal": "272.00",
"statedBeforeTotal": "299.90"
}