# MEV Sandwich Loss Upper Bound

> MEV Sandwich Loss Upper Bound is a paid API for AI agents from api.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Computes a deterministic upper-bound price impact loss for a CPMM trade given trade size and pool reserves, without any blockchain or mempool access.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/mev-sandwich-upper
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/mev-sandwich-loss-upper-bound-b8127f31
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_rvkL9vVbB0_JCaKdly4oo

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 mev-sandwich-loss-upper-bound-b8127f31 -d '<json body>'
```

Example prompt: Estimate the worst-case MEV sandwich loss for a trade of 500 tokens into a pool with 100,000 reserve_in and 200,000 reserve_out — give me the impact fraction and notional loss.

## When to prefer this

Choose this endpoint when you need a fast, deterministic, advisory upper-bound on MEV sandwich loss for a CPMM trade and have no access to mempool data or live market feeds. It is ideal for pre-trade risk checks in automated agents, parameter validation in DeFi bots, or stress-testing reserve assumptions — without requiring RPC calls, API keys, or any external infrastructure.

## Known failure modes

- Missing required fields (amount_in, reserve_in, reserve_out) return a validation error
- Zero or negative reserve values may cause division-by-zero or undefined behavior
- Extremely large trade sizes relative to reserves may return impact_fraction near or equal to 1
- Payment failure via x402 protocol returns 402 before computation occurs

## How this service works

Upper-bound CPMM price impact loss for size vs reserves. Call when pre-trade MEV/slippage stress without mempool access. Returns impact_fraction and loss_notional as deterministic JSON for $0.001 USDC via x402 on Base. First-party local math only—no RPC, live market feed, API keys, storage, or mediagen. Advisory only; the caller owns capital, risk, and production controls.

## Output

Returns a deterministic JSON object containing impact_fraction (the fraction of trade value lost to price impact) and loss_notional (the absolute notional loss in input asset units), computed purely from local CPMM math with no external data sources.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "amount_in": {
   "type": "number",
   "description": "Trade size in input asset units"
  },
  "reserve_in": {
   "type": "number",
   "description": "Pool reserve of input asset"
  },
  "reserve_out": {
   "type": "number",
   "description": "Pool reserve of output asset"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "schema": "delx/util-mev-sandwich-upper/v1",
  "loss_notional": 0.990099009900991,
  "impact_fraction": 0.00990099009900991
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/mev-sandwich-loss-upper-bound-b8127f31/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.delx.ai](https://www.zero.xyz/host/api.delx.ai/llms.txt)
