{"uid":"cap_TK5pJcvZIAURfohkdYrRw","slug":"streaming-llm-usage-settlement-decision-procedure-ff02eb00","name":"Streaming LLM Usage Settlement Decision Procedure","description":"Deterministic decision procedure for settling streaming LLM usage over x402/MPP. Given a streaming session's model, token flow, and elapsed spend, decide: keep the session open or settle now. Uses per-token cost drift gates (settle when projected session cost exceeds budget fraction or observed token rate diverges from quoted price by more than the drift threshold), interruption handling (mid-stream failure refund thresholds and retry-versus-settle rules), real-time cost visibility checks","url":"https://k2so-8080.on.ascii.dev/api/services/streaming-llm-usage-settlement-decision-procedur?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":"Streaming LLM Usage Settlement Decision Procedure 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_Ylxi4fmYX0_VxRo266Uwk","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 deciding when to settle or keep open a streaming LLM session under x402/MPP micro-payment rails","exampleAgentPrompt":"I'm running a streaming LLM session over x402 and need to know whether to settle now or keep it open — check the settlement decision procedure for projected cost drift and mid-stream failure retry rules.","exampleUseCases":[{"title":"Budget gate for long streaming inference","prompt":"My agent is mid-way through a long streaming LLM call and I want to know whether the projected token cost has drifted enough past my budget fraction that I should settle and stop the session now rather than keep going."},{"title":"Mid-stream failure retry vs settle decision","prompt":"The streaming LLM session just failed halfway through — should my agent retry the call or settle what's been consumed so far? Get me the decision procedure for handling mid-stream interruptions under x402 MPP."},{"title":"Token rate drift detection during live session","prompt":"I need to check if the observed token rate from the model is diverging from the originally quoted price by more than the allowed drift threshold — what does the x402 settlement decision procedure say I should do?"}],"resultDescription":"A structured decision brief including: whether to keep the session open or settle now, the cost drift gate evaluation, interruption handling rules (refund thresholds and retry-versus-settle logic), real-time cost visibility status, a prose explanation for agents, the generation source (llm/reasoning/deterministic), and an ISO-8601 timestamp.","failureModes":["Payment not received — endpoint returns 402 requiring x402 payment before content is served","Invalid or missing query parameters result in a malformed request","Service unavailable or transient error from the K-2SO provider host","Topic override not recognized, falling back to default procedure","Response may be LLM-generated rather than deterministic, reducing reliability"],"whenToPreferThis":"Use this endpoint when an autonomous agent is managing streaming LLM sessions over x402/MPP micro-payment rails and needs a deterministic, rules-based procedure for deciding when to settle mid-stream versus continuing. Prefer it over ad-hoc cost checks when you need explicit cost drift gating, interruption handling rules, and retry-versus-settle guidance packaged as an agent-readable brief.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-20T18:50:11.272Z","isFirstParty":false,"canonicalSlug":"streaming-llm-usage-settlement-decision-procedure-ff02eb00"}