Worked example · agentic commerce · mesh-llm

Paid inference between strangers: two books, one payment.

On mesh-llm, a node can pay another node it has never met to run a model, over Lightning, with no one in the middle. This page shows how evidence and payment fit together in that exchange. Every claim below says what it rests on, and links it where the source is public.

Released upstreamThe payments.v1 plugin and the payer's payment.lifecycle.v1 events (#2035, merged 25 Sep 2026), in mesh-llm v0.77.0 (28 Sep 2026).
Merged upstreamThe provider's matching events, in the same shape (#2108, merged 30 Sep 2026, closing issue #2017). In mesh-llm v0.78.0 (4 Oct 2026) and later.
Released, oursThe Mesh-LLM capsules plugin (v0.1.15, 3 Nov 2026). It seals each node's half, sends it to the other side at completion, and adds an Evidence page to the console. On mesh-llm v0.78.0 or later, an exchange whose two halves agree is shown as confirmed by the other side. It also records each payment event its host reports, with its source.
Not built yetTelling “never paid”, “paid late” and “noticed late” apart by joining both sides' payment records. Each node's Evidence page reads only its own book; the claims table says so.

The problem

One ledger cannot say why a payment is missing.

A provider serves a request and the payment never shows up in its wallet. From the provider's own records, three different stories look the same: an expired, unpaid invoice.

What happenedWhat the payer's half showsWhat the provider's half would show
Never paidTerms accepted and an invoice received, then no settlement from its wallet.The invoice lapsed, or a debt was recorded.
Paid lateIts wallet reported the payment, sealed after the invoice's expiry.The invoice lapsed, then a late receipt arrived.
Noticed lateIts wallet reported the payment in time.Its own wallet saw the payment only after its deadline check.

