{"uid":"cap_DNt6j5tNsvd_QnVSRVQ_r","slug":"delx-weighted-choice-ed5059b1","name":"Delx Weighted Choice","description":"Pick one item from a list using non-negative weights — first-party local utility for agent preflight and proven micro-utils expansion. Returns deterministic machine-readable JSON for $0.001 USDC via x402 on Base. Execution is first-party, local-only, stateless, and memory-only with no paid upstream, no input retention, no web search, no live RPC, and no mediagen. Results are advisory; the caller owns authorization, budgets, and production controls. Sibling of Delx routes that already converted…","url":"https://api.delx.ai/api/v1/x402/weighted-choice","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"items":{"type":"array","description":"Input field: items."},"weights":{"type":"array","description":"Input field: weights."}}},"responseSchema":{"type":"json","example":{"ok":true,"index":1,"choice":"b","schema":"delx/util-weighted-choice/v1","weight":2,"probability":0.5,"total_weight":4}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","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.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_-mvIiEoftxG6a9aQpWpx9","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Picks one item from a list using non-negative weights, returning a single sampled selection as deterministic JSON","exampleAgentPrompt":"Pick one item from this list — ['GPT-4', 'Claude', 'Gemini'] — using weights [0.5, 0.3, 0.2], so higher-weighted models get chosen more often.","exampleUseCases":[{"title":"Weighted AI model routing","prompt":"I have three AI models — 'gpt-4', 'claude-3', 'gemini-pro' — and I want to route requests to them with weights 60, 30, and 10 respectively. Pick one for this next request."},{"title":"Randomized A/B content variant selection","prompt":"I have two ad copy variants — 'Buy now and save 20%' and 'Limited time offer' — and I want to show the first one 70% of the time and the second 30%. Pick which one to show this user."},{"title":"Probabilistic task assignment to agents","prompt":"I have a pool of worker agents: 'agent-alpha', 'agent-beta', 'agent-gamma', with reliability scores of 5, 3, and 2. Use those as weights to randomly pick which agent should handle the next job."}],"resultDescription":"Returns a JSON object containing the chosen item from the input array, selected with probability proportional to its corresponding weight. Typically includes the selected item value and possibly its index.","failureModes":["Mismatched array lengths between items and weights returns an error","Negative weight values cause validation failure","Empty items or weights arrays return an error","All-zero weights array may cause undefined behavior or error","Malformed JSON input returns a parsing error"],"whenToPreferThis":"Use this endpoint when you need a lightweight, stateless, single-call weighted random selection from a finite list — especially during agent preflight, traffic splitting, probabilistic routing, or any scenario where you need one item sampled proportionally to non-negative weights. Prefer it over building your own sampling logic when you need a cheap ($0.001 USDC), fast, machine-readable result with no side effects and no data retention.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T07:14:55.797Z","isFirstParty":false}