# Delx Commerce — Order Book Mid Price Calculator

> Delx Commerce — Order Book Mid Price 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).

Computes the mid price, absolute spread, and spread in basis points from a best bid and best ask price pair

## Facts

- Endpoint: POST https://commerce.delx.ai/api/v1/x402/ob-mid-from-levels?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-order-book-mid-price-calculator-ffb34f54
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_kvoRhMpQrIvSEgeMzEsVW

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-order-book-mid-price-calculator-ffb34f54 -d '<json body>'
```

Example prompt: Calculate the mid price and spread for a market where the best bid is 100 and the best ask is 100.2.

## When to prefer this

Use this endpoint when you need a fast, cheap, verifiable micro-computation of mid price and spread metrics from raw top-of-book bid/ask levels without setting up any infrastructure or account. It is ideal for AI agents that handle order book data on a per-call basis and want pay-per-result pricing in USDC with no subscription overhead. Prefer it over building your own arithmetic when you need a standardized, schema-versioned output that can be audited downstream.

## Known failure modes

- Missing bid or ask field returns a validation error
- Non-numeric values for bid or ask cause a parsing error
- Ask price lower than bid price may produce a negative spread but does not error
- Payment failure via x402 returns HTTP 402 before computation occurs

## 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 containing the echo of ask and bid inputs, the computed mid price (arithmetic mean of bid and ask), the absolute spread (ask minus bid), and the spread in basis points (spread relative to mid price), all under the schema identifier delx/util-ob-mid-from-levels/v1.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "ask": {
   "type": "number",
   "description": "Best ask price (top of book)"
  },
  "bid": {
   "type": "number",
   "description": "Best bid price (top of book)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ask": 100.2,
  "bid": 100,
  "mid": 100.1,
  "schema": "delx/util-ob-mid-from-levels/v1",
  "spread_abs": 0.2000000000000028,
  "spread_bps": 19.98001998002027
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/delx-commerce-order-book-mid-price-calculator-ffb34f54/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)
