# gate402 Best Swap Execution Planner

> gate402 Best Swap Execution Planner is a paid API for AI agents from gate402.app, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-14).

Returns best-execution intelligence for a Base token trade: ranks DEX pools by estimated price impact and total cost for a given USD trade size, with a split suggestion.

## Facts

- Endpoint: POST https://gate402.app/v1/best-swap
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/gate402-best-swap-execution-planner-6b3a8620
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_QlR6VVIGUMjIozx6B0K_W

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability gate402-best-swap-execution-planner-6b3a8620 -d '<json body>'
```

Example prompt: Which DEX pool on Base gives me the best execution for buying $3000 worth of the token at address 0x4200000000000000000000000000000000000006, and what's the estimated price impact and split suggestion?

## When to prefer this

Use this endpoint when an agent needs to plan a token swap on Base and wants to minimize slippage or total cost — especially for larger trade sizes where pool depth and price impact matter. Prefer this over a simple price lookup when you need routing intelligence, split-trade suggestions, or a ranked comparison across multiple DEX pools before committing to execution.

## Known failure modes

- Invalid or non-ERC-20 contract address returns an error or empty pool list
- Token with no active liquidity pools returns no results
- Very large trade size relative to pool liquidity may produce extreme price impact estimates
- Network latency or DEX data feed issues may cause stale or unavailable pool data
- Non-Base-chain addresses will not return valid results

## How this service works

Best-execution intel for a Base token: which DEX pool to trade on and the estimated price impact + total cost for a given trade size, ranked across pools, with a split suggestion. Constant-product estimate for trading agents — the execution plan, not a firm quote.

## Output

A ranked list of DEX pools available for the specified Base token, each with estimated price impact and total cost for the given USD trade size, plus a suggested split-trade strategy to minimize market impact. Based on constant-product (AMM) math — an indicative execution plan, not a firm quote.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "address": {
   "type": "string",
   "description": "Base ERC-20 token contract address (0x-hex)."
  },
  "sizeUsd": {
   "type": "number",
   "description": "Trade size in USD (default 1000)."
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/gate402-best-swap-execution-planner-6b3a8620/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from gate402.app](https://www.zero.xyz/host/gate402.app/llms.txt)
