← Fiction Prose Checker
Your token

Fiction Prose Checker API

Splitting a passage into sentences, marking filter words, adverbs, passive voice, weak verbs and adjective stacks, the rhythm numbers and every download run free in the browser and need no API. The API is for the one metered step: send the numbered sentences and the page's counts, and get back, as JSON ids, which of the six prose problems of the skill @jwynia/prose-style the passage has, the sentences that show each one and fixes from that problem's own list. The page builds this input for you and checks every id before showing it.

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

taskWhat it doesReply
diagnoseReads a passage's numbered sentences and names which of six prose problems it has: P1 flat, P2 unclear, P3 overwrought, P4 monotonous, P5 passive voice overuse, P6 inconsistent voice.One JSON object

Input fields

Every field is a string; facts holds JSON text. task and facts are required; leave note out when there is none.

FieldMeaning
task"diagnose"
factsJSON object: sentences (each {id, p, words, text}, ids S1, S2..., plus dialogue: true for a sentence with quoted speech and marks with the words flagged under filter, adverb, passive and stack), stats (passive_pct, weak_verb_pct, adverb_pct, filter_words, adjective_stacks, avg_sentence_words, sentence_variety, paragraph_variety, short, medium and long sentence counts, repeated_openings), over_target (ids of the checks over target) and, for a long passage, clipped (sent, of, left_out). The page sends at most 260 sentences, in whole paragraphs from the start and the end.
noteOptional, up to 300 characters: what the writer or their readers say about the passage.

The reply

job.output.output is text holding one JSON object: primary (the first state, or "none"), states (zero to three {state, evidence, fixes}: a state id P1-P6, two to six sentence ids, and one to three fix ids such as P4-5 from that state's own list), read_aloud (up to three sentence ids where a reader would stumble) and keep (up to three sentence ids that already work). The model never rewrites the prose. Before using it, check it as the page does: every sentence id was sent, every fix belongs to its state, every P5 sentence has a passive mark, and no keep sentence is also evidence. If the balance ran low, truncated is true and the object may stop early; the page keeps what arrived whole.

Worked example

Input (input.json), from the page's Monotone example, with the note "Beta readers say the opening drags":

{
  "task": "diagnose",
  "facts": "{\"sentences\":[{\"id\":\"S1\",\"p\":1,\"words\":10,\"text\":\"He walked to the station at seven in the morning.\"},{\"id\":\"S2\",\"p\":1,\"words\":8,\"text\":\"He bought a ticket from the yellow machine.\"},{\"id\":\"S3\",\"p\":1,\"words\":9,\"text\":\"He was told that the train was running late.\",\"marks\":{\"passive\":[\"was told\"]}},{\"id\":\"S4\",\"p\":1,\"words\":8,\"text\":\"He sat down on a cold metal bench.\"},{\"id\":\"S5\",\"p\":2,\"words\":11,\"text\":\"The platform was swept by a man in an orange coat.\",\"marks\":{\"passive\":[\"was swept\"]}},{\"id\":\"S6\",\"p\":2,\"words\":8,\"text\":\"The announcement was made twice over the speakers.\",\"marks\":{\"passive\":[\"was made\"]}},{\"id\":\"S7\",\"p\":2,\"words\":8,\"text\":\"He checked the time on his phone again.\"},{\"id\":\"S8\",\"p\":2,\"words\":6,\"text\":\"He thought about calling his sister.\",\"marks\":{\"filter\":[\"thought\"]}},{\"id\":\"S9\",\"p\":3,\"words\":7,\"text\":\"He did not call her that morning.\"},{\"id\":\"S10\",\"p\":3,\"words\":8,\"text\":\"The train was delayed by another ten minutes.\",\"marks\":{\"passive\":[\"was delayed\"]}},{\"id\":\"S11\",\"p\":3,\"words\":7,\"text\":\"He watched the pigeons near the bins.\",\"marks\":{\"filter\":[\"watched\"]}},{\"id\":\"S12\",\"p\":3,\"words\":8,\"text\":\"He felt tired and a little bit hungry.\",\"marks\":{\"filter\":[\"felt\"]}},{\"id\":\"S13\",\"p\":4,\"words\":7,\"text\":\"The train arrived at half past seven.\"},{\"id\":\"S14\",\"p\":4,\"words\":10,\"text\":\"His bag was taken by a woman in a hurry.\",\"marks\":{\"passive\":[\"was taken\"]}},{\"id\":\"S15\",\"p\":4,\"words\":8,\"text\":\"He was given a seat near the window.\",\"marks\":{\"passive\":[\"was given\"]}},{\"id\":\"S16\",\"p\":4,\"words\":7,\"text\":\"He looked out at the grey fields.\"}],\"stats\":{\"words\":130,\"sentences\":16,\"paragraphs\":4,\"passive_pct\":37.5,\"weak_verb_pct\":6.9,\"adverb_pct\":0,\"filter_words\":3,\"adjective_stacks\":0,\"avg_sentence_words\":8.1,\"sentence_variety\":13,\"paragraph_variety\":33,\"short_sentences\":13,\"medium_sentences\":3,\"long_sentences\":0,\"repeated_openings\":[\"he x11\",\"the x4\"]},\"over_target\":[\"passive\",\"filter\",\"sentenceVariety\",\"noLong\",\"paragraphVariety\",\"openings\"]}",
  "note": "Beta readers say the opening drags"
}

Reply:

{"primary":"P4","states":[{"state":"P4","evidence":["S1","S2","S4","S7","S9","S11"],"fixes":["P4-1","P4-4","P4-5"]},{"state":"P5","evidence":["S3","S5","S6","S10","S14","S15"],"fixes":["P5-1","P5-2"]},{"state":"P1","evidence":["S8","S11","S12"],"fixes":["P1-5","P1-3"]}],"read_aloud":["S6","S14"],"keep":["S13","S16"]}

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, or a required field is missing or empty.
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://fiction-prose-checker.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":"fiction-prose-checker"}' | 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": "diagnose", "facts": "{\"sentences\":[{\"id\":\"S1\",\"p\":1,\"words\":10,\"text\":\"He walked to the station at seven in the morning.\"},{\"id\":\"S2\",\"p\":1,\"words\":8,\"text\":\"He bought a ticket from the yellow machine.\"},{\"id\":\"S3\",\"p\":1,\"words\":9,\"text\":\"He was told that the train was running late.\",\"marks\":{\"passive\":[\"was told\"]}},{\"id\":\"S4\",\"p\":1,\"words\":8,\"text\":\"He sat down on a cold metal bench.\"},{\"id\":\"S5\",\"p\":2,\"words\":11,\"text\":\"The platform was swept by a man in an orange coat.\",\"marks\":{\"passive\":[\"was swept\"]}},{\"id\":\"S6\",\"p\":2,\"words\":8,\"text\":\"The announcement was made twice over the speakers.\",\"marks\":{\"passive\":[\"was made\"]}},{\"id\":\"S7\",\"p\":2,\"words\":8,\"text\":\"He checked the time on his phone again.\"},{\"id\":\"S8\",\"p\":2,\"words\":6,\"text\":\"He thought about calling his sister.\",\"marks\":{\"filter\":[\"thought\"]}},{\"id\":\"S9\",\"p\":3,\"words\":7,\"text\":\"He did not call her that morning.\"},{\"id\":\"S10\",\"p\":3,\"words\":8,\"text\":\"The train was delayed by another ten minutes.\",\"marks\":{\"passive\":[\"was delayed\"]}},{\"id\":\"S11\",\"p\":3,\"words\":7,\"text\":\"He watched the pigeons near the bins.\",\"marks\":{\"filter\":[\"watched\"]}},{\"id\":\"S12\",\"p\":3,\"words\":8,\"text\":\"He felt tired and a little bit hungry.\",\"marks\":{\"filter\":[\"felt\"]}},{\"id\":\"S13\",\"p\":4,\"words\":7,\"text\":\"The train arrived at half past seven.\"},{\"id\":\"S14\",\"p\":4,\"words\":10,\"text\":\"His bag was taken by a woman in a hurry.\",\"marks\":{\"passive\":[\"was taken\"]}},{\"id\":\"S15\",\"p\":4,\"words\":8,\"text\":\"He was given a seat near the window.\",\"marks\":{\"passive\":[\"was given\"]}},{\"id\":\"S16\",\"p\":4,\"words\":7,\"text\":\"He looked out at the grey fields.\"}],\"stats\":{\"words\":130,\"sentences\":16,\"paragraphs\":4,\"passive_pct\":37.5,\"weak_verb_pct\":6.9,\"adverb_pct\":0,\"filter_words\":3,\"adjective_stacks\":0,\"avg_sentence_words\":8.1,\"sentence_variety\":13,\"paragraph_variety\":33,\"short_sentences\":13,\"medium_sentences\":3,\"long_sentences\":0,\"repeated_openings\":[\"he x11\",\"the x4\"]},\"over_target\":[\"passive\",\"filter\",\"sentenceVariety\",\"noLong\",\"paragraphVariety\",\"openings\"]}", "note": "Beta readers say the opening drags"}
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="fiction-prose-checker:diagnose:$(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: primary, states, read_aloud, keep
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: fiction-prose-checker:diagnose:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json