TOKENSHARE / how to use

HOW TO USE

Two walkthroughs, one page. Buyers lock a testnet USDC budget and pay per call; sellers rent out the spare quota of an official LLM plan. Pick your role — the other guide stays hidden until you switch.

MONAD TESTNET · 10143
BUYER SELLER

deep links: guide.html#buyer · guide.html#seller

WHAT YOU NEEDbuyer · five minutes of setup

  • A browser wallet — MetaMask or OKX (any EIP-6963 wallet works). Every signature and transaction happens in it; wallet keys never touch the page.
  • Monad testnet — chain ID 10143. On connect, the page offers to add or switch to it.
  • Testnet MON for gas — faucet.monad.xyz ↗.
  • Testnet USDC — faucet.circle.com ↗, select token USDC and network Monad Testnet.
  • Testnet tokens only — nothing on this deployment has real-world value.

THE FLOWbuyer · deposit ≠ lock ≠ call

  1. CONNECT + POLICY TICKwallet connects; the consent bar at the top of the console is a UX gate — not a signature, nothing on-chain
  2. DEPOSITUSDC moves wallet → escrow contract; your AVAILABLE balance grows. Nothing is reserved yet.
  3. LOCKmax USDC + TTL seconds → a paymentId. The amount is now reserved from AVAILABLE for that lock only.
  4. PATH A — API KEY (agents)

    1. MINT API KEYone off-chain wallet signature → key shown once
    2. CALLS WITH THE KEYOpenAI-style requests, no per-call wallet popup

    PATH B — CALL DEMO (manual)

    1. SIGN + CALL PER REQUESTeach call signed fresh in the wallet — the demo never takes the minted key
  5. WHEN THE TTL ENDSconsumed part → captured to the seller · while the payment remains Locked, the unconsumed remainder becomes refundable after TTL — a Settled payment is final · AVAILABLE balance → withdraw any time

STEPSbuyer · console links included

  1. CONNECT THE WALLET

    Open the console (buyer side) → [ CONNECT WALLET ] → pick your wallet in the selector. On the wrong network the page offers [ SWITCH / ADD NETWORK ] itself.

  2. TICK THE POLICY CONSENT

    The consent bar at the top of the console. It gates paid actions only, is remembered per wallet in this tab's session, and is not a signature. Refunds, withdrawals and revokes stay open even unticked.

  3. DEPOSIT USDC

    ACCOUNT FUNDS → amount → [ APPROVE + DEPOSIT ]. The approval is a token allowance — skipped automatically when the existing allowance already covers it; the deposit itself is always one transaction. Funds land in your escrow AVAILABLE balance. Depositing is not locking.

  4. PICK A SELLER AND MODEL

    The market page lists active sellers with live per-model prices (cached / input / output per 1M tokens) — read prices there, they change. Then select the seller in the console's LOCK picker; the market does not pre-fill it for you.

  5. LOCK A BUDGET

    LOCK → MAX AMOUNT (USDC) + TTL in seconds (default 600, minimum 60) → one transaction → a paymentId. The lock reserves from AVAILABLE. Size it above the seller's priciest per-call estimate: once the remaining balance drops below that estimate, calls fail with 402 even while it is still above zero.

  6. MINT AN API KEY

    [ MINT API KEY ] on the lock row → one off-chain EIP-191 wallet signature (no gas, no transaction) → a key (tsk1.…) shown once and never stored. Copy it somewhere safe: whoever holds it can spend up to the lock's max until it expires or you revoke it.

  7. CALL — PATH A: WITH THE KEY

    The relay speaks the OpenAI chat-completions shape. [ COPY BASE URL ] on the key row resolves the seller's endpoint from chain; the key goes in the Authorization header.

    BASE_URL='<from COPY BASE URL>'
    API_KEY='<the tsk1.… key shown once at mint>'
    MODEL='<one of the seller's listed models>'
    
    curl "$BASE_URL/v1/chat/completions" \
      -H "Authorization: Bearer $API_KEY" \
      -H "Content-Type: application/json" \
      -d "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"hi\"}]}"
  8. CALL — PATH B: CALL DEMO

    CALL DEMO signs each request fresh in your wallet — no key involved. Don't paste the minted key into the demo; it doesn't take one.

  9. WATCH SPEND

    API KEYS filters keys by ACTIVE / EXPIRED / REVOKED (six per page), and USAGE shows max / captured / remaining per key or lock. Captured trails reality briefly while the relay flushes usage on-chain. The status badge is local clock + revoke bookkeeping — not a proof of remaining budget or of the payment's on-chain state.

  10. EXIT PATHS

    [ REVOKE ] kills a key immediately (off-chain signature, no transaction) — it stops calls; it does not refund or withdraw anything. REFUND returns the unconsumed remainder of a Locked payment after its TTL — a Settled payment is final. [ WITHDRAW ] moves AVAILABLE escrow balance back to your wallet at any time.

IF SOMETHING FAILSbuyer · the short list

  • insufficient escrow balance on LOCK — deposit the shortfall first; the console prints the exact missing amount.
  • 402 on a call — the relay rejected the payment as invalid or underfunded: remaining balance below the seller's minimum per-call estimate, payment expired or not Locked, or the request carries the wrong seller or buyer. Check the payment's state and seller on the lock row plus the minimum estimate before retrying. Remedy: depositing cannot raise an existing lock's cap — open a new, funded lock (no need to wait, funds permitting) and let the old Locked remainder become refundable after its TTL.
  • 401 with a minted key — the key is no longer accepted, usually expired or revoked; the API KEYS badge tells which.
  • 424 from a seller — their setup is incomplete (stored key, listing binding, or delegate). Not fixable by topping up — pick another seller.
  • RPC unreachable — the market and console degrade to read-fail hints; retry in a moment, nothing local is lost.

The card anchors above land on the console's buyer tab by default. Full risk and custody detail lives in the policy.

WHAT YOU NEEDseller · no USDC deposit to start

  • A wallet with a little testnet MON for gas — a USDC deposit is not required to onboard.
  • An upstream API key for the provider whose official plan you're renting out (e.g. your Kimi/Moonshot key). This deployment is a shared relay — you run no infrastructure of your own.
  • Never paste your wallet's seed phrase or private key — the page never asks. The only secret you paste is the provider API key, into a password-masked field.

THE FLOWseller · two gates before serving

  1. CONNECT + POLICY TICKsame bar as buyers — a UX gate, not a signature
  2. VERIFY + SEAL KEYlive pin check → key sealed in the browser (ECDH/HKDF/AES-256-GCM) → custody signature → sealed upload → catalog probe
  3. PUBLISH LISTINGservable models + per-model prices, one on-chain transaction
  4. AUTHORIZE DELEGATEa second, explicit on-chain approval — either order vs. publish, but both must be green before the relay settles
  5. SERVINGthe relay settles per call automatically — captured amounts accrue to your escrow AVAILABLE balance → WITHDRAW any time

STEPSseller · all inside the console's SELLER tab

  1. CONNECT + TICK POLICY

    Open the console (seller side), connect the wallet, tick the consent bar at the top. Same gate as buyers; exit paths never require it.

  2. SEAL THE UPSTREAM KEY

    KEY CUSTODY card: the relay origin is pinned by the deployment and cannot be edited. Enter the upstream base URL and the provider API key, then [ VERIFY + SEAL KEY ]. The page first checks the live relay against the deployment's pinned identity (origin, signer, key hashes, app id, derived address, report data); your key is then sealed inside the browser in an ECDH/HKDF/AES-256-GCM envelope, you sign a custody message in the wallet (off-chain), and only the envelope is uploaded. The key field is cleared after a successful verify.

  3. CHECK THE EVIDENCE (OPTIONAL)

    VERIFY ATTESTATION LIVE and CLOUD VERIFY fetch and re-check the relay's TEE attestation. Treat the result as evidence, not as a proof of service.

  4. PUBLISH THE LISTING

    Pick models from the returned catalog — greyed-out entries are ones this key cannot serve — and set three USDC-per-1M-token prices per model (cached / input / output). [ SUBMIT TO REGISTRY ] sends one transaction; the listing appears on the market immediately.

  5. AUTHORIZE THE DELEGATE

    [ AUTHORIZE DELEGATE ] is a separate, explicit on-chain approval, required before the relay can settle. Either order vs. publish works — both gates must be green. Read the scope before signing: the delegate may settle any Locked payment up to its full maxAmount, including payments past their TTL; per-call token accounting lives in the relay's records and is not enforced by the contract.

  6. GET PAID

    Settlement is automatic — there is no settle button. Captured amounts accrue to your escrow AVAILABLE balance (the same pot buyers use); [ WITHDRAW ] in ACCOUNT FUNDS moves it to your wallet. The settlement split is a property of the current deployment, not of this page.

  7. CHANGE THINGS LATER

    Prices only → update from the register form, one transaction per changed model. Model set or endpoint → [ DEACTIVATE → RE-REGISTER ], two transactions. Deactivation hides you from the market and stops new locks; payments already Locked still settle. Editing the upstream URL or key marks the catalog stale — PUBLISH stays locked until a fresh VERIFY.

  8. OFFRAMPS

    [ REVOKE DELEGATE ] (an on-chain approval removal) and [ REVOKE STORED KEY ] (relay-side) are separate actions, and neither is deactivation — revoking the stored key leaves the listing on-chain. None of the exit paths needs the policy tick.

IF SOMETHING FAILSseller · the short list

  • DEPLOYMENT MISMATCH — the live relay doesn't match the pinned deployment record. That's the operator's record to fix; report it, don't work around it.
  • catalog empty or greyed out — the upstream key can't serve those models; verify with a key that can.
  • PUBLISH blocked — the form prints the reason: pins unverified, catalog stale, key not stored, or no servable model checked.
  • buyers see 424 on your listing — your stored key, listing binding or delegate authorization is incomplete; re-run steps 2–5.
  • edited URL or key after VERIFY — the catalog goes stale by design; VERIFY again before publishing.

Custody limits, receipt limits and refund rules are stated in the policy — read it before listing.