Skip to content

About

Spend controls and x402 payment execution for Spec Kit agents — set USDC budgets, pay APIs, stay in control.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

spec-kit-pay-x402

Spend controls, counterparty credit checks, and x402 payment execution for Spec Kit agents.

A Spec Kit extension that lets your AI coding agent pay for the APIs it needs during implementation — with a cap you set, and a credit check on whoever is being paid.

Verified against Spec Kit v1.0.4.

Why This Exists

When a Spec Kit agent implements a feature that needs live data, AI inference, or web scraping, it hits a paywall and stops. The x402 protocol turns that paywall into something an agent can clear on its own: the service answers HTTP 402 with machine-readable terms, the agent signs a payment, and the request goes through.

Two things make that safe to hand to an agent, and this extension provides both:

  • A cap — /speckit.pay-x402.budget sets the most it may spend on one spec.
  • A credit check — /speckit.pay-x402.trust reads the recipient's history before any money moves.

Installation

specify extension add pay-x402 --from https://github.com/shawnhvac/spec-kit-pay-x402/archive/refs/tags/v1.1.0.zip

Or from the community catalog:

specify extension search x402
specify extension add pay-x402

Quick Start

# 1. After /speckit.plan — set your spend cap
/speckit.pay-x402.budget
> Cap: $5.00 USDC on Base

# 2. Before paying someone new — check them
/speckit.pay-x402.trust
> SolvScore 53/100 (682 days old, 440 transactions, 23 counterparties)

# 3. During /speckit.implement — pay as needed
/speckit.pay-x402.pay
> Paid $0.20 to Firecrawl on base. Settlement tx 0x7c63… Remaining cap: $4.80

Commands

/speckit.pay-x402.budget

Set a per-spec USDC spending cap before implementation begins. Every /pay call is tracked against it, and exceeding it stops the payment when auto_enforce is true. Runs automatically via the optional after_plan hook.

/speckit.pay-x402.trust

Read a counterparty wallet's credit file from SolvScore — free, no key, Solana or Base addresses. Returns a 0–100 score with the signals behind it, or an explicit refusal when a wallet is too new to price. A refusal is a signal, not a zero.

/speckit.pay-x402.pay

Pay an x402-enabled endpoint and retry the request with proof of payment. The command follows the protocol as it actually works: read the 402 terms, sign your own payment for the chosen rail, retry with X-Payment, and confirm a settlement transaction hash came back. An answer without a hash is not a settled payment.

Configuration

Copy config-template.yml to pay-x402-config.yml:

pay_x402:
  facilitator: "https://x402-agent-pay.com/facilitator"
  rail: "base"                 # base | solana
  cap_usdc: 5.00               # USDC spending cap per spec
  auto_enforce: true           # Block payments when the cap is exceeded
  require_trust_check: false   # Check the recipient before paying
  min_trust_score: 0           # 0 disables the threshold

Rails

Whatever this table says, the authoritative answer is GET https://x402-agent-pay.com/facilitator/supported. Check it before you sign.

Rail Network id Scheme Payment form
Base eip155:8453 exact EIP-3009 transferWithAuthorization, signed not broadcast
Solana solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp exact Partially-signed TransferChecked, facilitator sponsors the fee

Payments settle in USDC. The facilitator exposes /verify (free, no gas) and /settle.

Compatible Services

Any service returning HTTP 402 with x402 terms works. Browse the directory at x402scan.com.

Service Use Case Typical Cost
Firecrawl Web scraping ~$0.01–$0.20/req
AskSurf AI research ~$0.20–$2.00/req
Heurist Mesh AI inference ~$0.001–$0.10/req
AgentWorld Agent economy data & jobs ~$0.01–$0.50/req

Design Notes

  • Nothing is paid silently. Every payment reports the amount, the rail, the recipient and the settlement hash.
  • The cap is enforced before signing, not reconciled afterwards.
  • Terms come from the endpoint, never from this extension. Amount, recipient and facilitator are read from the live 402 each time, so a stale document here cannot cause a wrong payment.

License

MIT — see LICENSE

Links

About

Spend controls and x402 payment execution for Spec Kit agents — set USDC budgets, pay APIs, stay in control.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors