← Glitch Text Generator
Your token

Glitch Text Generator API

Drawing the glitch card, the PNG, the video clip and the HTML file all run free in the browser and need no API. The API is for the one metered step: send a short description of your video and the card's limits, get back five title options, each with a subtitle, a corner caption and a glitch style.

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

taskWhat it doesReply
titlesWrites five different title options for the described video, each within the character limits you send, with a style id the page knows. Never invents names, dates or numbers that are not in your description.One JSON object

Input fields

FieldTypeMeaning
taskstring"titles"
topicstringWhat the video is about, in your words, at most 400 characters.
currentstringThe title on the card now; may be empty.
factsstringJSON text: count (5), aspect (16:9, 9:16 or 1:1), best_title_chars (fits one line), max_title_chars (fits at all), max_subtitle_chars, max_caption_chars, styles (split, corrupt, vhs, heavy) and current_style.

The reply

job.output.output is JSON text: {"task": "titles", "options": [{"title", "subtitle", "caption", "style"}]} with count options. Captions start with >> . The page re-checks every option: a title over max_title_chars is shortened, an unknown style is replaced by the current one, and digits that are not in your description are flagged. If the balance ran low, truncated is true and the object may stop early.

Worked example

Input (input.json):

{
  "task": "titles",
  "topic": "a cyberpunk short film about a courier who loses her signal in a flooded city at night",
  "current": "SIGNAL LOST",
  "facts": "{\"count\":5,\"aspect\":\"16:9\",\"best_title_chars\":26,\"max_title_chars\":52,\"max_subtitle_chars\":48,\"max_caption_chars\":40,\"styles\":[\"split\",\"corrupt\",\"vhs\",\"heavy\"],\"current_style\":\"corrupt\"}"
}

Reply:

{
  "task": "titles",
  "options": [
    {
      "title": "NO SIGNAL",
      "subtitle": "the courier goes dark in the rising water",
      "caption": ">> SIGNAL_LOST \u00b7 FLOOD_ZONE",
      "style": "corrupt"
    },
    {
      "title": "DROWNED GRID",
      "subtitle": "a flooded city that never sleeps",
      "caption": ">> NIGHT_CITY \u00b7 CH-04",
      "style": "vhs"
    },
    {
      "title": "OFFLINE",
      "subtitle": "",
      "caption": ">> COURIER_OFFLINE \u00b7 NIGHT",
      "style": "heavy"
    },
    {
      "title": "WHO DELIVERS WHEN THE NET DIES?",
      "subtitle": "one courier, no signal, one long night",
      "caption": ">> NO_NET \u00b7 COURIER \u00b7 CH-04",
      "style": "split"
    },
    {
      "title": "LAST MILE UNDERWATER",
      "subtitle": "cyberpunk short film",
      "caption": ">> CYBERPUNK \u00b7 FLOODED_CITY",
      "style": "corrupt"
    }
  ]
}

On the page, each option is a button: click one and it goes on the card with its subtitle, caption and style.

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://glitch-text-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":"glitch-text-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": "titles", "topic": "...", "current": "...", "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="glitch-text-generator:titles:$(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, options
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: glitch-text-generator:titles:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json