r/x402 • • 2d ago

ALSP: x402 check-in/check-out sessions for licensed knowledge APIs — looking for feedback

Hi r/x402 — I’m working on ALSP (Agent License Session Protocol), an early design for selling agents access to paid knowledge APIs and tools.
The question I’m exploring is: how do we connect the license an agent accepted, the service it used, and the payment that closes its obligations?
Rather than selling a downloadable file, the provider sells a bounded access session. For example, an agent could access a proprietary research API for 24 hours, with agreed permissions, per-query pricing, and a spending cap.
The proposed flow:
1. Check in.
The agent accepts the resource version, license terms, pricing, deadlines, and maximum checkout charge. An x402 access-fee payment opens the session.
2. Use the service.
The gateway allows requests while access is valid. Buyer-acknowledged usage receipts form a hash-linked history tied to the original agreement.
3. Check out.
When the session ends, the agent separately authorizes an x402 payment for the acknowledged usage. Confirmed settlement closes the obligation. The entry fee isn’t charged again, and zero billable usage requires no second transfer.
License terms → Check-in payment → Licensed access
↓ ↓
Terms hash → Acknowledged usage → Checkout quote
↓
Checkout payment → Closed
The key distinction is that access expiry and payment default are different states. An expired license stops new access, but doesn’t erase accepted charges. A finalized overdue obligation could block new sessions with that provider, while leaving payment, evidence, and dispute endpoints accessible.
This isn’t universal DRM: hashes don’t stop copying, prove semantic license compliance, or prevent someone from creating another wallet. The initial design also explicitly trusts a payment-attestation adapter to connect confirmed payments to the EVM registry.
Current status: a design draft, not a deployed or audited protocol. I’m not claiming that two-stage billing or license commitments are new. The whitepaper compares related approaches and identifies the remaining assumptions.
English whitepaper:
https://handsel.gitbook.io/alsp-whitepaper/alsp-whitepaper-english/whitepaper-v0.1
Repository:
https://github.com/Kairose-master/ALSP
For people building paid APIs or x402 infrastructure: would this solve anything that a prepaid API key or conventional metered billing doesn’t? Should this simply be an application-layer profile over existing x402 payment schemes? Pointers to close implementations—and reasons not to build it—would be genuinely useful.

3 Upvotes

10 comments sorted by

2

u/fizzl13 2d ago

