# Order Book Mid From Levels

> Order Book Mid From Levels 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 mid price, absolute spread, and spread in basis points from L1 bid and ask prices using deterministic local math.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/ob-mid-from-levels
- 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/order-book-mid-from-levels-6f0c8e34
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_pj26bo40q5ZJUAM8Hz0Y-

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 order-book-mid-from-levels-6f0c8e34 -d '<json body>'
```

Example prompt: What's the mid price, absolute spread, and spread in basis points for a market where the best bid is 42150.50 and the best ask is 42153.00?

## When to prefer this

Choose this endpoint when you already have L1 top-of-book bid and ask prices and need a deterministic, local-math mid price and spread calculation with no API keys, no live market feed, and no external dependencies. Ideal for agents that need a fast, cheap, reproducible mark or reference price for risk, settlement, or display purposes without making additional market data calls.

## Known failure modes

- Missing bid or ask field returns a validation error
- Ask price lower than bid price (crossed book) may return unexpected or flagged results
- Non-numeric input values cause schema validation failure
- Payment failure via x402 prevents endpoint from executing

## How this service works

Compute mid price from bid/ask top-of-book levels. Call when you have L1 bid and ask and need a mid for marks. Returns mid, spread_abs, and spread_bps 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 JSON object with three fields: mid (the arithmetic midpoint between bid and ask), spread_abs (the absolute difference between ask and bid), and spread_bps (the spread expressed in basis points relative to the mid). All values are deterministically computed with no external data sources.

## 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/order-book-mid-from-levels-6f0c8e34/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)
