{"uid":"cap_71ypyKVBedd2VunO-UoWK","slug":"writerslogic-cidr-math-ec468e17","name":"WritersLogic CIDR Math","description":"Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.","url":"https://agents.writerslogic.com/api/v1/cidr-math?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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."}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_kKZiHtq-ElYo4VYJK4yyg","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes exact CIDR relationships, merges, subtractions, and address membership for up to 200 IPv4/IPv6 blocks","exampleAgentPrompt":"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.","exampleUseCases":[{"title":"Firewall allow-list deduplication","prompt":"I have a messy list of IP ranges for our firewall allow-list — 10.0.0.0/24, 10.0.1.0/24, 10.0.2.0/24, 172.16.0.0/12, 192.168.0.0/16. Can you merge them into the minimal set of CIDRs that covers the same address space?"},{"title":"Subnet exclusion for VPN split-tunneling","prompt":"I need to route everything in 10.0.0.0/8 except 10.100.0.0/16 and 10.200.0.0/16 through the VPN. Can you subtract those two exclusions from 10.0.0.0/8 and give me the resulting CIDR list?"},{"title":"Validate CIDRs before provisioning","prompt":"Before I push these network blocks to our cloud provisioner, can you inspect each one — 192.168.1.5/24, 10.0.3.128/25, 2001:db8::/33 — and flag any that have host bits set or other errors?"}],"resultDescription":"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).","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-19T00:32:27.983Z","isFirstParty":false,"canonicalSlug":"writerslogic-cidr-math-ec468e17"}