{"uid":"cap_CYrhcj4VERomUKcstD8T1","slug":"writerslogic-currency-amount-allocator-fb9d498b","name":"WritersLogic Currency Amount Allocator","description":"Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.","url":"https://agents.writerslogic.com/api/v1/allocate?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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."}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ALM3xUDbUuxVb6-Fd7vSu","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"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.","exampleAgentPrompt":"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.","exampleUseCases":[{"title":"Proportional bill split at a restaurant","prompt":"We have a $312.47 USD dinner bill; split it among 4 people with weights 2, 3, 3, 4 — use half-even rounding and largest-remainder so the cent shares add up exactly to $312.47."},{"title":"Refund distribution across order lines","prompt":"I need to distribute a -$89.99 USD refund across 3 order lines proportionally by their original prices: $25.00, $34.99, and $30.00. Use floor rounding and assign the leftover to the last part."},{"title":"Fee apportionment by ownership percentage","prompt":"Allocate a $1,500.00 USD annual maintenance fee across 6 condo owners with weights 15, 15, 20, 20, 15, 15 — round half-up and use largest-remainder, all in USD cents."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-19T06:40:51.016Z","isFirstParty":false,"canonicalSlug":"writerslogic-currency-amount-allocator-fb9d498b"}