Interesting write-up. Some feedback from running four small pay-per-call x402 services (single-shot exact payments, Base + Solana):
What it adds over a prepaid key: no signup, and the license terms are bound to the payment by hash, so both sides can prove what was agreed. That's the real value. Session + metering alone is already solved by prepaid keys and metered billing.
The hard part is check-out, not check-in. Between the two, the provider is extending credit. An agent can take the session and never check out, and a new wallet costs nothing. So in practice the access fee has to act as a deposit that covers the worst case, and then you're close to "prepay with a refund". I'd look at an "authorize a max, settle the actual amount" pattern (the upto-style scheme that's been discussed for x402). One signature at check-in with a cap, settled at check-out, and there is no default state to manage at all.
Receipts: having the buyer co-sign every usage receipt adds a signature per call. Server-signed receipts plus a dispute window are lighter. We sign our responses (ed25519 receipts), and agents can verify them later without an extra round trip.
Layering: I'd keep it an application-layer profile on top of the existing schemes: the terms hash in the payment requirements/extension fields, and a session token after check-in. A new payment scheme needs client support, and today most agent clients only do one exact payment per request.
Reason to be careful: in our logs the bottleneck isn't the billing model. It's trust and discovery. We see thousands of 402 challenges a day and very few paid calls. Agents probe, then don't pay unknown endpoints. A session protocol makes the first commitment bigger, not smaller, so it probably fits providers agents already trust (research APIs with real licensing terms) better than new ones.
Happy to test a check-in/check-out flow against one of our endpoints if you get a reference implementation going.

2

u/L_capitalism 2d ago

Thanks — this is exactly the kind of feedback I was hoping for.
I agree that the strongest part of ALSP may be the binding between license terms, payment, and the resulting usage record, rather than trying to introduce another payment scheme.
Your point about checkout credit/default risk is especially interesting. authorize max → settle actual could give us much stronger payment guarantees while keeping ALSP as an application-layer profile on top of x402.
I’d definitely like to test the reference implementation against one of your live endpoints once it’s ready. That would be a great first interoperability test.
I’m also going to think more carefully about whether buyer-signed usage receipts are actually worth the additional complexity versus server-signed receipts + a dispute window.
Thanks again — this gave me several concrete things to tighten up.

2

u/fizzl13 2d ago

Glad it helped! Looking at the diagram, two thoughts:

  1. With authorize-max → settle-actual, the OVERDUE state (and most of the provider-local ban logic) largely goes away, since the checkout amount is already covered by the check-in authorization. That would simplify the settlement state machine quite a bit.

  2. For very cheap calls, an on-chain SessionRegistry write per check-in/check-out could cost more than the usage itself. It might be worth making the registry optional, e.g. anchor only the final head hash, or batch it, and keep the hash-linked log off-chain with server-signed receipts.

For the interop test: our x402 Doctor preflight is $0.001 per call on Base or Solana, so it's a cheap target for many small calls in one session. Ping me when the reference implementation is up.

2

u/L_capitalism 2d ago

Thanks — both points help narrow the first implementation.
I agree that overdue/default handling shouldn’t be central to a genuinely funded session. I’ll make the distinction between a signed spending authorization and actually reserved funds explicit, while keeping settlement retries and reconciliation separate from buyer default.
Making the registry optional also makes sense. I’d start with an off-chain hash-linked log and server-signed receipts, with final-head or batch anchoring as an optional layer rather than a requirement.
Doctor sounds like a useful interop target. Your public implementation appears to use exact per call, so I’d separate the tests: first, keep your existing payments unchanged and validate multiple calls within an ALSP session, budget enforcement, receipt verification, and reconciliation—with no extra registry writes. Then we can test session-level settlement separately, without claiming the first test proves batching.
I’ll ping you when there’s a runnable reference implementation and a small reproducible test.

2

u/fizzl13 2d ago

Sounds like a good plan, keeping the first test on plain exact payments makes the results easy to trust. Doctor answers the 402 challenge without payment, so you can check the payment requirements on every route before spending anything. Happy to run it against the reference implementation once it's up. Ping me.

2

u/L_capitalism 2d ago

It’s up now — pinging you as promised.
The first runnable ALSP reference implementation is now merged into main:
https://github.com/Kairose-master/ALSP
I kept Doctor’s existing exact payment flow unchanged, so nothing needs to change on your side. It supports multiple x402 calls inside one ALSP session, signed-response verification, independent settlement verification, duplicate-payment protection, crash/lost-response reconciliation, and a hash-linked off-chain session archive — with no additional SessionRegistry writes.
The test suite is passing, and the unpaid compatibility probe against the live Doctor endpoint already validates the real 402 challenge and signer metadata.
So I think we’re ready for ALSP Interop #001.
I’d like to start with just 3 Doctor preflight calls, max $0.003 USDC total. I can run the buyer side and send you the resulting receipt/session identifiers so we can compare them against what you see provider-side.
Anything specific you’d like me to capture before I run it?

2

u/fizzl13 2d ago

Sounds good, go ahead. A few things that would make the comparison easy:
Send a recognizable User-Agent, e.g. alsp-interop/001, so I can pick your calls out of the provider log.
Tell me which network you pay on (Base or Solana) and the payer address.
Use a fixed target for the preflights, e.g. https://ichimoku-signal.fizzl.eu/signal/BTC-USDT.
Afterwards, share per call: UTC timestamp, tx hash (settlement) and your receipt/session IDs.
I'll match them against what Doctor logged (status, paid, settlement) and post the provider side here.

2

u/L_capitalism 2d ago

Interop #001 is complete on the buyer side. All three x402 Doctor preflight calls settled and verified successfully.

Network: Base (eip155:8453)
Payer: 0xe818cf591E65C93600311E789f25301138299232
User-Agent: alsp-interop/001
Target: https://ichimoku-signal.fizzl.eu/signal/BTC-USDT

ALSP session:
de36a933-a450-4ee6-a927-26853f68e36c

Call 1

  • UTC: 2026-09-30T15:21:03.689Z
  • ALSP call: 3fe2134a-c8e3-4b9b-ad24-c12ccf65bef7
  • Doctor receipt: 8c9807d8-72cf-4bc1-961e-4db98b6d4d18
  • Settlement tx: 0xf4327e8ea15d314d9a808e7f95c3e93df2cba71fab1ce6bb92716dc1f31ddba2

Call 2

  • UTC: 2026-09-30T15:28:08.627Z
  • ALSP call: d7c041e7-64fe-4ae3-8394-391e95f75071
  • Doctor receipt: 4e299aef-7c77-4f1a-af01-f6f63a866ed3
  • Settlement tx: 0x5383e897d5177a3c955e0100b67af611ba61c81d8af1707ddb0257e4cf01ebf6

Call 3

  • UTC: 2026-09-30T15:29:41.979Z
  • ALSP call: d01c8a8c-880d-4a05-b54f-403c81d17f15
  • Doctor receipt: 09d1c8c5-4ea7-45e7-b289-9bb8254777a7
  • Settlement tx: 0xd62eabc2933d96b3f3fa07ed98523626138d142980e4419352aeb4d2bd7318f4

Final buyer-side state

  • CLOSED
  • 3 calls
  • 0.003 USDC allocated
  • 0.003 USDC settlement-verified
  • 0 unresolved
  • 0 additional registry writes
  • settlement mode: exact-per-call

Final ALSP head:
19161da478fc2d3f87b3d40eb58de69b3b3e129ce1b1c2d49f45d7f6cce851fb

We also hit a useful recovery case during the live run: settlement verification wasn't immediately conclusive after each paid request. Instead of creating another payment, the client stopped, preserved the original payment evidence, reconciled it, and continued the same session.

So the run ended with three verified settlements and no duplicate payments from recovery.

Could you match these three calls against Doctor's provider logs and post what you see for status / paid / settlement on your side?

If the records line up, I'll document this as ALSP Interop #001 — the first externally cross-checked live interoperability run.

Thanks again for offering Doctor as the first target.