← K8s Manifest Generator
Your token

K8s Manifest Generator API

Building the YAML from an image or a docker run command, the checks, the folder download and the kubectl commands run free in the browser and need no API. The API is for the one metered step: send the image, the current settings and an optional description of the app, and get back, as JSON, setting changes with a reason each, missing settings and secret names, writable folders and notes. The page checks every value with the same rules as its form and applies only what passes.

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": "tailor".

taskWhat it doesReply
tailorReads the image, the settings, the open warnings and your description, and suggests changes to named settings (memory, CPU, health check, replicas, web address, autoscaling, volume, security), missing non-secret settings, missing secret names, writable folders and up to three notes. It never writes YAML and never sees or returns a secret value.One JSON object

Input fields

FieldTypeMeaning
taskstring"tailor"
imagestringThe container image, e.g. "postgres:16.4".
aboutstringYour description of the app; may be empty. The page sends at most 1,500 characters, keeping the start and the end.
settingsstringJSON text of the settings: image, name, namespace, kind, replicas, port, service, probe, probe_path, cpu_request, cpu_limit, memory_request, memory_limit, ingress_host, ingress_tls, hpa, hpa_min, hpa_max, hpa_cpu, volume_size, volume_path, non_root, run_as_user, read_only_root, plus env (list of {name, value}), secrets (list of names), writable, command, args.
checksstringJSON text: a list of the open warnings, as sentences. Send "[]" if you have none.

The reply

job.output.output is text holding one JSON object (sometimes inside a ```json fence): changes (a list of {field, value, reason}, at most 12), add_env (a list of {name, value, reason}), add_secrets (a list of {name, reason}), add_writable (a list of {path, reason}) and notes (0 to 3 strings). Before applying a change, check the field is one of the settings above and the value passes its rule (a name, a CPU or memory amount, a range, a request at or below its limit): the page does all of this. If the balance ran low, truncated is true and the object may stop early; the page keeps every change that arrived whole.

Worked example

Input (input.json), a Postgres database:

{
  "task": "tailor",
  "image": "postgres:16.4",
  "about": "Main database for a small SaaS, about 20 GB of data today and growing. Only the API inside the cluster connects to it.",
  "settings": "{\"image\":\"postgres:16.4\",\"name\":\"postgres\",\"namespace\":\"\",\"kind\":\"StatefulSet\",\"replicas\":1,\"port\":5432,\"service\":\"ClusterIP\",\"probe\":\"tcp\",\"probe_path\":\"/\",\"cpu_request\":\"250m\",\"cpu_limit\":\"1\",\"memory_request\":\"512Mi\",\"memory_limit\":\"1Gi\",\"ingress_host\":\"\",\"ingress_tls\":true,\"hpa\":false,\"hpa_min\":2,\"hpa_max\":5,\"hpa_cpu\":70,\"volume_size\":\"10Gi\",\"volume_path\":\"/var/lib/postgresql/data\",\"non_root\":true,\"run_as_user\":999,\"read_only_root\":true,\"env\":[{\"name\":\"PGDATA\",\"value\":\"/var/lib/postgresql/data/pgdata\"}],\"secrets\":[\"POSTGRES_PASSWORD\"],\"writable\":[\"/var/run/postgresql\",\"/tmp\"],\"command\":[],\"args\":[]}",
  "checks": "[\"Secret values are REPLACE_ME placeholders. Fill them in, or create the secret with the kubectl command below and delete the Secret block.\"]"
}

Reply:

```json
{
  "changes": [
    {"field": "volume_size", "value": "50Gi", "reason": "The description says about 20 GB of data today and growing, so the current 10Gi volume would not even hold it."},
    {"field": "memory_limit", "value": "4Gi", "reason": "A 20 GB Postgres database needs room for shared buffers and page cache, and 1Gi is far too small."},
    {"field": "memory_request", "value": "2Gi", "reason": "Reserves enough memory for Postgres buffers and connections for a 20 GB main database."},
    {"field": "cpu_limit", "value": "2", "reason": "The main database for a SaaS API has query bursts that a 1 CPU limit would throttle."},
    {"field": "cpu_request", "value": "500m", "reason": "The primary database serves every API request, so it needs a larger guaranteed CPU share."}
  ],
  "add_env": [],
  "add_secrets": [],
  "add_writable": [],
  "notes": [
    "Replace the REPLACE_ME value for POSTGRES_PASSWORD with a real password before applying, or create the Secret yourself.",
    "This is the only copy of 20 GB of SaaS data on one pod, so schedule backups (for example pg_dump or WAL archiving) and test a restore."
  ]
}
```

On the page, this reply grows the volume to 50Gi and raises memory and CPU, each change within its limit, and the database stays a one-replica StatefulSet.

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://k8s-manifest-generator.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":"k8s-manifest-generator"}' | 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": "tailor", "image": "postgres:16.4", "about": "...", "settings": "{...}", "checks": "[]"}
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="k8s-manifest-generator:tailor:$(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.json   # one JSON object: changes, add_env, add_secrets, add_writable, 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: k8s-manifest-generator:tailor:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json