← Gradient Border Generator
Your token

Gradient Border Generator API

Reading the colour, tuning the stops for each surface, writing the CSS, HTML and Tailwind classes, and checking the border all run free in the browser and need no API. The API is for the one metered step: send your colour and a description of your site, and get back border styles.

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

Send "task" first. There is one job today; the field is there so the reply shape is always named.

taskWhat it doesReply
suggestProposes two or three gradient border styles in your colour that fit the description: angle, width, corner radius, and 2 to 4 colour stops for each surface you asked for.{"task":"suggest","variants":[{"name","why","angle","width","radius","dark":[{"color","alpha","at"}],"light":[...]}],"summary"}

Input fields

FieldTypeMeaning
taskstring"suggest". Required.
briefstringOptional: your site or the look you want, at most 300 characters. A #rrggbb code written here may be used as a second colour.
brandstringYour brand colour as #rrggbb. Required.
themestring"dark", "light" or "both": which surfaces the border must work on. Required.
elementstring"card", "button", "tab" or "hero". Required.
factsstringJSON text measured by the page: surfaces per theme, brand_alpha per theme (visible_from, loud_from), the current border, and flags. Required.

The reply

job.output.output is JSON text in the shape above. The page uses a style only when: its name is at most 40 characters and its reason at most 160, and neither names an effect the page does not draw (glow, neon, shadow and similar); the angle is a whole number from 0 to 360, the width 1 or 2, the radius 0 to 64; each surface has 2 to 4 stops with #rrggbb colours, opacity from 0 to 0.6 and positions in order; every coloured stop is your brand hue (within 25 degrees) or a code you wrote in brief; and on each surface the strongest stop is between 1.15:1 and 3.2:1 against the surface, at most one stop is at 40% opacity or more, nothing is full-saturation neon at 50% or more, and the hues span at most 90 degrees. If the balance ran low, truncated is true and the object may stop early; the styles that arrived whole are kept.

Worked examples

task: suggest - a dark pricing card

Input (input.json):

{
  "task": "suggest",
  "brief": "Pricing card for a calm budgeting app on a navy page. Premium but quiet.",
  "brand": "#7d5cff",
  "theme": "dark",
  "element": "card",
  "facts": "{\"surfaces\":{\"dark\":\"#0b0f19\"},\"brand_alpha\":{\"dark\":{\"visible_from\":0.22,\"loud_from\":0.6}},\"current\":{\"angle\":135,\"width\":1,\"radius\":20,\"pattern\":\"fill\",\"strength\":\"subtle\",\"stops\":{\"dark\":[{\"color\":\"#ffffff\",\"alpha\":0.24,\"contrast\":2.11},{\"color\":\"#7d5cff\",\"alpha\":0.26,\"contrast\":1.34},{\"color\":\"#ffffff\",\"alpha\":0.06,\"contrast\":1.14}]}},\"flags\":[\"theme\"]}"
}

Reply:

{
  "task": "suggest",
  "variants": [
    {
      "name": "Corner-lit violet edge",
      "why": "A lit corner with a soft violet middle keeps the premium pricing card calm on the navy page.",
      "angle": 135,
      "width": 1,
      "radius": 20,
      "dark": [
        {
          "color": "#ffffff",
          "alpha": 0.3,
          "at": 0
        },
        {
          "color": "#7d5cff",
          "alpha": 0.28,
          "at": 45
        },
        {
          "color": "#ffffff",
          "alpha": 0.06,
          "at": 100
        }
      ]
    },
    {
      "name": "Top violet band",
      "why": "A violet band along the top edge gives the budgeting card a quiet, raised feel without pulling focus from the plan.",
      "angle": 170,
      "width": 1,
      "radius": 24,
      "dark": [
        {
          "color": "#ffffff",
          "alpha": 0.18,
          "at": 0
        },
        {
          "color": "#7d5cff",
          "alpha": 0.34,
          "at": 50
        },
        {
          "color": "#ffffff",
          "alpha": 0.05,
          "at": 100
        }
      ]
    },
    {
      "name": "Violet start, soft fade",
      "why": "The brand accent starts at the corner and fades to a faint edge, a restrained premium look for a calm app.",
      "angle": 45,
      "width": 1,
      "radius": 20,
      "dark": [
        {
          "color": "#7d5cff",
          "alpha": 0.38,
          "at": 0
        },
        {
          "color": "#ffffff",
          "alpha": 0.14,
          "at": 55
        },
        {
          "color": "#ffffff",
          "alpha": 0.04,
          "at": 100
        }
      ]
    }
  ],
  "summary": "Three quiet violet edges for a dark pricing card: lit corner, top band and corner accent."
}

