# WritersLogic Pack Size & Quantity Optimizer

> WritersLogic Pack Size & Quantity Optimizer is a paid API for AI agents from agents.writerslogic.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-11-19).

Finds the cheapest valid order quantity across up to 50 supplier options, accounting for pack sizes, minimum order quantities, order increments, and price breakpoints.

## Facts

- Endpoint: POST https://agents.writerslogic.com/api/v1/pack-size?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/writerslogic-pack-size-quantity-optimizer-7d52540b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_dai811EgH3paXXlOlFnL5

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability writerslogic-pack-size-quantity-optimizer-7d52540b -d '<json body>'
```

Example prompt: I need 500 units of that fastener — compare these three suppliers: Supplier A sells in packs of 12 at $0.80/unit with a 60-unit MOQ, Supplier B sells in cases of 25 at $0.75/unit with no MOQ, and Supplier C does 6x100 packs at $0.70/unit but has a 100-unit MOQ and volume price of $0.65/unit from 600 units. Don't let me overbuy by more than 15%. Which is cheapest?

## When to prefer this

Use this endpoint when an AI agent is purchasing parts or consumables from suppliers that sell in fixed pack sizes, have minimum order quantities, order increments, or volume price breakpoints, and you need to determine the cheapest compliant order quantity. It is specifically designed for the rounding-up logic inherent in pack-based procurement and multi-supplier comparison. It is not appropriate for real-time stock checks, lead time queries, or free-unit pricing without pack constraints.

## Known failure modes

- Ambiguous pack notation (e.g. '6x100g') with no unitsPerPack provided returns unknown status for that option
- unitsPerPack value that matches no valid reading of the packNotation causes a failure for that option
- All options exceed the overbuyCapPercent threshold, resulting in no valid option returned
- Invalid or negative prices in breakpoints or unitPrice
- Requested quantity of zero or negative (schema minimum is 1)
- More than 50 options submitted (schema maximum is 50)
- JSON numbers used for price fields instead of decimal strings are rejected

## How this service works

Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.

## Output

Returns the cheapest valid order option including the rounded-up order quantity, total cost, the supplier option ID selected, the unit price tier applied, and the percentage of overbuy. Options with ambiguous pack notations that cannot be resolved to a fixed unit count are returned with unknown status. Options exceeding the overbuy cap are rejected.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "options": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "id"
    ],
    "properties": {
     "id": {
      "type": "string",
      "maxLength": 80,
      "minLength": 1
     },
     "moq": {
      "type": "integer",
      "maximum": 1000000000,
      "minimum": 1,
      "description": "Minimum order quantity in units."
     },
     "increment": {
      "type": "integer",
      "maximum": 1000000000,
      "minimum": 1,
      "description": "Orders must be a multiple of this many units (default: the pack size)."
     },
     "unitPrice": {
      "type": "string",
      "pattern": "^-?\\d{1,15}(\\.\\d{1,12})?$",
      "maxLength": 30,
      "description": "Base price per unit."
     },
     "innerUnits": {
      "type": "integer",
      "maximum": 1000000,
      "minimum": 1,
      "description": "Units per inner pack, for notations that count inner packs."
     },
     "breakpoints": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "minQty",
        "unitPrice"
       ],
       "properties": {
        "minQty": {
         "type": "integer",
         "maximum": 1000000000,
         "minimum": 1
        },
        "unitPrice": {
         "type": "string",
         "pattern": "^-?\\d{1,15}(\\.\\d{1,12})?$",
         "maxLength": 30,
         "description": "Decimal string such as \"-12.50\" (up to 15 integer and 12 fraction digits). JSON numbers are not accepted: they are binary floats."
        }
       },
       "additionalProperties": false
      },
      "maxItems": 20,
      "description": "Price per unit from minQty units upward (the highest breakpoint reached applies)."
     },
     "packNotation": {
      "type": "string",
      "maxLength": 40,
      "minLength": 1,
      "description": "e.g. \"6x100\", \"case of 12\", \"12/case\", \"case of 6 inners\"."
     },
     "unitsPerPack": {
      "type": "integer",
      "maximum": 1000000000,
      "minimum": 1,
      "description": "Settles an ambiguous packNotation; a value that matches no reading of the notation fails."
     }
    },
    "additionalProperties": false
   },
   "maxItems": 50,
   "minItems": 1
  },
  "requested": {
   "type": "integer",
   "maximum": 1000000000,
   "minimum": 1,
   "description": "Units needed."
  },
  "overbuyCapPercent": {
   "type": "string",
   "pattern": "^-?\\d{1,15}(\\.\\d{1,12})?$",
   "maxLength": 30,
   "description": "Reject orders exceedin
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/writerslogic-pack-size-quantity-optimizer-7d52540b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agents.writerslogic.com](https://www.zero.xyz/host/agents.writerslogic.com/llms.txt)
