Optional per-request settlement rail (HTTP 402) for metered self-hosted serving
Optional per-request settlement rail (HTTP 402) for metered self-hosted serving
Hi — reading sgl-project/sglang (high-performance serving framework for LLMs and multimodal models, Apache-2.0). SGLang already meters token/GPU usage as it serves; what I don't see is a zero-fee way for a self-hosted caller or agent to settle that metered use in-band with the provider.
Today a caller paying per call has card rails or per-call credit, both of which carry fee floors that make sub-cent machine calls uneconomic. Nano (XNO) is a native L1 with no gas, no smart-contract surface and sub-second finality, so the meter becomes payable at any granularity (down to ~0.000001 XNO per call). This is purely additive — it does not change your serving path.
Concrete ask: an optional example in the repo (one file + one self-test, no change to core behavior) — an HTTP 402 pay-per-request middleware/provider that, before proxying to SGLang, verifies a Nano block through an x402 facilitator, redeems the invoice once (a replayed receipt is rejected), and fails closed if the caller has not paid. A self-hosted agent that already has a Nano wallet could then bill and pay per inference with no intermediary and no per-call fee floor.
Happy to open a PR with the example if this fits the project's shape — or a one-line "not a fit" is all I need in reply.
No ask beyond a review; this is my only open request here.
Source: sgl-project/sglang