Skip to main content

Documentation Index

Fetch the complete documentation index at: https://agentcash.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

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 as an OpenAPI document at /openapi.json, with x-payment-info annotations on each paid operation. AgentCash also falls back to /.well-known/x402 for older servers. See server discovery for the spec.

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 /openapi.json (or /.well-known/x402 as a fallback)
  • 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 keys are generated automatically on first use and stored under ~/.agentcash/wallet.json for the EVM keypair (Base, Tempo) and solana-wallet.json for the Solana keypair. Together they hold 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 Base (default) and Solana, plus Tempo for testing. See networks for the full list.

Payment protocols

AgentCash supports two payment protocols:
ProtocolHow it worksWhen it’s used
x402On-chain USDC payment settled per request. AgentCash signs a USDC transfer and submits it with the retry.Default for most endpoints
mppSigned payment intent delivered off-chain. The server settles the charge; the client only signs the proof.Endpoints that prefer off-chain settlement or batching
Endpoints declare which protocols they accept in their OpenAPI spec (x-payment-info.protocols). AgentCash reads that list, picks one your wallet supports, and handles the rest automatically. You can force a specific protocol with --payment-protocol.