# IP and CIDR Calculator (`ip.cidr`)

Compute network, netmask, broadcast, host range and address count for an IPv4 or IPv6 address or CIDR block, and classify it as public, private or reserved.

- **Route:** `POST /v1/run/ip.cidr`
- **Price:** $0.0002 per request ($0.20 per 1,000) · `cost_usd` on every response
- **Source:** GetAllAPIs compute (`compute`) · failover: no
- **Measured latency:** p50 0 ms · p95 0 ms · p99 0 ms (1 calls, 30d)
- **Heavy response:** no

## Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `cidr` | string | yes |  | IP address or CIDR block |

## Output (`output` in the run envelope)

| Field | Meaning |
|---|---|
| `network` | Network address. |
| `cidr` | Normalised CIDR. |
| `netmask` | Netmask (IPv4). |
| `broadcast` | Broadcast address (IPv4). |
| `first_host` | First usable address. |
| `last_host` | Last usable address. |
| `total_addresses` | Addresses in the block (string, can exceed 2^53). |
| `scope` | public, private, loopback, link-local, documentation... |

## Example

```bash
curl -s -X POST https://getallapis.com/v1/run/ip.cidr \
  -H "Authorization: Bearer $GETALLAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cidr":"192.168.10.77/22"}'
```

```python
from getallapis_client import Client
client = Client()  # reads GETALLAPIS_API_KEY
result = client.run('ip.cidr', {'cidr': '192.168.10.77/22'})
print(result['cost_usd'], result['output'])
```

```bash
getallapis run ip.cidr '{"cidr":"192.168.10.77/22"}'
```

Quote first (free, validates input): `POST /v1/quote/ip.cidr` with the same body.
