跳到正文
Skillpedia
智能体7.0k · #13623

x402

它能做什么

这项技能涵盖 x402,这是一种让网络服务通过标准 HTTP 402 付款响应,按每次请求收费的方式。智能体可以解读付款请求、准备待签名的付款,并使用结算服务来验证或结算。

适用场景

  • ✓当一项在线服务返回付款请求,而你的智能体需要付款时。
  • ✓当你希望按每次请求向其他智能体收费,使用你自己的 API 时。
  • ✓当你在批准付款之前,需要检查付款请求的时候。

技能链接

https://github.com/internet-court/internet-court-skill/blob/main/vendored/chaingpt/x402/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/internet-court/internet-court-skill/blob/main/vendored/chaingpt/x402/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我想让我的智能体为一个要求付款的 API 付款,但请先说明它要我付多少钱。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会读取付款请求,并用通俗的语言解释金额、币种和收款方。它会准备一笔未签名的付款,由你的钱包签名,然后智能体将其随请求一同发回。结算服务无法更改你签名的金额或收款方。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

x402 Payments skill

x402 turns HTTP 402 Payment Required into a real payment rail for agents: a server replies 402 with what it wants paid; the client signs an off-chain authorization and retries with an X-PAYMENT header; a facilitator broadcasts it. Settlement uses EIP-3009 transferWithAuthorization (e.g. USDC on Base) — the facilitator can only broadcast the signed authorization, never alter the amount or destination.

Custody-free: the plugin builds the EIP-712 the payer signs and assembles the header; it never holds a key.

Tools

Tool Purpose
chaingpt_x402_decode Decode a 402 body or X-PAYMENT header into human terms (amount/token/recipient/expiry) before paying.
chaingpt_x402_build_payment Build the UNSIGNED EIP-3009 typed data; pass a signature back to get the final X-PAYMENT header.
chaingpt_x402_facilitator Call a facilitator: supported / verify / settle.
chaingpt_x402_create_requirements Server side: generate the PaymentRequirements + 402 body to monetize your endpoint.
chaingpt_x402_fetch The whole client loop in one tool: fetch a URL; on 402 it decodes the challenge and (given from) emits the unsigned typed data; re-call with xPaymentHeader to complete the paid request.

Pay an endpoint (client flow)

Fast path — one tool drives the loop:

  1. chaingpt_x402_fetch url=<resource> from=<payer> → on 402 you get the decoded price/payee AND the unsigned EIP-3009 typed data.
  2. Sign the typed data in the payer's wallet.
  3. chaingpt_x402_build_payment from=<payer> requirements=<from step 1> signature=0x… → the X-PAYMENT header.
  4. chaingpt_x402_fetch url=<resource> xPaymentHeader=<header> → the paid response.

Manual path (same primitives, finer control): _decode → _build_payment → sign → _build_payment +signature → retry yourself.

Monetize your endpoint (server flow)

chaingpt_x402_create_requirements network=base amount=0.01 payTo=<you> → serve the returned JSON with HTTP 402. Verify/settle incoming payments via a facilitator (chaingpt_x402_facilitator).

Known EIP-3009 tokens: USDC on base and base-sepolia. For other tokens pass full PaymentRequirements (with asset + extra.name/extra.version). 0 ChainGPT credits.

常见问题

智能体会持有我的钱包密钥吗?

不会。该技能说明智能体从不持有密钥,签名由你的钱包完成。

什么是结算服务?

它是一种检查已签名付款并将其发送到区块链的服务。

它使用哪种币?

该技能的示例使用 Base 网络上的 USDC。

详情

作者的原始描述

x402 agentic payments (Coinbase's HTTP 402 protocol). Custody-free tools to pay x402-protected endpoints (build the EIP-3009 transferWithAuthorization the payer signs, assemble the X-PAYMENT header), call a facilitator (verify/settle/supported), and monetize your own API by generating PaymentRequirements. USDC on Base. Triggers: x402, HTTP 402, pay per request, agentic payment, machine payment, X-PAYMENT, transferWithAuthorization, EIP-3009, facilitator, monetize API, pay for API, agent pays.

repo: internet-court/internet-court-skill

热度

GitHub 星标
7.0k
排名
#13623
许可证
—
更新时间
2026/10/26

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能