Skip to content

feat(x402): improve 402 html page and its prompts#593

Open
OisinKyne wants to merge 2 commits into
mainfrom
oisin/402-html-page
Open

feat(x402): improve 402 html page and its prompts#593
OisinKyne wants to merge 2 commits into
mainfrom
oisin/402-html-page

Conversation

@OisinKyne
Copy link
Copy Markdown
Contributor

@OisinKyne OisinKyne commented Jun 4, 2026

Problem to be solved

The prompts on the html payment required UI don't tell the user that an agent service probably needs a task to be parsed, and an inference service is designed to be given to obol buy inference for use as an agent's brain. This PR aims to increase the success of people copying and pasting the prompts into their agents.

Summary

Need to test a little more, but pushing to a pr to start, also opening another pr (#594) for swagger that's intended for 0.11

402 HTML page — type-aware copy
(internal/x402/paymentrequired.go

  • template)
  • New PaymentDisplay fields:
    OfferType, OfferName,
    OfferDescription, Model.
  • buildTypeCopy produces a
    per-type lede + primary "Buy" card
  • secondary prompt cards.
    buildMetaDescription now prefers
    the operator description for
    OG/Twitter previews.
  • Inference offers get a primary
    obol buy inference --seller
    … --model … --budget 1
    --no-verify-identity shell snippet
    (rendered in < pre >), and lede
    framing makes it clear they're
    paying for remote model time, not
    an agent.
  • Agent offers get a primary
    chat-completions request snippet
    with model/messages/X-PAYMENT
    filled in, and lede framing flags
    that agents have
    tools/skills/memory and need a
    real prompt.
  • HTTP offers keep the existing
    single-prompt Obol-agent CTA.
  • Description, when set, renders
    under the Service card and goes
    into the OG meta.

Route + offer plumbing

  • RouteRule
    (internal/x402/config.go) gains
    OfferType and Model.
  • serviceoffer_source.go now
    copies
    spec.registration.description into
    RouteRule.Description (was
    previously a "ServiceOffer " debug
    label) and sets OfferType +
    Model.

CLI

  • --description is now the primary
    flag on sell
    inference|http|agent, with
    --register-description kept as an
    alias. Resume path
    (buildResumeGatewayArgs) emits
    --description. Tests updated.
  • sell inference --model rejects /
    and suggests a -- replacement
  • RouteRule (internal/x402/config.go) gains OfferType and Model.
  • serviceoffer_source.go now copies spec.registration.description into
    RouteRule.Description (was previously a "ServiceOffer " debug label) and
    sets OfferType + Model.

CLI

  • --description is now the primary flag on sell inference|http|agent, with
    --register-description kept as an alias. Resume path
    (buildResumeGatewayArgs) emits --description. Tests updated.
  • sell inference --model rejects / and suggests a -- replacement (the
    LiteLLM wildcard bug the agent hit).

buy.py

  • cmd_pay now accepts --timeout , defaults to 100s (Cloudflare
    free-tier tunnel cap), wired into urllib.request.urlopen.
  • SKILL.md gets two new pitfall entries (timeout default, slash-in-model
    breakage).

Re: the openapi branch: I left it alone — the new fields are intentionally
small so they layer onto richer Swagger-derived copy later without conflict.
When oisin/openapi lands, the description field on the 402 page is the
natural seam to either deep-link to the spec or expand into a multi-card
breakdown.

@OisinKyne OisinKyne changed the title Improve 402 html page feat(x402): improve 402 html page and its prompts Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant