_                    _   ___
   /_\  __ _ ___ _ _  | |_/ __|_ __ ____ _ _ __
  / _ \/ _` / -_) ' \ |  _\__ \ V  V / _` | '_ \
 /_/ \_\__, \___|_||_| \__|___/\_/\_/\__,_| .__/
       |___/                               |_|

Optimal DEX routing for AI agents.
Sub-millisecond quotes across 60+ DEXes on Ethereum, Base, and Arbitrum.
CLI + REST API + native x402 payments. No API key required.
Launch App →

## Send to Your Agent
AgentSwap is a DEX aggregator API for on-chain token swaps.

Endpoint: https://api.agentswap.co
Payment: x402 protocol (auto, no API key needed)
Price: $0.0001 per quote

Quote: POST https://api.agentswap.co/quote
Body: {"chain_id":8453,"token_in":"USDC_ADDRESS","token_out":"WETH_ADDRESS","amount_in":"1000000000","amount_usd":1000}

Response includes: output amount, route path, calldata (ready for on-chain execution), gas estimate, price impact.

Supported chains: Ethereum (1), Base (8453), Arbitrum (42161)
Docs: https://agentswap.co/docs/api
## Quick Start
# 1. Install CLI
cargo install agentswap

# 2. Get a swap quote
agentswap quote -c base -f USDC -t WETH -a 1000

# 3. Buy API quota with any token
agentswap buy-quota -c base -t USDC -a 1         # pay with USDC
agentswap buy-quota -c base -t WETH -a 0.0004    # pay with WETH

# 4. REST API (direct HTTP)
curl -X POST https://api.agentswap.co/quote \
  -H "Content-Type: application/json" \
  -d '{"chain_id":8453,"token_in":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","token_out":"0x4200000000000000000000000000000000000006","amount_in":"1000000000","amount_usd":1000}'
## x402 Payment (zero setup)
# Any x402-compatible SDK works out of the box.
# No registration, no API key — just pay and query.

1) POST /quote
   → 402 + PAYMENT-REQUIRED header (base64 JSON)
   Contains: network, asset (USDC), amount, pay_to address

2) Agent signs EIP-3009 transferWithAuthorization (off-chain, gasless)

3) POST /quote + PAYMENT-SIGNATURE header (base64 payload)
   → 200 + quote response + PAYMENT-RESPONSE header

# Price: $0.0001 per quote (USDC)
# Networks: Base (eip155:8453), Arbitrum (eip155:42161)
# Discovery: GET /.well-known/x402
## Pay with Any Token
# Buy API quota on-chain using ANY ERC-20 token.
# Powered by AgentSwap's own routing — dog-fooding our swap engine.

agentswap buy-quota -c base -t WETH -a 0.0004
  → Swaps WETH to USDC via AgentSwap executor
  → Credits ~10,000 quotes to your API key
  → $0.0001 per quote

Contracts (QuotaPurchase):
  Base     : 0xac78e3bf6e3ed0dc2ee830773a2e6f0b8b740967
  Arbitrum : 0xd0066bbc592ac748ee8734c9771c138130e6b703

Accepts: USDC (direct), or any token with DEX liquidity (auto-swap).
Slippage protection: minUsdcOut parameter prevents sandwich attacks.
## Capabilities
ROUTING
  engine    : Dijkstra + Yen's k-shortest-paths
  split     : multi-route splitting for large orders
  fallback  : local (<1ms) → RPC hint (~50ms) → aggregator (1-3s)
  calldata  : ABI-encoded, ready for on-chain execution
  safety    : per-pool grading (A-F), 50% price impact circuit breaker

COVERAGE
  chains    : Ethereum (1), Base (8453), Arbitrum (42161)
  dexes     : 29 on Base, 20 on Arbitrum, 14 on Ethereum
  pools     : 15,000+ actively tracked and graded
  exotic    : Curve, Balancer, DODO, TraderJoe LB, Fluid, Maverick, WOOFi

INTEGRATION
  cli       : cargo install agentswap — 12 commands, --json flag
  api       : POST /quote, GET /health, GET /api/tokens, ...
  latency   : <1ms local quotes, <50ms with RPC verification

STANDARDS
  discovery : /.well-known/agent-registration.json (EIP-8004)
  payment   : x402 v2 (Coinbase spec) — zero setup
  x402      : /.well-known/x402 discovery, /x402/verify, /x402/settle
## CLI Commands
agentswap quote -c base -f USDC -t WETH -a 1000     # get quote
agentswap batch-quote -c base -a 1000 USDC/WETH    # multi-pair
agentswap buy-quota -c base -t WETH -a 0.0004     # buy quota (any token)
agentswap health                                    # service status
agentswap chains                                    # supported DEXes
agentswap tokens -c base                             # token list
agentswap pools -c base -a 0x...                   # inspect pool
agentswap pricing                                   # payment info
agentswap register --address 0x... --key-file k.txt # get API key
## API Endpoints
POST  /quote                    Swap quote (main endpoint)
GET   /health                   Health check
GET   /api/tokens               Token registry
GET   /api/pool/:chain/:addr    Pool info

x402 payment:
GET   /.well-known/x402         Payment discovery
POST  /x402/verify              Verify payment signature
POST  /x402/settle              Settle payment on-chain

API key auth (optional):
POST  /auth/challenge           EIP-191 challenge nonce
POST  /auth/register            Register API key
GET   /auth/pricing             Quota pricing
POST  /auth/quota/claim         Claim purchased quota
## Example Quote Response
{
  "output": "401234567890123456",
  "gas_estimate": "184000",
  "source": "local",
  "route_path": "USDC>[UniV3:500]>WETH",
  "price_impact_bps": 8,
  "pool_grades": ["A"],
  "calldata": "0x...",
  "to": "0x70eaD10dF02BF389Fd69bC07Afc45b1e5138A56E",
  "quote_hash": "0xabc123..."
}
## Supported DEXes
BASE (29):
  UniswapV2/V3/V4  AerodromeV2/Slipstream  PancakeswapV2/V3/InfinityCL
  SushiswapV3  BaseSwapV2/V3  AlienBaseV3  DackieSwap  SwapBased
  RocketSwap  HydrexIntegral  Curve/TwoCrypto  BalancerV2/V3
  TraderJoeLB  FluidDex  MaverickV2  WOOFi  SolidlyV3

ARBITRUM (20):
  UniswapV2/V3/V4  PancakeswapV3  SushiswapV3  CamelotV2/V3
  QuickSwapV4  Zyberswap  Curve/Tricrypto  BalancerV2  TraderJoeLB
  DODO  MaverickV2  MIM Swap  WOOFi  FluidDex  Swaap V2

ETHEREUM (14):
  UniswapV2/V3/V4  SushiswapV2/V3  PancakeswapV3  Curve/Tricrypto/TwoCrypto
  BalancerV2/V3  MaverickV2  WOOFi  FluidDex

Full DEX list with pool counts →