# Layer Profit Calculator — Kalshi & Polymarket

> Layer Profit Calculator — Kalshi & Polymarket is a paid API for AI agents from uselayer.sh, paid per call via x402, $0.01/call, status unknown (last checked 2026-11-19).

Calculates expected profit, fees, payout, and return percentage for a prediction market trade across Kalshi, Polymarket, or Polymarket US given a price and number of contracts.

## Facts

- Endpoint: POST https://uselayer.sh/v0/profit?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/layer-profit-calculator-kalshi-polymarket-af5bcd1c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_1Kb2tFIB22_YTWKH0wUzD

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 layer-profit-calculator-kalshi-polymarket-af5bcd1c -d '<json body>'
```

Example prompt: If I buy 50 contracts on Kalshi at a price of 0.97, what would my net profit, fees, payout, and return percentage be for that trade?

## When to prefer this

Use this endpoint when you need to evaluate the financial merit of a specific prediction market trade before placing an order — particularly when you want to account for venue-specific fee structures on Kalshi, Polymarket, or Polymarket US. Prefer this over manually estimating returns, especially when comparing venues or when fee rates materially impact profitability.

## Known failure modes

- Missing required price field for the specified venue returns a validation error
- Invalid or negative contract count may produce unexpected results
- Omitting both kalshi and polymarket objects may result in an error or empty response
- Price values outside 0–1 range (prediction market probability) may cause calculation errors
- Network or payment authorization failure returns 402 Payment Required

## How this service works

One API for prediction markets. Find markets, stream normalized data, place orders, and track positions across Kalshi and Polymarket.

## Output

Returns a JSON object with the total cost of the trade, fees charged, expected payout on a win, net profit after fees, a boolean indicating whether the trade is profitable, and the return percentage (e.g. {cost: 97, fees: 1.77, payout: 100, net_profit: 1.23, profitable: true, return_pct: 1.25}).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "kalshi": {
   "type": "object",
   "required": [
    "price"
   ],
   "properties": {
    "price": {
     "type": "number"
    },
    "market_id": {
     "type": "string"
    }
   }
  },
  "contracts": {
   "type": "integer"
  },
  "polymarket": {
   "type": "object",
   "properties": {
    "price": {
     "type": "number"
    },
    "category": {
     "type": "string"
    },
    "fee_rate": {
     "type": "number"
    }
   }
  },
  "polymarket_us": {
   "type": "object",
   "properties": {
    "price": {
     "type": "number"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "cost": 97,
  "fees": 1.77,
  "payout": 100,
  "net_profit": 1.23,
  "profitable": true,
  "return_pct": 1.25
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/layer-profit-calculator-kalshi-polymarket-af5bcd1c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from uselayer.sh](https://www.zero.xyz/host/uselayer.sh/llms.txt)
