← Subnet Calculator
Your token

Subnet Calculator API

Planning the subnets, the free check and every export run free in the browser and need no API. The API is for the one metered step: send a subnet plan with its facts, get back a review as JSON: a verdict, findings with fixes, and tier resize suggestions.

A run is metered, so it needs a personal token from a signed-in account. A guest token can call /me and /estimate but not /run.

Base URL: https://api.skillsafe.ai/v1/app-api. Every response is {"data": ...} or {"error": {"code", "message"}}; read error.code and error.message rather than the HTTP status alone.

The task field

This app has one task. Always send "task": "review".

taskWhat it doesReply
reviewReviews an IPv4 subnet plan against production multi-zone VPC practice for the chosen cloud: tier sizes against the workload, zone spread, NAT layout and cost, routing between tiers and room to grow. Answers every free-check finding, as a finding or as kept. Never writes new address ranges: resize suggestions are tier and prefix only, and the page re-plans them itself.One ```json block

Input fields

FieldTypeMeaning
taskstring"review"
networkstringThe whole IPv4 range in CIDR form, e.g. 10.0.0.0/16.
cloudstringOne of aws, azure, gcp, plain.
layoutstringtiers2 (public + private), tiers3 (public + private + database), private, equal or hosts.
zonesintegerAvailability zones, 1 to 6.
natstringzone (one NAT gateway per zone), one, none or n/a.
workloadstringOptional, up to 400 characters: what will run in the network, e.g. "EKS cluster with about 600 pods".
planstringThe subnet table as text: a header line name | tier | zone | cidr | usable, then one line per subnet, at most 64 lines.
factsstringJSON text: checks (the free check's findings, each {id, kind, severity, subject}), addresses, subnet_count, used_percent, free (unused CIDRs), tiers (per tier {count, prefix, usable_each, usable_total}), reserved_per_subnet, smallest_subnet_prefix, nat_gateways, nat_monthly_usd_each, avoid (CIDRs to stay clear of). Send it as a string, not an object.
clipped_notestringEmpty, or a sentence saying the plan table was shortened.

The reply

job.output.output is text: one ```json block holding {"task", "verdict", "summary", "findings", "resize", "kept", "notes"}. verdict is fits, tight or rework; summary is at most 40 words. findings holds at most 8 items, each {severity, about, check, issue, fix}: severity is high, medium or low; about is a tier or subnet name, or network, nat, zones, routing or all; check is a facts.checks id or "". resize (tiered layouts only) lists {tier, prefix, why} with prefix a number. kept lists checks left as they are, each {check, reason}. notes holds at most 3 strings. Every check id appears exactly once, in findings[].check or in kept. The reply never writes address ranges; apply a resize by re-planning on the page. If the balance ran low, truncated is true and the JSON may stop early.

Worked example

Input (input.json), the page's 10.0.0.0/16 sample:

{
  "task": "review",
  "network": "10.0.0.0/16",
  "cloud": "aws",
  "layout": "tiers2",
  "zones": 3,
  "nat": "zone",
  "workload": "EKS cluster with about 600 pods today, an RDS Postgres database and two load balancers",
  "plan": "name | tier | zone | cidr | usable\nmain-public-a | public | a | 10.0.48.0/21 | 2043\nmain-public-b | public | b | 10.0.56.0/21 | 2043\nmain-public-c | public | c | 10.0.64.0/21 | 2043\nmain-private-a | private | a | 10.0.0.0/20 | 4091\nmain-private-b | private | b | 10.0.16.0/20 | 4091\nmain-private-c | private | c | 10.0.32.0/20 | 4091",
  "facts": "{\"checks\":[],\"addresses\":65536,\"subnet_count\":6,\"used_percent\":28.1,\"free\":[\"10.0.72.0/21\",\"10.0.80.0/20\",\"10.0.96.0/19\",\"10.0.128.0/17\"],\"tiers\":{\"public\":{\"count\":3,\"prefix\":21,\"usable_each\":2043,\"usable_total\":6129},\"private\":{\"count\":3,\"prefix\":20,\"usable_each\":4091,\"usable_total\":12273}},\"reserved_per_subnet\":5,\"smallest_subnet_prefix\":28,\"nat_gateways\":3,\"nat_monthly_usd_each\":36.5,\"avoid\":[]}",
  "clipped_note": ""
}

Reply:

```json
{
  "task": "review",
  "verdict": "fits",
  "summary": "Six subnets across three zones fit the EKS cluster with room to grow: 12,273 private addresses for about 600 pods, and 72 percent of the /16 still free. The public tier is larger than two load balancers need.",
  "findings": [
    {
      "severity": "medium",
      "about": "private",
      "check": "",
      "issue": "With the default VPC CNI every EKS pod takes a private address, so 600 pods plus nodes use about 5 percent of the private tier now but grow with every node added.",
      "fix": "Keep the /20 private subnets for pods and nodes; turn on prefix delegation if pod density per node rises."
    },
    {
      "severity": "low",
      "about": "public",
      "check": "",
      "issue": "Each public /21 holds 2,043 addresses, but the public tier only carries two load balancers and the NAT gateways.",
      "fix": "Shrink the public subnets to /24 and leave the space free for later tiers."
    },
    {
      "severity": "low",
      "about": "nat",
      "check": "",
      "issue": "Three NAT gateways cost about $109.50 a month before data processing.",
      "fix": "Keep one per zone for production so a zone outage does not cut egress for the other two."
    },
    {
      "severity": "low",
      "about": "routing",
      "check": "",
      "issue": "The RDS database shares the private subnets with the pods, so only security groups separate them.",
      "fix": "Use a DB subnet group over the three private subnets and allow port 5432 only from the node security group, or switch to the three-tier layout."
    }
  ],
  "resize": [
    {
      "tier": "public",
      "prefix": 24,
      "why": "251 usable addresses per zone is ample for two load balancers and one NAT gateway each."
    }
  ],
  "kept": [],
  "notes": [
    "Leave 10.0.128.0/17 unallocated for a second cluster or a peered VPC.",
    "Tag the public subnets kubernetes.io/role/elb and the private ones kubernetes.io/role/internal-elb so load balancers land in the right tier."
  ]
}
```

Enter the network on the page to plan the subnets, run the free check and export the table, then ask for the review.

Errors

HTTPWhat to do
401The token is missing, expired or a guest token on a run. Get a personal token on the token page.
402The balance is below what the run reserves. Top up at skillsafe.ai/account/billing.
400The body is not a JSON object of the fields above.
429Wait and retry with the same Idempotency-Key.

Step 1 — a tiny client helper

One function that sends JSON and unwraps the {data, error} envelope.

BASE="https://api.skillsafe.ai/v1/app-api"
TOKEN="paste-your-token-here"   # from https://subnet-calculator.skillsafe.ai/tokens.html
api() { # api METHOD PATH [JSON-BODY]
  curl -s -X "$1" "$BASE$2" -H "Content-Type: application/json" \
    ${TOKEN:+-H "Authorization: Bearer $TOKEN"} ${3:+--data "$3"}
}

Step 2 — a token

A guest token is enough for /me and /estimate. A run is metered, so it needs your personal token: sign in on the token page and copy it.

# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN=$(curl -s -X POST "$BASE/guest" -H "Content-Type: application/json" -d '{"slug":"subnet-calculator"}' | jq -r '.data.token')

Step 3 — who am I, and my balance

subject_type is guest or user; credits is the balance (1 credit = $0.0001).

api GET /me | jq '.data | {subject_type, credits}' 

Step 4 — price a run for free

/estimate charges nothing and starts no job. hold_credits is the amount reserved while a run is in flight, not the price; the run is charged what it uses.

# input.json: the run input object - {"task": "review", "network": "10.0.0.0/16", "cloud": "aws", "layout": "tiers2", "zones": 3, "nat": "zone", "workload": "...", "plan": "...", "facts": "{...}", "clipped_note": ""}
api POST /estimate "$(cat input.json)" | jq '.data | {hold_credits, min_credits, model, model_alias, markup_bps, warnings}' 

Step 5 — run it and wait for the job

Send an Idempotency-Key derived from the input: a retry with the same key is never billed twice.

KEY="subnet-calculator:review:$(shasum -a 256 input.json | cut -c1-16):a1"
JOB=$(curl -s -X POST "$BASE/run" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: $KEY" --data @input.json | jq -r '.data.job_id')
while :; do
  J=$(api GET "/jobs/$JOB"); S=$(echo "$J" | jq -r '.data.status')
  case "$S" in succeeded|failed|cancelled) break;; esac; sleep 2
done
echo "$J" | jq -r '.data.output.output' > reply.txt   # one ```json block: {task, verdict, summary, findings, resize, kept, notes}
echo "$J" | jq '.data | {charged_credits, truncated}' 

Step 6 — or stream it

/run-stream sends Server-Sent Events while the job runs and the finished job at the end.

# Server-Sent Events: tick/delta events while the job runs, then a final event with the job
curl -N -s -X POST "$BASE/run-stream" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: subnet-calculator:review:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json