# WritersLogic Currency Amount Allocator

> WritersLogic Currency Amount Allocator 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).

Splits a signed decimal amount into up to 500 weighted (or equal) integer minor-unit shares that always sum exactly to the total, using configurable rounding and remainder policies.

## Facts

- Endpoint: POST https://agents.writerslogic.com/api/v1/allocate?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-currency-amount-allocator-fb9d498b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_CYrhcj4VERomUKcstD8T1

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-currency-amount-allocator-fb9d498b -d '<json body>'
```

Example prompt: Split $47.83 USD equally among 5 people and give me each person's share in cents, using half-even rounding and the largest-remainder policy so the parts always add up exactly.

## When to prefer this

Use this endpoint when you need mathematically exact currency allocation in integer minor units with controlled rounding and a configurable remainder policy. It is the right choice when the parts must sum precisely to the total (no floating-point drift), when you need to handle refunds (negative amounts), when different rounding modes are required (half-even for financial, floor for conservative splits), or when you have weighted (non-equal) distribution requirements. Prefer it over ad-hoc division code that may accumulate rounding errors or fail to exactly reconstitute the total.

## Known failure modes

- Total has more fraction digits than the currency's exponent allows — returns validation error
- Weights array sums to zero — returns error (cannot allocate)
- Both 'parts' and 'weights' provided or neither provided — ambiguous input error
- Currency code is not in ISO 4217 and no exponent override is given — unknown currency error
- Total or weight strings contain non-numeric characters or exceed length limits — parse error
- Weights array exceeds 500 items — rejected
- Exponent override out of range 0–8 — validation error

## How this service works

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

## Output

Returns an array of integer values in the currency's minor units (e.g. cents), one per part, guaranteed to sum exactly to the total. Each share reflects the input weight proportion after rounding under the chosen mode; residual units are redistributed per the remainder policy. Zero-weight parts receive zero.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "parts": {
   "type": "integer",
   "maximum": 500,
   "minimum": 1,
   "description": "Equal split into this many parts."
  },
  "total": {
   "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."
  },
  "weights": {
   "type": "array",
   "items": {
    "type": "string",
    "pattern": "^\\d{1,15}(\\.\\d{1,12})?$",
    "maxLength": 28
   },
   "maxItems": 500,
   "minItems": 1,
   "description": "Non-negative decimal-string weights, e.g. [\"1\",\"1\",\"2\"] or percentages. Give weights or parts."
  },
  "currency": {
   "type": "string",
   "pattern": "^[A-Z]{3}$",
   "description": "ISO 4217 alphabetic code, upper case."
  },
  "exponent": {
   "type": "integer",
   "maximum": 8,
   "minimum": 0,
   "description": "Override the ISO 4217 exponent; required for codes not on the list."
  },
  "rounding": {
   "enum": [
    "half-up",
    "half-down",
    "half-even",
    "up",
    "down",
    "ceiling",
    "floor"
   ],
   "type": "string",
   "description": "Rounding of each share before the residual is moved. Default half-even. half-up: ties away from zero. half-down: ties toward zero. half-even: ties to the even neighbour. up: away from zero. down: toward zero. ceiling: toward +infinity. floor: toward -infinity."
  },
  "remainder": {
   "enum": [
    "largest-remainder",
    "first",
    "last"
   ],
   "type": "string",
   "description": "largest-remainder (default): one unit at a time to the part with the largest rounding claim, ties to the lowest index. first / last: the whole residual to the first / last part with positive weight."
  }
 }
}
```

## Response schema (JSON Schema)

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

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/writerslogic-currency-amount-allocator-fb9d498b/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)
