> ## 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.

# How it works

> How AgentCash discovers premium APIs.

## 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 services are available from API providers
2. **Inspect** pricing and schemas before committing
3. **Call** the API 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](/discovery) for the spec.

## The payment flow

AgentCash supports two open payment standards: [x402](https://www.x402.org) and [MPP](https://mpp.dev). Both fit into the following payment flow:

<Steps>
  <Step title="Agent sends a request">
    Your agent calls a service like any normal HTTP request.
  </Step>

  <Step title="Provider responds with a price">
    The provider responds with `402 Payment Required`, including the price and accepted payment methods.
  </Step>

  <Step title="AgentCash pays">
    AgentCash signs a payment with your local wallet and retries the request with proof of payment.
  </Step>

  <Step title="Provider verifies and responds">
    The provider verifies the payment and returns the requested data.
  </Step>
</Steps>

This happens within a single call. Your agent sees a clean response with the data it asked for.

x402 was developed by Coinbase and is managed by the Linux Foundation. MPP was developed by Stripe and Tempo Labs. Both are open standards, and AgentCash picks the right one automatically based on what the provider accepts.

## What AgentCash handles

Whether you use the CLI, the agent skill, or MCP mode, AgentCash manages:

* **API 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

## Get started

<CardGroup cols={2}>
  <Card icon="shopping-cart" title="For Agents" href="/start-agent">
    Give your AI agent access to 3,200+ premium APIs.
  </Card>

  <Card icon="store" title="For API Providers" href="/sell-to-agents">
    Sell your services to agents.
  </Card>
</CardGroup>
