> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cabalspy.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# x402 for AI agents

> AI agents pay per request in USDC for CabalSpy wallet data with x402: no account, no signup, no API key. Clients for TypeScript and Python with built-in spend limits.

With x402, an AI agent pays in USDC for each API call and gets the same labeled wallet data as with an API key. There is no account, no signup and no key. The wallet is the identity.

x402 builds on the HTTP status code 402 Payment Required: the server answers a request with a price, the client pays and repeats the request with proof of payment.

## Install

<CodeGroup>
  ```bash TypeScript theme={null}
  npm install cabalspy-x402
  ```

  ```bash Python theme={null}
  pip install "cabalspy-x402[all]"
  ```
</CodeGroup>

## Quick start

<CodeGroup>
  ```ts TypeScript theme={null}
  import { createClient } from 'cabalspy-x402';

  const cabalspy = createClient({
    signer,                        // Solana signer
    evmSigner,                     // Base, Polygon, Arbitrum, either or both
    maxSpendTotal: '$5.00',        // hard cap for this process
  });

  const wallet = await cabalspy.wallets.lookup('As7HjL7dzzvbRbaD3WCun47robib2kmAKRXMvjHkSMB5');
  console.log(wallet.name, wallet.type);

  console.log(cabalspy.x402.summary());
  // { calls: 1, spentUsd: 0.01, remainingUsd: 4.99 }
  ```

  ```python Python theme={null}
  from cabalspy_x402 import create_client

  cabalspy = create_client(
      svm_signer=signer,             # Solana
      max_spend_total="$5.00",       # hard cap for this process
  )

  wallet = cabalspy.wallets.lookup("As7HjL7dzzvbRbaD3WCun47robib2kmAKRXMvjHkSMB5")
  print(wallet["name"], wallet["type"])

  print(cabalspy.x402.summary())
  # {'calls': 1, 'spent_usd': 0.01, 'remaining_usd': 4.99}
  ```
</CodeGroup>

The returned object is a full CabalSpy client, the same as in the [SDKs](/sdks). Only the payment differs.

## Spend limits

A funded wallet handed to an autonomous agent is a standing authorisation to spend. Both limits are on unless you turn them off.

| Limit | Default | Effect |
| - | - | - |
| Per call | \$0.10 | Refuses any single call priced above it |
| Total | \$10.00 | Refuses further calls once reached |

The price is read from the 402 response and checked before the wallet signs anything. A server asking for more than expected is refused without spending.

## Payment networks

CabalSpy accepts USDC on Solana, Base, Polygon and Arbitrum and offers all of them in the same response. The payment chain is independent of the data: a question about a Base wallet can be paid for in Solana USDC.

To test without real money, restrict the client to `solana-devnet`. The flow is identical.

## Source

<CardGroup cols={2}>
  <Card title="cabalspy-x402 (TypeScript)" icon="github" href="https://github.com/CabalSpy/cabalspy-x402">
    npm package and source.
  </Card>

  <Card title="cabalspy-x402 (Python)" icon="github" href="https://github.com/CabalSpy/cabalspy-x402-python">
    PyPI package and source.
  </Card>
</CardGroup>

Prefer a monthly plan with predictable cost? Use an [API key](/api-key) instead. Both return the same data.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.