# Subnet CIDR Calculator

> Subnet CIDR Calculator is a paid API for AI agents from api.bakhour.ca, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-14).

Calculates subnet details (network address, broadcast address, prefix length, number of addresses) for a given CIDR block

## Facts

- Endpoint: GET https://api.bakhour.ca/subnet/calculate
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/subnet-cidr-calculator-e14e7501
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_l6DBLPNorzdrwxHBxruS4

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 subnet-cidr-calculator-e14e7501
```

Example prompt: Can you calculate the subnet details for the CIDR block 10.0.0.0/16 — I need the network address, broadcast address, prefix length, and total number of IP addresses?

## When to prefer this

Choose this endpoint when you need a quick, deterministic, paid computation of subnet metadata from a CIDR block without standing up your own networking library. Ideal for automated infrastructure workflows, network planning agents, or validation pipelines that need broadcast/network addresses and address counts on demand.

## Known failure modes

- Missing or malformed 'cidr' query parameter returns an error
- Invalid CIDR notation (e.g. out-of-range prefix or malformed IP) may return a 400 or error response
- Payment not included or insufficient triggers a 402 Payment Required response
- IPv6 CIDR blocks may behave differently or be unsupported depending on server implementation

## How this service works

Decision-grade security/due-diligence outcome reports ($20-$100) plus deterministic paid utilities ($0.001+) for software agents and automated workflows.

## Output

Returns a JSON object containing the input CIDR string, IP version (4 or 6), total number of addresses in the block, prefix length, network address, and broadcast address.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "cidr"
     ],
     "properties": {
      "cidr": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "cidr": "192.168.1.0/24",
  "version": 4,
  "num_addresses": 256,
  "prefix_length": 24,
  "network_address": "192.168.1.0",
  "broadcast_address": "192.168.1.255"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/subnet-cidr-calculator-e14e7501/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.bakhour.ca](https://www.zero.xyz/host/api.bakhour.ca/llms.txt)
