Autonomous Agent Payments

0x Swap API endpoints are now accessible via open payment standards x402 and MPP (Machine Payments Protocol) using the 0x AI Skill.

June 23, 2026

Feature Release

AI agents that need to call APIs autonomously face a credential management problem. API keys require human setup, secure storage, and rotation, which doesn’t fit an execution model where agents operate independently.

0x Swap API endpoints are now accessible via x402 and MPP (Machine Payments Protocol), two open standards for HTTP-native micropayments. Agents pay $0.01 per request in USDC, directly from their own wallet with no 0x API key required. Every request is cryptographically attributable via the agent's wallet address and an on-chain transaction hash.

→   Add the 0x AI Skill to your agent to get started.

How AI agents make payments

0x makes agentic payments straightforward. Both protocols follow the same HTTP-native payment flow:

  1. First, the agent sends a request to a 0x endpoint with no credentials.
  2. The server then returns 402 Payment Required, complete with machine-readable payment instructions.
  3. The agent will then sign a USDC payment and retry with a payment header.
  4. This time, the proxy verifies the payment on-chain, forwards to 0x, and returns swap data.

0x Swap API supports two leading payment protocols:

x402 is an open standard developed by Coinbase. It pays in USDC on Base (EVM) or USDC on Solana mainnet. For EVM payments, x402 uses an EIP-3009 transferWithAuthorization payload, while on Solana it works through a native Solana USDC transfer. This is the fastest path to set up payments for agents with an existing EVM or Solana wallet.

MPP (Machine Payments Protocol) was launched by the teams at Stripe and Tempo. It pays in USDC.e on Tempo Mainnet (chainId 4217). MPP operates with a challenge–credential–receipt pattern and is an ideal option for when your agent stack is already integrated with Tempo.

With 0x, the swap execution chain is dictated by the chainId parameter and is independent of the payment network. Any EVM chain supported by Swap API can be used.

Example payment flow

Below is an example x402 integration that uses Base as the payment network. The key differences from a standard 0x call is that wrapFetchWithPayment replaces the native fetch, the endpoint is agent.api.0x.org/v1/x402/, and no API key header is needed.

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { ExactEvmScheme, toClientEvmSigner } from "@x402/evm";
// ... wallet and publicClient setup (see docs for full example) ...

const core = new x402Client();
core.register("eip155:8453", new ExactEvmScheme(signer));

const x402Fetch = wrapFetchWithPayment(fetch, core);

const BASE = "https://agent.api.0x.org/v1/x402";
const params =
  "?chainId=8453" +
  "&sellToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" + // USDC on Base
  "&buyToken=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" + // ETH
  "&sellAmount=100000"; // 0.1 USDC

// Indicative price — no taker required
const price = await x402Fetch(`${BASE}/swap-allowance-holder-price/${params}`).then(r => r.json());

// Firm quote with transaction calldata
const quote = await x402Fetch(`${BASE}/swap-allowance-holder-quote/${params}&taker=${account.address}`).then(r => r.json());

After a successful request, the PAYMENT-RESPONSE header contains base64-encoded settlement data including the on-chain transaction hash, payment network, and payer address.

Get started with agentic payments

The fastest way to get set up with an agent that can make payments is to install the 0x-agentic-gateway skill (npx skills add 0xProject/0x-ai), then activate with /0x-agentic-gateway. This skill handles protocol selection, wallet setup, and code generation.

Key details to know when working with agentic payment protocols include:

  • x402: the agent wallet must hold USDC on Base for EVM payments, or native USDC on Solana mainnet for Solana payments. When paying via Solana, an EVM wallet is still required since swap execution runs on EVM.
  • MPP: requires USDC.e on Tempo Mainnet as payment, but swap execution will run on whatever EVM chain you specify via chainId.
  • The 0x API key is managed server-side by the payment proxy. Do not pass it from the client; payment is the credential.

Autonomous payment use cases

  • Trading agents: An agent with a funded wallet can execute swaps across any supported EVM chain autonomously, without a human-provisioned API key. Each request is independently attributable by wallet address and on-chain transaction hash.
  • Multi-agent pipelines: Each agent in a pipeline holds its own wallet and pays for its own API calls. No shared credentials, no rotation overhead, and per-agent billing by wallet address.
  • Agent-to-agent payment flows: An orchestrator agent delegates a swap task to a subagent. The subagent pays for API access from its own wallet; the on-chain payment record is the audit trail.
  • Developer tooling: A framework or SDK provisions agents with wallets instead of API keys. Users get a working swap integration without creating a 0x account or managing credentials.

See the Autonomous Agent Payments guide for the full API reference & examples, including complete wallet setup and MPP integration.

Start building for free by signing up through the 0x dashboard.

Contents

Subscribe to newsletter

By submitting you're confirming that you agree with our Terms and Conditions.
Yay! You’re signed up.
Oops! Something went wrong, but it's not your fault.