← Screenshot Enhancer
Your token

Screenshot Enhancer API

Measuring, cleaning, enlarging and sharpening a screenshot run free in the browser and need no API: your image never leaves your device. The API is for the one metered step: send a small preview of the screenshot with the page's measurements, get back the size, sharpening, cleaning and contrast to use, alt text, the most prominent text the model can read, a file name and one sentence of advice.

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
adviseLooks at the preview and the measurements, picks the enhancement settings for this screenshot and where it will be used, and writes alt text and a file name.One JSON object

Input fields

FieldTypeMeaning
taskstring"advise"
factsstringJSON text: image {width, height, format, alpha}, measured {crispness 0-1, flat_noise 0-1, blockiness, low, high, ui_like, max_scale 1-4}, flags {soft, compressed, washed_out}, current {scale, sharpen, clean, contrast}, use (slides, docs, social, print or empty).
notestringOptional words about the result you want, at most 300 characters.
$filesarrayOne file id: the preview, a JPEG at most 1024 px on its long side, uploaded with POST /files (multipart, field file). Without it the model decides from the measurements alone and writes no alt text.

The reply

job.output.output is JSON text: {"task": "advise", "kind", "scale", "sharpen", "clean_noise", "boost_contrast", "alt_text", "text_seen", "file_name", "advice"}. kind is ui, code, document, chart, photo or mixed; scale is 1 to 4; sharpen is off, light, medium or strong. The page caps the scale at max_scale, flags settings that disagree with its measurements, drops alt text when no preview was sent, and flags alt text over 250 characters. If the balance ran low, truncated is true and the object may stop early.

Worked example

Input (input.json), for the page's blurry app sample:

{
  "task": "advise",
  "facts": "{\"image\":{\"width\":768,\"height\":480,\"format\":\"JPEG\",\"alpha\":false},\"measured\":{\"crispness\":0.657,\"flat_noise\":0.102,\"blockiness\":1.062,\"low\":39,\"high\":255,\"ui_like\":true,\"max_scale\":4},\"flags\":{\"soft\":true,\"compressed\":true,\"washed_out\":false},\"current\":{\"scale\":3,\"sharpen\":\"medium\",\"clean\":true,\"contrast\":false},\"use\":\"docs\"}",
  "note": "for our help center article",
  "$files": [
    "file_preview_app"
  ]
}

Reply:

{
  "task": "advise",
  "kind": "ui",
  "scale": 3,
  "sharpen": "medium",
  "clean_noise": true,
  "boost_contrast": false,
  "alt_text": "The Northwind Desk Notification settings page with email for assigned tasks, the daily summary at 8:00 and quiet hours 22:00 - 07:00 switched on and comments on tasks switched off.",
  "text_seen": "Notification settings",
  "file_name": "northwind-desk-notification-settings",
  "advice": "The picture is slightly soft and has compression speckle, so clean it, enlarge it 3 times to reach about 1920 px for your article, and sharpen at a medium level."
}

On the page, the settings are applied to the result at once and the alt text copies as plain text, Markdown or an HTML img tag.

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.
404The $files id does not exist for this token (file ids belong to the token that uploaded them).
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://screenshot-enhancer.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":"screenshot-enhancer"}' | 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", "facts": "{...}", "note": "", "$files": ["<file_id>"]}
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="screenshot-enhancer: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: kind, scale, sharpen, alt_text, file_name, ...
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: screenshot-enhancer:advise:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json