Only the two halves together, joined on the payment_hash both wallets already share, separate the three. The payer's events are in mesh-llm v0.77.0, and the provider's (#2108) in v0.78.0. The times come from each side's sealed record. Each node's capsules plugin records the payment events its host reports, each with its source (plugin v0.1.0, 3 Oct 2026, and later). Joining the two sides' payment records to tell the three apart is not built yet: each node's Evidence page reads only its own book.

The architecture

Each node keeps its own book. Nothing sits in the middle.

The requester pays and the provider serves. Each runs mesh-llm with two plugins: payments.v1, which holds the wallet and does the paying or invoicing, and the Mesh-LLM capsules plugin, which seals that node's own half of the exchange where the host serves it. Each side's half commits to digests of the exact request and response, and never to the text itself.

Paid inference on mesh-llm: two nodes, two books, an optional witness Left, the requester node; right, the provider node. Each has the mesh-llm host, the payments.v1 plugin with a wallet, the Mesh-LLM capsules plugin, and its own book. Between them: the request and token stream over mesh QUIC, invoices and Lightning payments, and each side's half sent to the other side at completion (in the plugin from v0.1.15; confirmation needs mesh-llm v0.78.0 or later). The payer's payments plugin emits payment.lifecycle.v1 to its evidence plugin (#2035, in mesh-llm v0.77.0); the provider's matching stream (#2108) is in mesh-llm v0.78.0. Both books can register checkpoints with a witness, off by default. merged upstream, or released REQUESTER NODE · PAYS mesh-llm host exchange event · request + response digests payments.v1 + wallet merged upstream · #2035 Mesh-LLM capsules plugin seals this node's half · v0.1.15 digests only, never the text its own book sealed records · local checkpoints stays here: prompt, answer, preimage payment.lifecycle.v1 payer side · merged PROVIDER NODE · SERVES mesh-llm host runs the model · exchange event payments.v1 + wallet merged upstream · #2035 Mesh-LLM capsules plugin seals this node's half · v0.1.15 digests only, never the text its own book sealed records · local checkpoints stays here: prompt, answer, secrets provider side v0.78.0 · #2108 MESH QUIC request tokens stream back LIGHTNING input, then output invoice two payments each side's half sent to the other side confirmed when both agree v0.1.15 · mesh-llm v0.78.0+ a witness (optional) registers checkpoints, never content off unless you set its URL · v0.1.15 checkpoint checkpoint Paid inference on mesh-llm: two nodes, two books, an optional witness Top, the requester node; below it, the provider node. Each has the mesh-llm host, the payments.v1 plugin with a wallet, the Mesh-LLM capsules plugin, and its own book. Between them: the request and token stream over mesh QUIC, invoices and Lightning payments, and each side's half sent to the other side at completion (in the plugin from v0.1.15; confirmation needs mesh-llm v0.78.0 or later). The payer's payment.lifecycle.v1 stream is in mesh-llm v0.77.0 (#2035); the provider's (#2108) is in v0.78.0. Both books can register checkpoints with a witness, off by default. merged / released REQUESTER NODE · PAYS mesh-llm host exchange event · digests payments.v1 + wallet emits payment.lifecycle.v1 payer side · merged #2035 Mesh-LLM capsules plugin seals this node's half · v0.1.15 digests only, never the text its own book sealed records · local checkpoints stays here: prompt, answer, preimage ① request ↓ · tokens ↑ mesh QUIC ② invoices ↑ · payments ↓ Lightning · input, then output ③ each side's half sent to the other side confirmed when both agree v0.1.15 · mesh-llm v0.78.0+ PROVIDER NODE · SERVES mesh-llm host runs the model · exchange event payments.v1 + wallet emits payment.lifecycle.v1 provider side · v0.78.0 #2108 Mesh-LLM capsules plugin seals this node's half · v0.1.15 digests only, never the text its own book sealed records · local checkpoints stays here: prompt, answer, secrets a witness (optional) registers checkpoints only off unless you set its URL checkpoint
Every line shown is merged in mesh-llm or released in the Mesh-LLM capsules plugin. The witness is a separate party that only ever sees checkpoints, and you choose whether to use one.

1 · Serve

The requester sends the request with the provider's advertised prices. The provider prefills, then sends an input invoice with the terms frozen. It may decode ahead, but it pauses delivery at 512 tokens until its own wallet sees the payment.

2 · Pay

The payer pays the input invoice under its own spending cap. Output streams, and the provider invoices the output it actually sent. The payer settles that under the original authorization. Each moment appears on the payer's payment.lifecycle.v1 stream.

3 · Seal and close

At the end of the stream, each node's Mesh-LLM capsules plugin seals that node's half. Each node then sends its half to the other side, and on mesh-llm v0.78.0 or later the exchange is shown as confirmed by the other side when both sides recorded the same request and response digests. Checkpoints cover the new records, and a witness registers them if you turned one on.

The lifecycle

Six phases, and who asserts each one.

Every event carries a source, so a reader can see who is making the assertion. A signature on an event never upgrades it: a provider's claim stays a provider's claim.

PhaseWhat it recordsWho asserts itStatus
terms_acceptedThe payer accepted the frozen terms; the amount is its approved cap.payer_assertedmerged · #2035
input_invoice_issuedThe provider's input invoice, as the payer received it (not independently verified issuance).provider_assertedmerged · #2035
input_settlement_observedThe payer's wallet reported the input payment succeeded.wallet_reportedmerged · #2035
output_invoice_issuedThe provider's invoice for the output it sent, as the payer received it.provider_assertedmerged · #2035
output_settlement_observedThe payer's wallet reported the output payment succeeded.wallet_reportedmerged · #2035
final_accountedWhat the payer actually paid, fees included.payer_assertedmerged · #2035

The provider's half, merged in #2108 (closing #2017), uses the same event shape plus role: provider, and is in mesh-llm v0.78.0 (4 Oct 2026). It covers the invoice as actually issued (provider_asserted) and its own wallet seeing the payment arrive (wallet_reported). It also records when delivery paused and resumed at the token gate (host_asserted), a lapsed invoice, the output delivered, and a debt recorded or forgiven. A forgiveness is an operator action, so it goes on the record. released · v0.78.0

What each party can show

Checkable by each side, without trusting the other's wallet.

The requester can show

  • What it agreed to: a digest over the eight public fields of the terms, and nothing private.
  • Whether and what its own wallet reported paying, keyed by payment_hash.
  • Its sealed half of the exchange: digests of the exact request and response, and the token counts.

The provider can show

  • Its sealed half of the exchange, including what it served and on which model file.
  • With #2108, the invoices it actually issued, what its own wallet received, and when delivery was paused for payment.
  • Which debts it recorded, and which an operator forgave.

Nobody takes on trust

  • That the other side's record is the same: the halves match by digest, or they don't.
  • That a record wasn't rewritten later: checkpoints commit to it, and a witness holds a copy of the checkpoint.
  • Which side a claim came from: every event names its source.

What no one can show from this, yet

  • That the inference was correct, or that the prefill was honest. Upstream states that prices and token counts are the provider's claims, and that neither is checked.
  • That a paid wallet belongs to any particular person or organisation.
  • That every event was delivered. The stream is best-effort by design (an eight-event queue and a one-second timeout, and settlement never waits for it), so a missing event means incomplete evidence, not a failed payment.

What stays local

Prompt and response text, the invoice string, the payment preimage, wallet transaction IDs, and the private recovery ID never leave the node in these events or records. What travels is digests, amounts and payment_hash. Upstream notes that payment hashes are linkable metadata, so treat them that way.

For builders

Run it on two nodes

  1. Use mesh-llm v0.78.0 (4 Oct 2026) or later on both machines: it includes payments.v1 (#2035) and the provider-side events (#2108), so you see both halves.
  2. Set up a wallet on each node as the upstream payments spec describes. Paid mode moves real money over Lightning. A paid provider must run a single-node text model.
  3. Install the Mesh-LLM capsules plugin on both:
    # after downloading and checking the release archive
    mesh-llm plugins install --archive capsules-0.1.15-<target>.tar.gz \
      --name capsules --version 0.1.15
    Each node now seals its own half of every exchange and checkpoints locally. With the default settings it sends its sealed record of a completed exchange only to the other side of that exchange. It also answers any node that asks, by an exchange's nonce, whether it holds its half of that exchange: ids and digests only, with no record content and not who the other side was (on by default since v0.1.9; set share_exchange_corroboration = "off" to stop). Any node that asks also gets its checkpoint list and history_card/1: its signed checkpoints and the proofs between them, no records, whatever the settings. A witness is sent checkpoints only if you add one.

Released in v0.1.15 (3 Nov 2026): the Evidence page, and exchanges confirmed by the other side. Confirmation needs mesh-llm v0.78.0 or later on both nodes, and each node must know the other's key. Recording each payment event into the book, with its source, is released too (v0.1.0, 3 Oct 2026); the provider's events need mesh-llm v0.78.0. Not built yet: joining both sides' payment records to tell the three missing-payment stories apart.

For enterprises

Why this matters for agent payments

When your agents buy and sell work from parties you don't know, a dispute is settled by records, and one side's ledger is not enough to settle it. Here each party seals its own view at the moment of the exchange, and the two views join on an identifier both wallets already share, so "never paid", "paid late" and "noticed late" become checkable facts rather than accusations. No platform sits in the middle holding everyone's data: each party keeps its own book and shows only what a dispute needs.

When a dispute needs a second signature from someone who is neither party, that is what Countersign is for.

Claims table

Every claim on this page, and what it rests on.

Upstream links point at the mesh-llm pull request, issue or merge commit. Rows marked “released · ours” link a Mesh-LLM capsules plugin release and, where the release notes are not enough, its code at a named tag. Rows marked “designed” are not built yet.

#ClaimStatusRests on
1The mesh-llm host tells out-of-process plugins about each OpenAI exchange, including on the node that routed the request.merged#1437 · 6929c702887343af1b73296d7bd7f4aaa2db642f
#1668 · 85b142df02fbb4c2555becd589ad7324296a8114
2That event carries digests of the exact request and response, plus serving provenance, so a half commits to digests and not text.merged#1841 · 6ffb2b711f081ca03bde7dc5bc9f8facec03da51
#1946 · 3060f3762aa92841be048113660eba07f2eab251
3The payments engine runs as the in-process payments.v1 plugin. It can be turned off, and with no engine installed the node runs free-only.merged#2035 · d06600ea0433a3271d0b51686ddb195f77a2336f
4The payer emits payment.lifecycle.v1: six phases, each with a source of payer_asserted, provider_asserted or wallet_reported.mergedpaid_events.rs @ d06600ea0433a3271d0b51686ddb195f77a2336f
5The terms digest covers eight public fields; the private recovery ID and the local peer are excluded.mergedpaid_events.rs @ d06600ea0433a3271d0b51686ddb195f77a2336f (terms_digest)
6Events carry no invoice string, preimage, wallet transaction ID, prompt or response text, and payment hashes are linkable metadata. Delivery is best-effort: an eight-event queue, a one-second timeout, and settlement never waits for it.mergeddocs/specs/lightning-payments.md @ d06600ea0433a3271d0b51686ddb195f77a2336f
7Two payments, input then output. Delivery pauses at 512 tokens until the provider's wallet sees the input payment.mergedlifetimes.rs @ d06600ea0433a3271d0b51686ddb195f77a2336f (PRE_PAYMENT_OUTPUT_TOKENS)
8An unpaid input invoice with nothing delivered lapses and does not block the peer. Delivered output left unpaid blocks the peer until it is paid or an operator forgives it.mergedreceivables.rs @ d06600ea0433a3271d0b51686ddb195f77a2336f
9Prices and token counts are the provider's claims. Correct inference and honest prefill are not checked.merged (stated)docs/specs/lightning-payments.md @ d06600ea0433a3271d0b51686ddb195f77a2336f (Payment flow)
10payments.v1 is in a tagged release: #2035 merged on 25 Sep 2026, and mesh-llm v0.77.0 (28 Sep 2026) includes it.factmesh-llm v0.77.0 · #2035
11The provider's matching events use the same shape plus role: provider, including host_asserted delivery pause and resume, lapse, and debt recorded or forgiven. They join on payment_hash.released · v0.78.0#2108 · issue #2017 (closed as completed, 30 Sep 2026)
12The Mesh-LLM capsules plugin installs with one command and seals each node's own half at the serving boundary. Local checkpoints are on by default, and the witness is off unless you set its URL.released · oursMesh-LLM capsules plugin v0.1.15 · 3b3538179c50ca11c5266d6c0bb3aaca677d5fb3
13Each node sends its half to the other side at completion, on by default, and an exchange whose two halves agree is shown as confirmed by the other side. This needs mesh-llm v0.78.0 or later on both nodes, and each node must know the other's key.released · oursMesh-LLM capsules plugin v0.1.15 (What works today) · 3b3538179c50ca11c5266d6c0bb3aaca677d5fb3
exchange-row-state.ts @ 02ee5c9bbbad32de9037c7b8d4aaab10bf0f911d (deriveRightCellState)
14The plugin adds an Evidence page to the mesh-llm console: the peers this node exchanged with, each exchange and whether it is confirmed by the other side, and whether this node's log still verifies.released · oursMesh-LLM capsules plugin v0.1.15 · 3b3538179c50ca11c5266d6c0bb3aaca677d5fb3
15The Mesh-LLM capsules plugin reads payment.lifecycle.v1 and seals each event its own host reports as a record with its source, refusing an event relayed from a peer. Each node's Evidence page shows a paid exchange's amounts from those records, and who stated each. Sealing is in the plugin from v0.1.0 (3 Oct 2026); the Evidence page view from v0.1.4 (12 Oct 2026).released · oursmain.rs @ 02ee5c9bbbad32de9037c7b8d4aaab10bf0f911d (payment.lifecycle.v1 handler)
settlement_channel.rs @ 02ee5c9bbbad32de9037c7b8d4aaab10bf0f911d (source kept)
Mesh-LLM capsules plugin v0.1.4 (paid exchanges on the Evidence page)
16The three missing-payment stories are told apart by joining both sides' payment records on payment_hash. Not in the plugin yet: each node's Evidence page reads only its own book, and an invoice with no settlement its wallet reported reads as “no settlement seen”, with no reason given.designedDESIGN-paid-inference-evidence.md @ v0.1.0
evidence_panes/settlement.rs @ 02ee5c9bbbad32de9037c7b8d4aaab10bf0f911d (one node's book only)

More worked examples, with reports you can open and check: Demos →