0x API for Agents: 0x Skills

Agents can now access aggregated DEX liquidity across 20+ chains.

April 13, 2026

Feature Release

An agent needs to swap USDC for ETH before depositing into a liquidity pool. A different agent needs to convert a long-tail token to a stablecoin to settle a payment. Both need integration code for token approvals, price quotes, transaction submission, error handling, and safety checks. That work gets repeated for each swap flow and adjusted for each chain.

0x AI is an open-source skill that handles this once. Agents get a standard workflow that fits any swap situation across the 0x Swap (AllowanceHolder and Permit2) and Gasless APIs on 20+ EVM chains.

How to install

Install the skill and MCP server from the repository:

npx skills add 0xProject/0x-ai

0x AI is compatible with 45+ leading AI coding agents, including Claude Code, Cursor, GitHub Copilot, Cline, Codex, Gemini CLI, and Warp. Once installed, invoke in any session with /0x-api.

What it looks like

The agent starts by gathering swap details:

Once it has the required context, it generates working integration code for the target chain, including approvals, quotes, transaction submission, and error handling. Here's what the agent produces for a USDC to ETH swap on Base:

const params = new URLSearchParams({
  chainId: "8453",
  sellToken: "0x833...", // USDC on Base
  buyToken: "0xEee...",  // ETH
  sellAmount: "100000000", // 100 USDC
  taker: "0xYourWalletAddress",
});

const res = await fetch(
  `https://api.0x.org/swap/allowance-holder/quote?${params}`,
  {
    headers: {
      "0x-api-key": process.env.ZERO_EX_API_KEY!,
      "0x-version": "v2",
    },
  }
);
const quote = await res.json();


The agent also handles what comes before and after this call. For example, it checks if liquidity is available for the requested quote, sets the token allowance on the correct contract, and verifies the taker has sufficient balance. It submits the transaction with the right gas parameters, and if something fails, maps the error to a fix using the skill's built-in error handling guide.

How the skill works

The skill covers three swap flows: AllowanceHolder (the default, a simple approve-and-send that works with multisigs), Permit2 (time-limited approvals with EIP-712 signing), and Gasless (no native token needed, gas deducted from sell tokens). It tells the agent when to use each flow and how to walk through execution step by step.

0x AI ships with an MCP server connection to docs.0x.org. When the agent encounters an unfamiliar token address, a new chain, or an error code, it queries the documentation in real time rather than relying on training data. Safety rules are also encoded directly in the skill: never approve the Settler contract, always read the spender from the API response, check that liquidity is available and the taker has sufficient balance, and submit quotes within the ~30-second expiration window.

Use cases

Autonomous trading agents: An agent with a wallet calls the 0x API to execute swaps across any supported chain, tapping into 373+ onchain exchanges plus offchain RFQ market makers for the best available execution on any token pair.

Agent-built swap integrations: A developer tells their coding agent to add swaps to an app. The agent scaffolds the full integration using the correct endpoints and parameters for the target chain: price check, approval, quote, submission.

Gasless onboarding: An agent building a consumer app uses the Gasless API to implement swaps where end users never pay gas. The skill handles the Permit2 approval flow and the submit-then-poll execution model.

What to know

The skill covers all chains supported by the 0x Swap and Gasless APIs; see the full chain list.

This release covers the Swap and Gasless APIs. Cross-Chain API support is planned separately.

Developers building autonomous agents retain full control over execution parameters. Slippage tolerance, supported chains, permitted token pairs, and fee collection settings are all set at the API call level, not by the skill.

An 0x API key is required and available from the dashboard at no cost.

API Documentation · GitHub · Get an API Key

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.