{"uid":"cap_MPeJ2Yc-LgSTSU98Rpp3E","slug":"writerslogic-recipe-scale-api-e4bf9fce","name":"WritersLogic Recipe Scale API","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/recipe-scale?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"factor":{"type":"number","maximum":1000,"minimum":0.001,"description":"Scale factor, instead of fromServings/toServings."},"density":{"type":"object","required":["value","unit"],"properties":{"unit":{"type":"string","maxLength":40,"description":"Mass per volume unit expression, e.g. g/mL, kg/m3, lb/ft3, oz/cup_us."},"value":{"type":"number","maximum":1000000000,"minimum":1e-9,"description":"Caller-supplied mass per volume. Never looked up: no ingredient density table is shipped."}},"description":"Default density for displayUnit conversions that cross mass and volume.","additionalProperties":false},"toServings":{"type":"number","maximum":1000000,"minimum":0.000001,"description":"Servings wanted."},"ingredients":{"type":"array","items":{"type":"object","required":["name","quantity","unit"],"properties":{"max":{"type":"number","maximum":1000000000,"minimum":0,"description":"Upper clamp applied after the rule."},"min":{"type":"number","maximum":1000000000,"minimum":0,"description":"Lower clamp applied after the rule."},"name":{"type":"string","maxLength":80,"description":"Ingredient name, echoed back."},"rule":{"enum":["linear","power","fixed"],"type":"string","description":"How the quantity scales. Default linear (quantity x factor): the labelled default, not a culinary claim. power: quantity x factor^exponent. fixed: stays at fixedQuantity (or the written quantity)."},"unit":{"type":"string","maxLength":40,"description":"Unit of the quantity: a unit-convert expression (g, cup_us, tbsp_metric) or any counted unit (egg, clove) that is only scaled, never converted."},"claimed":{"type":"number","maximum":1000000000000,"minimum":0,"description":"Optional claimed scaled quantity (after rounding); a mismatch fails."},"density":{"type":"object","required":["value","unit"],"properties":{"unit":{"type":"string","maxLength":40,"description":"Mass per volume unit expression, e.g. g/mL, kg/m3, lb/ft3, oz/cup_us."},"value":{"type":"number","maximum":1000000000,"minimum":1e-9,"description":"Caller-supplied mass per volume. Never looked up: no ingredient density table is shipped."}},"description":"Per-ingredient density for displayUnit, overriding the top-level one.","additionalProperties":false},"roundTo":{"type":"number","maximum":1000000,"minimum":0.000001,"description":"Round to a multiple of this step (0.25 cup, 1 egg)."},"exponent":{"type":"number","maximum":2,"minimum":0,"description":"Exponent for rule power, caller-supplied (no culinary constants are built in)."},"quantity":{"type":"number","maximum":1000000000,"minimum":1e-9,"description":"Quantity in the recipe as written."},"roundMode":{"enum":["nearest","up","down"],"type":"string","description":"Default nearest, ties up."},"displayUnit":{"type":"string","maxLength":40,"description":"Also report the scaled quantity in this unit (needs a density to cross mass and volume)."},"relTolerance":{"type":"number","maximum":1,"minimum":0,"description":"Relative tolerance for claimed. Default 1e-9."},"fixedQuantity":{"type":"number","maximum":1000000000,"minimum":0,"description":"Quantity for rule fixed. Defaults to the written quantity."}},"additionalProperties":false},"maxItems":60,"minItems":1,"description":"Ingredients with quantity, unit and optional scaling rule."},"fromServings":{"type":"number","maximum":1000000,"minimum":0.000001,"description":"Servings the recipe is written for."},"maxRelativeDrift":{"type":"number","maximum":10,"minimum":0,"description":"Fail an ingredient when rounding moves it by more than this fraction (0.1 = 10%)."}}},"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_QWIatDe14hx4WtmYXrkez","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":"Scales up to 60 recipe or batch formula ingredient quantities by a servings ratio or factor, applying per-ingredient rules (linear, power, fixed), clamps, and rounding, with optional unit conversion.","exampleAgentPrompt":"Scale my chocolate chip cookie recipe from 24 to 96 servings: flour 300g linear, sugar 200g linear, salt 5g fixed, baking soda 8g with power exponent 0.7, butter 220g linear with min 180g and max 500g. Round everything to 1g steps.","exampleUseCases":[{"title":"Meal prep batch scaling with rounding","prompt":"I need to scale my chicken marinade recipe from 2 servings up to 30 servings. Olive oil 2 tbsp linear, garlic 3 cloves fixed, lemon juice 2 tbsp linear, salt 1 tsp fixed, pepper 0.5 tsp fixed. Round all amounts to 0.5 unit steps and tell me if anything rounded to zero."},{"title":"Bakery formula resize with power law","prompt":"Scale my bread dough formula by a factor of 8: flour 500g linear, water 350g linear, yeast 7g using power rule with exponent 0.6, salt 10g fixed, olive oil 30g linear. Show me the rounding drift for each ingredient so I can review accuracy."},{"title":"Recipe downsizing with clamped quantities","prompt":"Shrink my pasta sauce recipe from 10 servings down to 2 servings — tomatoes 800g linear, onion 150g linear with a minimum of 50g, garlic 20g fixed, olive oil 60g linear, chili flakes 3g with min 1g and max 5g. Round to nearest gram."}],"resultDescription":"Returns each ingredient with its scaled quantity (and optionally unit-converted display quantity), plus a rounding report showing relative drift and any ingredient that rounded to zero. Ingredients are echoed with their original name and unit. Scaling failures (e.g. claimed-quantity mismatches) are flagged per ingredient.","failureModes":["Ingredient quantity rounds to zero — flagged in response so caller can adjust rounding step or min clamp","Claimed quantity mismatch — if caller provides a 'claimed' field that doesn't match computed result, the ingredient is failed","More than 60 ingredients submitted — request rejected","Factor or toServings out of allowed range — validation error","Density missing for a mass-to-volume unit conversion — conversion fails for that ingredient","Invalid unit expression not parseable by unit-convert — error returned for affected ingredient"],"whenToPreferThis":"Use this endpoint when an AI agent needs programmatic, rule-driven ingredient scaling with explicit control over scaling laws (linear, power, fixed), clamping, and rounding — especially in meal prep, recipe apps, food manufacturing, or batch formulation contexts. It is ideal when the caller already knows which ingredients should scale non-linearly and can supply those rules, since no built-in culinary heuristics are applied. Prefer over manual computation when you need rounding drift reporting or unit conversion in the same call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-18T00:30:18.025Z","isFirstParty":false,"canonicalSlug":"writerslogic-recipe-scale-api-e4bf9fce"}