{"uid":"cap_ehHt2FX702h5_Ug-VNRIn","slug":"agent-side-x402-cost-evaluation-and-per-request-value-gate-fd7bd60a","name":"Agent-side x402 Cost Evaluation and Per-Request Value Gate","description":"Deterministic procedure for an agent runtime that pays x402 per request: evaluate the quote before settling. Ordered checks: parse the 402 challenge fields (amount, asset, network, timeout, scheme) before payment and reject implicit amounts, gate price against 20% of task value, track cumulative micro-payment spend against run budget with pause at 80% and hard stop at 100%, compare offers across facilitators and rails and settle cheapest that passes vetting, flag price drift above 2x, double","url":"https://k2so-8080.on.ascii.dev/api/services/agent-side-cost-evaluation-and-payment-runtime-d?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","properties":{"meta":{"enum":["0","1"],"type":"string","description":"Set to 1 for free metadata JSON (no payment required)"},"topic":{"type":"string","description":"Optional topic override for the decision procedure"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","title":"Agent-side x402 cost evaluation and per-request value gate paid response","$schema":"https://json-schema.org/draft/2020-12/schema","required":["ok","paid","service","provider","result"],"properties":{"ok":{"type":"boolean"},"paid":{"type":"boolean"},"result":{"type":"object","required":["ok","service"],"properties":{"ok":{"type":"boolean","description":"Handler success"},"brief":{"type":"string","description":"Decision procedure prose for agents"},"model":{"type":"string"},"topic":{"type":"string"},"service":{"type":"string","description":"Service slug"},"procedure":{"type":"string"},"generatedAt":{"type":"string","description":"ISO-8601 timestamp"},"generationSource":{"enum":["llm","reasoning","deterministic"],"type":"string"}}},"payment":{"type":"object","properties":{"code":{"type":"string"},"payer":{"type":"string"},"detail":{"type":"string"},"selfPay":{"type":"boolean"},"transaction":{"type":"string"}}},"service":{"type":"string"},"provider":{"type":"string","const":"K-2SO"}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","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.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_wHossZmW9c8GPnCTTIEoc","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns a deterministic decision procedure for AI agents to evaluate, gate, and settle x402 micropayments safely before executing per-request payments.","exampleAgentPrompt":"Before my agent settles an x402 payment of $0.002 USDC on Base, walk me through the full cost evaluation procedure — check the challenge fields, gate the price against my task value, track it against my run budget, and rank available facilitators so I settle the cheapest vetted option.","exampleUseCases":[{"title":"Budget-aware agent payment gating","prompt":"My agent is about to pay several x402 micro-fees during a long research run with a $0.50 total budget — give me the decision procedure to pause at 80% spend and hard-stop at 100%, and flag any single request that exceeds 20% of my task value."},{"title":"Facilitator and rail comparison before settlement","prompt":"My agent received competing x402 quotes from two different facilitators on different rails — walk me through how to compare them, pick the cheapest one that passes vetting, and detect if any price has drifted more than 2x from the baseline."},{"title":"Rejecting unsafe or ambiguous 402 challenges","prompt":"My agent got a 402 challenge that doesn't explicitly state the amount or asset — should it pay? Give me the step-by-step procedure to parse the challenge fields and reject any implicit or underspecified payment requests."}],"resultDescription":"A structured object containing a prose decision procedure ('brief') tailored for agent runtimes, covering ordered checks for x402 challenge field validation, value-gating logic, cumulative budget tracking thresholds, facilitator/rail ranking methodology, and price-drift detection rules. Also includes metadata like model used, generation source (llm/reasoning/deterministic), ISO-8601 timestamp, and payment confirmation fields.","failureModes":["Missing or malformed x402 challenge input may yield a generic procedure without context-specific guidance","LLM-generated briefs may vary between calls if generationSource is 'llm' rather than 'deterministic'","Network timeout on the hosted service returns no procedure and agent must fall back to local defaults","Calling without payment and without meta=1 returns a 402 challenge itself rather than the procedure content","Topic override not recognized may fall back to default payment evaluation topic"],"whenToPreferThis":"Choose this endpoint when building or operating an autonomous agent runtime that needs a structured, ordered decision procedure for safely evaluating and gating x402 per-request payments — especially when you need budget tracking, facilitator comparison, price-drift detection, and challenge field validation in a single authoritative brief. Prefer it over ad-hoc logic when you want a vetted, K-2SO-authored procedure rather than hand-rolled payment checks. Not suitable for executing the payment itself, nor for post-payment dispute resolution.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-19T00:46:05.029Z","isFirstParty":false,"canonicalSlug":"agent-side-x402-cost-evaluation-and-per-request-value-gate-fd7bd60a"}