← Hamburger Menu Generator
Your token

Hamburger Menu Generator API

The menu, the preview, the check against the timing rules and every copy and download run free in the browser and need no API. The API is for the one metered step: send the current menu's settings and a description of the site, and get back, as JSON, advice for that site: keep or change, a summary, how the icon changes (style, time), how the menu opens (where from, time, curve, gap between links), how fast it closes, the animation principles at work and what to avoid. The page builds this input for you, checks the reply against the rules and draws the menu.

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

taskWhat it doesReply
adviseReads one menu's settings, the page's check and your description of the site, and returns keep or change, a summary, the icon (style, time), the opening (panel, time, curve, link stagger), the closing time, principles and things to avoid.One JSON object

Input fields

Every field is a string; page_check holds JSON text. task, links and description are required.

FieldMeaning
task"advise"
linksThe menu's links, one per line. The advice keeps them.
link_countHow many links the menu has.
brandThe site name beside the button.
iconx, spin, arrow or minus.
panelright, left, down or overlay.
morph_msHow long the icon takes to change.
open_msHow long the menu takes to open.
close_msHow long the menu takes to close (ease-in).
easingease-out, material, ease-in-out or linear.
stagger_msThe delay between one link appearing and the next ("0" = all at once).
button_pxThe button size. The advice keeps it.
header_colorHex colour of the header bar.
icon_colorHex colour of the icon.
menu_colorHex colour of the menu panel. The advice keeps every colour.
page_check{morph_target_ms, morph_range_ms, open_range_ms, close_range_ms, stagger_range_ms, last_link_start_ms, fully_open_ms, icon_contrast, brand_contrast, link_contrast, verdict, notes}, from the page.
descriptionWhat the site is, who opens the menu, how often and on which devices, and the brand's character (at most 1,200 characters).
clipped_noteEmpty, or a sentence saying the description was cut.

The reply

job.output.output is text holding one JSON object: verdict (keep or change), summary, icon ({style, ms, why}), open ({panel, ms, easing, stagger, why}), close ({ms, why}), principles ([{name, how}], names from the 12 principles of animation) and avoid. Before using it, check the values as the page does: an icon change near 300 ms (250-350), an opening of 200-250 ms on ease-out or material (never linear), a closing of 150-200 ms that is not slower than the opening, and links 20-40 ms apart (0 only when asked for). If the balance ran low, truncated is true and the object may stop early; the page keeps every part that arrived whole.

Worked example

Input (input.json), from the page's "Shop" example:

{
  "task": "advise",
  "links": "Home\nNew in\nWomen\nMen\nSale\nContact",
  "link_count": "6",
  "brand": "Linen Co",
  "icon": "x",
  "panel": "right",
  "morph_ms": "300",
  "open_ms": "250",
  "close_ms": "180",
  "easing": "ease-out",
  "stagger_ms": "30",
  "button_px": "48",
  "header_color": "#ffffff",
  "icon_color": "#111827",
  "menu_color": "#ffffff",
  "page_check": "{\"morph_target_ms\":300,\"morph_range_ms\":[250,350],\"open_range_ms\":[200,250],\"close_range_ms\":[150,200],\"stagger_range_ms\":[20,40],\"last_link_start_ms\":150,\"fully_open_ms\":400,\"icon_contrast\":17.74,\"brand_contrast\":17.74,\"link_contrast\":17.74,\"verdict\":\"good\",\"notes\":[]}",
  "description": "Main menu of a small clothing shop's website, mostly visited on phones from Instagram. Six links; people open it to jump to a category or the sale, then shop. Clean, calm brand.",
  "clipped_note": ""
}

Reply:

{"verdict":"keep","summary":"Keep the menu as it is: a calm right-hand drawer opening in 250 ms with a plain X, and links arriving 30 ms apart. Shoppers arriving from Instagram on phones open it once to reach a category or the sale, so it should feel quick and quiet rather than showy.","icon":{"style":"x","ms":300,"why":"A plain X reads as close everywhere and suits a clean, calm clothing shop."},"open":{"panel":"right","ms":250,"easing":"ease-out","stagger":30,"why":"A right drawer fits a phone menu with six links, and ease-out lets it settle gently while the six links follow 30 ms apart."},"close":{"ms":180,"why":"Closing a little quicker than opening gets shoppers back to the clothes without a wait."},"principles":[{"name":"Timing","how":"The 300 ms icon change, 250 ms opening and 180 ms closing keep a menu used for quick jumps to Women, Men or Sale feeling snappy."},{"name":"Follow Through & Overlapping Action","how":"Home, New in, Women, Men, Sale and Contact come in 30 ms apart so the short list feels lively without delaying the tap."},{"name":"Ease In & Ease Out","how":"The drawer eases out as it opens and eases in as it closes, which keeps the calm brand feel."},{"name":"Exaggeration","how":"No spin or full-screen entrance is used, because a clean, calm clothing shop does not need a bold show."}],"avoid":["Do not switch to a spin or full-screen overlay; it clashes with the calm brand.","Do not make closing slower than opening.","Do not stretch the link delay so far that Sale is slow to appear."]}

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, or a required field is missing or empty.
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://hamburger-menu-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":"hamburger-menu-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": "advise", "links": "Home\nNew in\nWomen\nMen\nSale\nContact", "link_count": "6", "brand": "Linen Co", "icon": "x", "panel": "right", "morph_ms": "300", "open_ms": "250", "close_ms": "180", "easing": "ease-out", "stagger_ms": "30", "button_px": "48", "header_color": "#ffffff", "icon_color": "#111827", "menu_color": "#ffffff", "page_check": "{...}", "description": "Main menu of a small clothing shop's website, mostly visited on phones from Instagram. Six links; people open it to jump to a category or the sale, then shop. Clean, calm brand.", "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="hamburger-menu-generator:advise:$(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: verdict, summary, icon, open, close, principles, avoid
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: hamburger-menu-generator:advise:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json