← Device Mockup Generator
Your token

Device Mockup Generator API

Drawing the mockup (frame, crop, background, caption, PNG) is free in the browser and needs no API; the screenshot never leaves the page. The API is for the one metered step: describe what a screenshot shows and where it will be posted, and get back three presentation ideas as JSON. Each idea names a frame, an orientation, a frame colour, a background, a headline and a second line. Apply an idea on the page to draw it with your screenshot.

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

taskWhat it doesReply
presentSuggests three ways to present the screenshot for the place it will go: a frame whose crop is 10% or less, a background that suits the place (never transparent for a feed post), and a headline of up to 40 characters plus a second line of up to 80 that use only facts from your description.One ```json block

Input fields

FieldTypeMeaning
taskstring"present"
aboutstringWhat the screenshot shows and who the product is for, up to 300 characters. Required.
namestringOptional product or site name, up to 60 characters.
usestringWhere it goes: landing, x, linkedin, appstore, slide or readme.
factsstringJSON text the page works out from the screenshot: screenshot (w, h, ratio), fits (crop_pct per device and orientation), suggested, devices, backgrounds, frames. Send "{}" if you have nothing.

The reply

job.output.output is text: one fenced ```json block holding {"ideas": [...]}. Each idea has name, device (phone, tablet, laptop, desktop, browser, watch), orient (portrait or landscape; landscape only for phone and tablet), frame (black, silver, sand), background (transparent, white, mist, ink, ocean, sunset, meadow), headline, subline and why. If the balance ran low, truncated is true and the array may stop early; the complete ideas before the cut are still usable.

Worked example

Input (input.json), for a website screenshot of 2880 x 2200 px going into a post on X:

{
  "task": "present",
  "about": "Northwind is a docs tool for small teams: write in Markdown, publish in one click and search every page",
  "name": "Northwind",
  "use": "x",
  "facts": "{\"screenshot\":{\"w\":2880,\"h\":2200,\"ratio\":1.309},\"fits\":[{\"device\":\"phone\",\"orient\":\"portrait\",\"crop_pct\":65},{\"device\":\"phone\",\"orient\":\"landscape\",\"crop_pct\":40},{\"device\":\"tablet\",\"orient\":\"portrait\",\"crop_pct\":47},{\"device\":\"tablet\",\"orient\":\"landscape\",\"crop_pct\":10},{\"device\":\"laptop\",\"orient\":\"portrait\",\"crop_pct\":15},{\"device\":\"desktop\",\"orient\":\"portrait\",\"crop_pct\":26},{\"device\":\"browser\",\"orient\":\"portrait\",\"crop_pct\":0},{\"device\":\"watch\",\"orient\":\"portrait\",\"crop_pct\":36}],\"suggested\":{\"device\":\"browser\",\"orient\":\"portrait\"},\"devices\":[\"phone\",\"tablet\",\"laptop\",\"desktop\",\"browser\",\"watch\"],\"backgrounds\":[\"transparent\",\"white\",\"mist\",\"ink\",\"ocean\",\"sunset\",\"meadow\"],\"frames\":[\"black\",\"silver\",\"sand\"]}"
}

Reply:

```json
{"ideas": [
  {"name": "Browser on ocean", "device": "browser", "orient": "portrait", "frame": "silver", "background": "ocean", "headline": "Write in Markdown, publish in one click", "subline": "Northwind is the docs tool for small teams", "why": "A browser frame shows the full docs page with no cropping, and the ocean colour stands out in an X feed."},
  {"name": "Tablet on ink", "device": "tablet", "orient": "landscape", "frame": "black", "background": "ink", "headline": "Search every page in your docs", "subline": "Northwind keeps small teams from hunting for answers", "why": "A landscape tablet fits this wide screenshot with little cropping, and the dark ink background gives strong contrast in a feed."},
  {"name": "Browser on sunset", "device": "browser", "orient": "portrait", "frame": "sand", "background": "sunset", "headline": "Docs your whole team can find", "subline": "Write in Markdown and publish with a single click", "why": "A warm sunset background catches the eye on X, and the uncropped browser frame keeps the docs page readable."}
]}
```

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://device-mockup-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":"device-mockup-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": "present", "about": "...", "name": "", "use": "x", "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="device-mockup-generator:present:$(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.txt   # one ```json block: {"ideas": [...3 ideas]}
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: device-mockup-generator:present:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json