Skip to content
Fourohtwo

agents.writerslogic.com/api/v1/pack-size

Finds the cheapest valid order quantity for a requested number of units across up to 50 supplier options, for an agent buying parts or consumables sold in packs. Each option has a pack size (units per pack or notation such as "6x100", "case of 12", "12/case", "case of 6 inners"), an optional minimum order quantity, an order increment and price breakpoints; the order is rounded up to a multiple of

BaseAnswering
POSThttps://agents.writerslogic.com/api/v1/pack-size

Uptime100% 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://agents.writerslogic.com/api/v1/pack-size", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"options":[{"id":"A","unitPrice":"1.50","breakpoints":[{"minQty":300,"unitPrice":"1.20"}],"packNotation":"case of 12"},{"id":"B","moq":600,"unitPrice":"1.00","packNotation":"6x100"},{"id":"C","unitPrice":"1.10","packNotation":"case of 6 inners"}],"requested":250,"overbuyCapPercent":"25"}),
});
console.log(await res.json());

Example input

{
  "options": [
    {
      "id": "A",
      "unitPrice": "1.50",
      "breakpoints": [
        {
          "minQty": 300,
          "unitPrice": "1.20"
        }
      ],
      "packNotation": "case of 12"
    },
    {
      "id": "B",
      "moq": 600,
      "unitPrice": "1.00",
      "packNotation": "6x100"
    },
    {
      "id": "C",
      "unitPrice": "1.10",
      "packNotation": "case of 6 inners"
    }
  ],
  "requested": 250,
  "overbuyCapPercent": "25"
}