task: suggest - a hero panel on dark and light, over its own background

Input:

{
  "task": "suggest",
  "brief": "Hero panel over a photo with a frosted glass blur, site has light and dark mode, warm and friendly, accent #fb923c is fine too.",
  "brand": "#f97316",
  "theme": "both",
  "element": "hero",
  "facts": "{\"surfaces\":{\"dark\":\"#0b0f19\",\"light\":\"#ffffff\"},\"brand_alpha\":{\"dark\":{\"visible_from\":0.18,\"loud_from\":0.6},\"light\":{\"visible_from\":0.22,\"loud_from\":0.6}},\"current\":{\"angle\":135,\"width\":2,\"radius\":28,\"pattern\":\"mask\",\"strength\":\"subtle\",\"stops\":{\"dark\":[{\"color\":\"#ffffff\",\"alpha\":0.24,\"contrast\":2.11},{\"color\":\"#f97316\",\"alpha\":0.2,\"contrast\":1.31},{\"color\":\"#ffffff\",\"alpha\":0.06,\"contrast\":1.14}],\"light\":[{\"color\":\"#0f172a\",\"alpha\":0.12,\"contrast\":1.28},{\"color\":\"#f97316\",\"alpha\":0.26,\"contrast\":1.31},{\"color\":\"#0f172a\",\"alpha\":0.04,\"contrast\":1.08}]}},\"flags\":[]}"
}

Reply:

{
  "task": "suggest",
  "variants": [
    {
      "name": "Lit orange corner",
      "why": "A lit top-left corner keeps the warm accent friendly on a frosted hero panel over a photo.",
      "angle": 135,
      "width": 2,
      "radius": 28,
      "dark": [
        {
          "color": "#ffffff",
          "alpha": 0.3,
          "at": 0
        },
        {
          "color": "#f97316",
          "alpha": 0.3,
          "at": 45
        },
        {
          "color": "#ffffff",
          "alpha": 0.06,
          "at": 100
        }
      ],
      "light": [
        {
          "color": "#0f172a",
          "alpha": 0.18,
          "at": 0
        },
        {
          "color": "#f97316",
          "alpha": 0.34,
          "at": 45
        },
        {
          "color": "#0f172a",
          "alpha": 0.05,
          "at": 100
        }
      ]
    },
    {
      "name": "Warm top band",
      "why": "A stronger orange band along the top edge reads as a friendly highlight on the glass hero without crowding the photo.",
      "angle": 170,
      "width": 2,
      "radius": 28,
      "dark": [
        {
          "color": "#ffffff",
          "alpha": 0.2,
          "at": 0
        },
        {
          "color": "#fb923c",
          "alpha": 0.45,
          "at": 50
        },
        {
          "color": "#ffffff",
          "alpha": 0.05,
          "at": 100
        }
      ],
      "light": [
        {
          "color": "#0f172a",
          "alpha": 0.1,
          "at": 0
        },
        {
          "color": "#f97316",
          "alpha": 0.4,
          "at": 50
        },
        {
          "color": "#0f172a",
          "alpha": 0.04,
          "at": 100
        }
      ]
    },
    {
      "name": "Thin amber corner",
      "why": "A slim edge with the accent at the corner keeps the frosted hero light and lets the photo carry the mood.",
      "angle": 225,
      "width": 1,
      "radius": 24,
      "dark": [
        {
          "color": "#fb923c",
          "alpha": 0.3,
          "at": 0
        },
        {
          "color": "#ffffff",
          "alpha": 0.12,
          "at": 60
        },
        {
          "color": "#ffffff",
          "alpha": 0.05,
          "at": 100
        }
      ],
      "light": [
        {
          "color": "#f97316",
          "alpha": 0.28,
          "at": 0
        },
        {
          "color": "#0f172a",
          "alpha": 0.08,
          "at": 60
        },
        {
          "color": "#0f172a",
          "alpha": 0.04,
          "at": 100
        }
      ]
    }
  ],
  "summary": "Three warm orange edges for a frosted hero panel: corner lit, top band, and a thin amber corner."
}

On the page, the styles that pass are listed with a preview, the first one goes on your border, and Undo takes it off.

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://gradient-border-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":"gradient-border-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": "suggest", "brief": "...", "brand": "#7d5cff", "theme": "dark", "element": "card", "facts": "{...}"}
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="gradient-border-generator:suggest:$(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: task, variants, summary
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: gradient-border-generator:suggest:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json