# Flow Best-Execution Swap Quote

> Flow Best-Execution Swap Quote is a paid API for AI agents from flow-kg4x.vercel.app, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-16).

Returns the best-execution swap quote on Base by comparing Uniswap V3, PancakeSwap V3, and Aerodrome across fee tiers and two-hop routes via WETH

## Facts

- Endpoint: POST https://flow-kg4x.vercel.app/api/quote?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/flow-best-execution-swap-quote-49e393cb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_RbFdSc9kusCSYpxyZMZMl

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 flow-best-execution-swap-quote-49e393cb -d '<json body>'
```

Example prompt: Before I swap 500 USDC to ETH on Base, get me a best-execution quote that compares Uniswap V3, PancakeSwap V3, and Aerodrome including two-hop routes — I want to know which venue wins, how much ETH I'd get, and how long the price is good for.

## When to prefer this

Choose this endpoint when an AI agent is operating on the Base blockchain and needs to determine the optimal DEX venue before executing a token swap. It is superior to querying individual DEX APIs because it aggregates Uniswap V3, PancakeSwap V3, and Aerodrome in a single call, considers multiple fee tiers, and includes two-hop routing via WETH. Use it as a pre-trade check to minimize slippage and maximize output. Prefer it over on-chain simulation when you need a fast, off-chain best-execution signal with a clear expiry window and a quantified edge metric versus a Uniswap baseline.

## Known failure modes

- Unsupported token pair — returns error if no liquidity path exists across any compared venue
- Stale block data — quote may expire before agent can act if network is congested
- Invalid input schema — missing required body fields causes 400-level error
- Insufficient liquidity — large swap sizes may return degraded or no quote if pool depth is too low
- Payment failure — x402 micropayment of $0.01 USDC must succeed or request is rejected

## How this service works

Use when an agent is about to swap on Base and needs the best executable price before committing funds. Flow best-execution quotes: compares Uniswap V3 and Aerodrome across fee tiers and returns the best venue, expected output, edge vs Uniswap baseline, block number, and an expiry window so the agent knows exactly how long the price holds.

## Output

Returns a JSON object containing: the winning venue name (e.g. 'aerodrome', 'uniswap_v3', 'pancakeswap_v3'), the best expected output amount in token units, the edge in basis points over the Uniswap V3 baseline, the protocol fee (25% of price improvement), the block number the quote was computed at, and an expiry window indicating how long the quote remains valid.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object"
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "POST",
      "PUT",
      "PATCH"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "venue": "aerodrome",
  "bestOut": "396812",
  "edgeBps": 12,
  "protocolFee": "25% of price improvement over Uniswap baseline"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/flow-best-execution-swap-quote-49e393cb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from flow-kg4x.vercel.app](https://www.zero.xyz/host/flow-kg4x.vercel.app/llms.txt)
