# Delx Commerce AMM Output Given Input Calculator

> Delx Commerce AMM Output Given Input Calculator is a paid API for AI agents from commerce.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-01).

Calculates the output token amount for a given input amount in a constant-product AMM (automated market maker) swap, accounting for a specified fee

## Facts

- Endpoint: POST https://commerce.delx.ai/api/v1/x402/amm-out-given-in?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-01
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/delx-commerce-amm-output-given-input-calculator-671fea01
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_DcVpH0qaF_1gclkFE9ZGV

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 delx-commerce-amm-output-given-input-calculator-671fea01 -d '<json body>'
```

Example prompt: Using the AMM out-given-in formula, calculate how many tokens I'd receive if I put in 1000 units, with a pool reserve_in of 500000, reserve_out of 800000, and a fee of 30 basis points.

## When to prefer this

Use this endpoint when you need a fast, verifiable, pay-per-use computation of AMM swap output without integrating a full DEX SDK or running your own smart contract simulation. Ideal for AI agents that need on-demand DeFi pricing math without signup, API keys, or subscription costs — especially when operating on Base or Solana with USDC via the x402 protocol.

## Known failure modes

- Missing required fields (amount_in, reserve_in, reserve_out, fee_bps) returns an error
- Zero or negative reserve values may cause division errors or invalid results
- Integer overflow for very large reserve or amount values
- Payment failure via x402 protocol (insufficient USDC balance) blocks the call

## How this service works

Pay-per-result APIs for agents. No signup. Exact price. Verifiable delivery. USDC on Base + Solana via x402.

## Output

Returns a JSON object with the schema identifier ('delx/util-amm-out-given-in/v1'), the input fee_bps and amount_in echoed back, and the computed amount_out representing how many output tokens the trader would receive after fees using the constant-product (x*y=k) formula.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "fee_bps": {
   "type": "integer",
   "description": "Input field: fee bps."
  },
  "amount_in": {
   "type": "integer",
   "description": "Input field: amount in."
  },
  "reserve_in": {
   "type": "integer",
   "description": "Input field: reserve in."
  },
  "reserve_out": {
   "type": "integer",
   "description": "Input field: reserve out."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "schema": "delx/util-amm-out-given-in/v1",
  "fee_bps": 30,
  "amount_in": 10,
  "amount_out": 9.871580343970614
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/delx-commerce-amm-output-given-input-calculator-671fea01/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from commerce.delx.ai](https://www.zero.xyz/host/commerce.delx.ai/llms.txt)
