# WritersLogic CIDR Math

> WritersLogic CIDR Math is a paid API for AI agents from agents.writerslogic.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-11-19).

Computes exact CIDR relationships, merges, subtractions, and address membership for up to 200 IPv4/IPv6 blocks

## Facts

- Endpoint: POST https://agents.writerslogic.com/api/v1/cidr-math?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/writerslogic-cidr-math-ec468e17
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_71ypyKVBedd2VunO-UoWK

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 writerslogic-cidr-math-ec468e17 -d '<json body>'
```

Example prompt: Can you check whether these IP ranges overlap or nest: 10.0.0.0/8, 10.128.0.0/9, and 192.168.0.0/16? Use the 'relations' operation and tell me which pairs are equal, nested, overlapping, adjacent, or disjoint.

## When to prefer this

Choose this endpoint when an AI agent needs precise, deterministic CIDR arithmetic — overlap detection, merge/dedup, subtraction, or membership checks — without needing hostname resolution, ownership lookup, BGP routing data, or geolocation. It is the right tool for firewall rule planning, VPN split-tunnel configuration, cloud security group validation, and network provisioning pre-checks where mathematical correctness of IP block relationships matters.

## Known failure modes

- Invalid CIDR notation returns a parse error for the offending block
- Host bits set in a CIDR is flagged as an error in 'inspect' mode but may still be processed
- More than 200 ranges or 500 addresses exceeds the limit and returns a validation error
- 'subtract' called without an 'exclude' array returns an error
- 'contains' called when not every address is covered returns an error per the schema constraint
- IPv4-mapped IPv6 addresses (::ffff:a.b.c.d) are treated as IPv6 unless normalizeMapped is true, which may produce unexpected family mismatches
- IPv6 zone IDs are not interpreted and will likely cause a parse error

## How this service works

Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.

## Output

A JSON object whose structure depends on the operation: 'inspect' returns normalized form, first/last address, host count, and any host-bits-set errors per range; 'relations' returns a pairwise matrix of equal/contains/overlap/adjacent/disjoint for every pair; 'merge' returns the minimal list of CIDRs covering the union; 'subtract' returns the ranges remaining after removing the exclusions; 'contains' returns, for each address, the matching ranges ordered by specificity (most specific first).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "op": {
   "enum": [
    "inspect",
    "relations",
    "merge",
    "subtract",
    "contains"
   ],
   "type": "string",
   "description": "inspect: normalize each range and flag host bits set. relations: pairwise equal/contains/overlap/adjacent/disjoint (pass only when no two ranges intersect). merge: minimal CIDR cover of the union. subtract: ranges minus exclude. contains: which ranges contain each address (pass only when every address is covered)."
  },
  "ranges": {
   "type": "array",
   "items": {
    "type": "string",
    "maxLength": 100
   },
   "maxItems": 200,
   "minItems": 1,
   "description": "CIDR (10.0.0.0/8, 2001:db8::/32), a bare address (a /32 or /128), or an inclusive range 10.0.0.1-10.0.0.9."
  },
  "exclude": {
   "type": "array",
   "items": {
    "type": "string",
    "maxLength": 100
   },
   "maxItems": 200,
   "description": "Only for op=subtract."
  },
  "addresses": {
   "type": "array",
   "items": {
    "type": "string",
    "maxLength": 64
   },
   "maxItems": 500,
   "description": "Only for op=contains."
  },
  "normalizeMapped": {
   "type": "boolean",
   "description": "Treat ::ffff:a.b.c.d (and prefixes of 96 bits or longer inside ::ffff:0:0/96) as the IPv4 block a.b.c.d. Default false."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/writerslogic-cidr-math-ec468e17/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agents.writerslogic.com](https://www.zero.xyz/host/agents.writerslogic.com/llms.txt)
