← Fade Edges Generator
Your token

Fade Edges Generator API

Fading the picture, previewing it, measuring its edges, making the PNG and writing the CSS, inline style and Tailwind code all run free in the browser and need no API; the code is generated from the settings with the same recipe on every call. The API is for the one metered step: send the fade settings, the page's measurements of the picture's edges and a description of where the picture sits, and get back, as JSON, fade settings for that page with a reason for each change, placement steps and things to check. The picture itself is never sent. The page builds this input for you, measures the picture again under the suggested settings, and turns them into code.

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

taskWhat it doesReply
fadeReads the fade settings, the page's measurements of the picture's edges and your description of where the picture sits, and returns fade settings (which sides fade, how far, in % or px, how visible the edge stays, linear or smooth), a reason for each change, placement steps and things to check on the real page.One JSON object

Input fields

Every field is a string; settings and page_facts hold JSON text. task, settings and page_facts are required.

FieldMeaning
task"fade"
settings{top, right, bottom, left, unit, edge_opacity, curve}: each side is how far its fade reaches (0 = no fade); unit "%" or "px"; edge_opacity 0-0.9, how visible the very edge stays; curve "linear" or "smooth".
page_facts{picture, picture_px, background, background_brightness, edges, full_strength_share, verdict, notes}, measured by the page. edges has, per side, edge_color, edge_brightness (0-1) and detail_vs_average. Send "picture": "none" and "edges": null when you have no picture.
descriptionOptional: where the picture sits and how it should fade (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: summary, settings (the same seven keys as the input, as JSON numbers and strings), reasons (one {setting, why} per changed setting), placement (steps) and checks. Before using the settings, check each value is in range, the two sides of an axis stay under 100% and every change has a reason, as the page does. To turn settings into CSS: each axis is linear-gradient(to right, transparent, black L%, black (100-R)%, transparent) (or to bottom with top and bottom), written to both mask-image and -webkit-mask-image, with mask-composite: intersect when both axes fade. 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 "Photo with soft sides" example:

{
  "task": "fade",
  "settings": "{\"top\":0,\"right\":15,\"bottom\":0,\"left\":15,\"unit\":\"%\",\"edge_opacity\":0,\"curve\":\"linear\"}",
  "page_facts": "{\"picture\":\"example\",\"picture_px\":\"1000x640\",\"background\":\"#0b1020\",\"background_brightness\":0.005,\"edges\":{\"top\":{\"edge_color\":\"#163466\",\"edge_brightness\":0.036,\"detail_vs_average\":0.31},\"right\":{\"edge_color\":\"#3c5885\",\"edge_brightness\":0.097,\"detail_vs_average\":1.09},\"bottom\":{\"edge_color\":\"#2a3e60\",\"edge_brightness\":0.048,\"detail_vs_average\":0.47},\"left\":{\"edge_color\":\"#3d5885\",\"edge_brightness\":0.097,\"detail_vs_average\":1.1}},\"full_strength_share\":0.7,\"verdict\":\"good\",\"notes\":[]}",
  "description": "Wide landscape photo in the hero band of a travel site. The page around it is a dark navy (#0b1020). I want the left and right sides to melt into the page so there is no hard edge.",
  "clipped_note": ""
}

Reply:

{"summary":"Keep the current fade: 15% on the left and right, nothing on top or bottom, fading fully to see-through. The measurements (taken from an example picture) show the side edges are only slightly lighter than the dark navy page, so a 15% fade will blend without a visible band.","settings":{"top":0,"right":15,"bottom":0,"left":15,"unit":"%","edge_opacity":0,"curve":"linear"},"reasons":[],"placement":["Put the fade class on the image element itself in the hero band, not on its wrapper.","Make sure the image has loaded and is visible, because the mask only fades visible content.","Set the hero band's background to the same dark navy (#0b1020) so the faded sides melt into it."],"checks":["Look at the left and right edges at a wide and a narrow window width to confirm no hard line remains.","Check that the top and bottom edges still look sharp, as intended."]}

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://fade-edges-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":"fade-edges-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": "fade", "settings": "{\"top\": 0, \"right\": 15, \"bottom\": 0, \"left\": 15, ...}", "page_facts": "{...}", "description": "Hero photo on a dark navy page", "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="fade-edges-generator:fade:$(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: summary, settings, reasons, placement, checks
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: fade-edges-generator:fade:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json