Skip to main content

The discovery layer

AgentCash connects your agent to a growing ecosystem of premium API providers. When your agent needs data or services, it uses AgentCash to:
  1. Discover what endpoints are available on a provider
  2. Inspect pricing and schemas before committing
  3. Call the endpoint with automatic payment
  4. Return the data to your agent in a clean format
Providers publish their APIs using a standard discovery format at /.well-known/x402, making them instantly findable.

The x402 protocol

x402 is an open HTTP standard for machine-to-machine payments. It builds on the 402 Payment Required status code from HTTP/1.1.
1

Agent sends a request

Your AI agent calls an endpoint like any normal HTTP request.
2

Server responds with 402

The server responds with 402 Payment Required and includes payment details: the price, accepted currency (USDC), and the blockchain network.
3

AgentCash signs a payment

AgentCash reads the 402 response, signs a USDC payment credential with your local wallet, and retries the request with proof of payment.
4

Server verifies and responds

The server verifies the payment and returns the requested data.
This happens automatically within a single call. The agent sees a clean response with the data it asked for, plus metadata about the payment (amount, transaction hash).

What AgentCash handles

Whether you use the CLI, the agent skill, or MCP mode, AgentCash manages:
  • Endpoint discovery: finds available APIs and their pricing via /.well-known/x402
  • Payment detection: recognizes 402 responses and extracts payment requirements
  • Credential signing: signs USDC payment proofs with your local wallet key
  • Automatic retry: retries the original request with the signed payment attached
  • Balance checking: verifies you have sufficient funds before paying

Wallet

Your wallet is a locally-stored Ethereum keypair at ~/.agentcash/wallet.json, created automatically on first use. It holds USDC for making payments.
Your private key is stored on disk with restricted file permissions (600). Do not share your wallet file.
The wallet supports USDC on multiple EVM networks, with Base as the default. See networks for the full list.

Payment protocols

AgentCash supports the following payment protocols:
ProtocolHow it worksWhen it’s used
x402On-chain USDC payments verified by the serverDefault for most endpoints
AgentCash auto-selects the right protocol based on your wallet balance and the endpoint’s requirements.