Skip to content

Feature request: surface a first-class pay-per-call (HTTP 402 / x402) step when an agent tool answers 402 #3550

Open

Description

@dhyabi2

Feature request: surface a first-class pay-per-call (HTTP 402 / x402) step when an agent tool answers 402

Context. Inkeep Agents builds AI assistants and multi-agent workflows that call tools. When an agent steps outside the sandbox to call a metered third-party tool or API, today that usually means a billed API key or a subscription. There is no runtime-level way to settle a per-call bill when a priced endpoint answers.

Proposal. Add an optional hook on the agent tool-call path (the agents-api / agent runtime): when a tool answers 402 Payment Required with a machine-readable payment challenge (an x402 accepts[] envelope — the emerging pay-per-call standard for agent APIs, with no API key, no account and no card), surface that as a first-class settlement step a builder can wire up: read the price, approve a spend cap, pay, retry, and record the charge. The runtime then handles pay-per-call APIs natively.

Why it fits.

  • Metered tool APIs are the common case for agent workflows (search, scraping, enrichment, compute), and per-call charges often sit below the card floor — per-call settlement is the natural fit.
  • The tool-call / MCP integration points already exist, so this hook sits beside existing tool handling; no tool changes behavior.
  • Optional and additive: flows that use billed keys today keep working unchanged.

How to verify. I can provide a reference implementation: a tiny x402 client that reads the 402 accepts[] list, pays, and retries, tested against a live pay-per-call endpoint that returns real 402s with an x402 v2 envelope on nano:mainnet (keyless — its x402 discovery file is live at https://extract.paypercall.dev/.well-known/x402). Ready as a drop-in adapter on the tool-call path.

Happy to draft the reference client and a minimal hook if this direction is welcome.

Activity

  1. conforticontent-cmd commented on Oct 26, 2026

    @conforticontent-cmd

    worth knowing that 402 arrives in two flavours, and they settle differently. x402 settles in USDC, L402 settles in bitcoin over lightning. if you want the lightning side, we probed a few hundred endpoints and list the ones that actually answered a 402 with their real price:
    satbotly.com/apis?p=l402

    happy to hand over the raw probe output if it saves you writing the discovery step. free, no signup, nothing wanted back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions