用途:当用户希望匿名按次付费调用 Nansen API,且不想持有 API key、不愿自建 Base 或 Solana USDC 钱包时使用。适用于用户提到 MPP、tempo、Authorization: Payment 或 Payment-Receipt,或已在用 tempo 支付其他 API 的场景。Nansen API 支持三种付费通道:API key、x402(由 nansen-cli 处理)与 MPP(由独立的 tempo CLI 处理),本技能只覆盖 MPP。nansen-cli 自身不签名 MPP 凭证。
一次性配置: curl -fsSL https://tempo.xyz/install | bash tempo wallet login tempo wallet fund tempo wallet whoami 其中钱包由 tempo 管理,需按其选定链充值 USDC。
调用方式:tempo request 负责完整的 402 挑战与应答流程——发送请求,在收到 402 与 WWW-Authenticate: Payment 后签署 Authorization: Payment 凭证并重试,成功后返回 Payment-Receipt 头。例如: tempo request POST https://api.nansen.ai/api/v1/smart-money/netflow --json '{"chains":["solana"],"pagination":{"page":1,"page_size":10}}' tempo request POST https://api.nansen.ai/api/v1/tgm/holders --json '{"token_address":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","chain":"solana"}' 端点路径与请求体与其他 Nansen API 一致,可用 nansen schema <command>(无需 API key)查询请求体结构,再通过 tempo request 调用对应的 /api/v1/... 路径。
发现付费端点:curl https://api.nansen.ai/.well-known/x402,返回 paymentProtocols: ["x402", "mpp"](服务端启用 MPP 时)及付费资源列表。
与 x402 的差异:MPP 重试时发送 Authorization: Payment,402 挑战头为 WWW-Authenticate: Payment,成功头为 Payment-Receipt;钱包由 tempo 管理(独立 CLI),链为 Tempo 的链;nansen-cli 的 src/x402.js 自动签名路径不处理 MPP,需直接使用 tempo request。
限制:MPP 为服务端选择开启。若 tempo request 返回 402 但无 WWW-Authenticate: Payment,说明该端点或环境未启用 MPP,应回退到 API key 或 x402。不要给 nansen-cli 添加 --mpp-* 参数,官方支持的集成方式是单独使用 tempo。每次请求价格与 x402 相同(1 credit ≈ $0.001,含 10 倍加价,如 1 credit 端点约 $0.01)。