Drive Readability Check from your own code
The scores (Flesch, Flesch-Kincaid, Fog, SMOG, Coleman-Liau, ARI, the CEFR word profile) are computed in the browser and are not an API call. The rewrite is. Base URL:
https://api.skillsafe.ai/v1/app-api
Every request carries Authorization: Bearer <token> and Content-Type: application/json.
Every response is a JSON envelope: {"ok":true,"data":{…}} on success and
{"ok":false,"error":{"code":"…","message":"…"}} on failure. Read error.code, not only the HTTP status.
The web app re-scores every rewrite, checks that each number and name from the original is still there, and lists words left above the target. Code calling the API gets the model's reply only and should check it the same way.
Errors
| Code | Meaning | What to do |
|---|---|---|
UNAUTHORIZED | Missing, expired or wrong-app token. | Mint a guest token or sign in again. |
INSUFFICIENT_CREDITS | Balance below min_credits. | Top up. /estimate is free and tells you the hold. |
VALIDATION_ERROR | The input object failed validation. | Check error.details. The body is the input object itself — never wrap it in {"input": …}. |
RATE_LIMITED | Too many requests. | Back off and retry. |
JOB_FAILED | The run started and did not complete. | Retry with the same Idempotency-Key. |
The task field comes first
There is one task: "rewrite". Send it on every call.
Input
One flat object of strings. task, text and target are what matter; the rest may be empty.
| Field | Type | Meaning |
|---|---|---|
task | string, required | "rewrite". |
text | string | The text to rewrite. The web app sends at most 1,500 words, cut between paragraphs. |
target | string | A2, B1, B2, C1 (CEFR) or G3–G10, G12 (US grade). |
target_label | string | The target in words, e.g. CEFR B1 (intermediate). |
keep_terms | string | Comma-separated terms to keep exactly (400 characters). |
audience | string | Who will read it (300 characters). |
prescan | string (JSON) | The web app's free check: words, sentences, avg_sentence_words, grade, flesch, cefr, vocabulary_level, sentence_cap, above_target[], facts[], hardest[]. Send {} if you have none. |
retry_note | string | Sent only on the one automatic reformat retry. |
Output
The output (output.output) is one JSON object: task, status (ok · already_at_level · not_prose), message, target,
level_read, rewrite (the whole text; paragraphs separated by a blank line), changes[] of {from, to, why},
kept_terms[] of {term, why} and check_notes[].
status: "not_prose" means the input was code, a table or too short: rewrite is empty and message says why. The model may wrap the object in a code fence; strip it before parsing.
1. Get a token
A guest token is enough for /me and /estimate. Running is metered and needs a personal token from signing in. The tokens page shows yours and copies it. Replace YOUR_TOKEN below with it.
2. Check the session and the balance
/me returns subject_type, subject_id and credits. Signed in means subject_type === "user".
curl -s "https://api.skillsafe.ai/v1/app-api/me" \ -H "Authorization: Bearer YOUR_TOKEN"
import requests
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
H = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
r = requests.get(f"{BASE}/me", headers=H, timeout=30).json()
print(r["data"]["subject_type"], r["data"]["credits"])
const TOKEN = "YOUR_TOKEN";
const BASE = "https://api.skillsafe.ai/v1/app-api";
const H = { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json" };
const r = await (await fetch(`${BASE}/me`, { headers: H })).json();
console.log(r.data.subject_type, r.data.credits);
package main
import ("bytes"; "encoding/json"; "fmt"; "net/http")
const base = "https://api.skillsafe.ai/v1/app-api"
const token = "YOUR_TOKEN"
func main() {
req, _ := http.NewRequest("GET", base+"/me", nil)
req.Header.Set("Authorization", "Bearer "+token)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
var out map[string]any
json.NewDecoder(res.Body).Decode(&out)
fmt.Println(out["data"])
_ = bytes.NewReader
}
var token = "YOUR_TOKEN";
var base = "https://api.skillsafe.ai/v1/app-api";
var http = java.net.http.HttpClient.newHttpClient();
var req = java.net.http.HttpRequest.newBuilder(java.net.URI.create(base + "/me"))
.header("Authorization", "Bearer " + token).GET().build();
System.out.println(http.send(req, java.net.http.HttpResponse.BodyHandlers.ofString()).body());
require "net/http"
require "json"
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
uri = URI("#{BASE}/me")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{TOKEN}"
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
puts JSON.parse(res.body)["data"]
<?php
$token = "YOUR_TOKEN";
$base = "https://api.skillsafe.ai/v1/app-api";
$ch = curl_init("$base/me");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["Authorization: Bearer $token"]]);
print_r(json_decode(curl_exec($ch), true)["data"]);
using System.Net.Http.Headers;
using System.Text;
var token = "YOUR_TOKEN";
var baseUrl = "https://api.skillsafe.ai/v1/app-api";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
Console.WriteLine(await http.GetStringAsync($"{baseUrl}/me"));
3. Price it before you run it
/estimate is free and starts no job. hold_credits is a reservation priced against the longest possible reply, not the price. A tenancy notice to CEFR A2:
curl -s -X POST "https://api.skillsafe.ai/v1/app-api/estimate" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"task": "rewrite", "text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours'\'' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.", "target": "A2", "target_label": "CEFR A2 (elementary)", "keep_terms": "", "audience": "tenants who are new to English", "prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours'\'' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"}'
import requests
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
H = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
body = {
"task": "rewrite",
"text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.",
"target": "A2",
"target_label": "CEFR A2 (elementary)",
"keep_terms": "",
"audience": "tenants who are new to English",
"prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"
}
r = requests.post(f"{BASE}/estimate", headers={**H}, json=body, timeout=120).json()
print(r["data"]["hold_credits"], r["data"]["model_alias"])
const TOKEN = "YOUR_TOKEN";
const BASE = "https://api.skillsafe.ai/v1/app-api";
const H = { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json" };
const body = {
"task": "rewrite",
"text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.",
"target": "A2",
"target_label": "CEFR A2 (elementary)",
"keep_terms": "",
"audience": "tenants who are new to English",
"prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"
};
const r = await (await fetch(`${BASE}/estimate`, { method: "POST", headers: { ...H }, body: JSON.stringify(body) })).json();
console.log(r.data.hold_credits, r.data.model_alias);
package main
import ("bytes"; "encoding/json"; "fmt"; "net/http")
const base = "https://api.skillsafe.ai/v1/app-api"
const token = "YOUR_TOKEN"
func main() {
payload := []byte(`{"task": "rewrite", "text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.", "target": "A2", "target_label": "CEFR A2 (elementary)", "keep_terms": "", "audience": "tenants who are new to English", "prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"}`)
req, _ := http.NewRequest("POST", base+"/estimate", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
var out map[string]any
json.NewDecoder(res.Body).Decode(&out)
fmt.Println(out["data"])
}
var token = "YOUR_TOKEN";
var base = "https://api.skillsafe.ai/v1/app-api";
var http = java.net.http.HttpClient.newHttpClient();
var body = "{\"task\": \"rewrite\", \"text\": \"Notice regarding the annual inspection of your property\\n\\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\n\\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.\", \"target\": \"A2\", \"target_label\": \"CEFR A2 (elementary)\", \"keep_terms\": \"\", \"audience\": \"tenants who are new to English\", \"prescan\": \"{\\\"words\\\":118,\\\"sentences\\\":6,\\\"avg_sentence_words\\\":19.7,\\\"grade\\\":12.7,\\\"flesch\\\":39.2,\\\"cefr\\\":\\\"B2\\\",\\\"vocabulary_level\\\":\\\"B2\\\",\\\"sentence_cap\\\":12,\\\"above_target\\\":[\\\"inspection (B1)\\\",\\\"regarding (B1)\\\",\\\"annual (B1)\\\",\\\"property (B1)\\\",\\\"accordance (rare)\\\",\\\"clause (B2)\\\",\\\"tenancy (rare)\\\",\\\"agreement (B1)\\\",\\\"landlord (B1)\\\",\\\"entitled (B2)\\\",\\\"conduct (B1)\\\",\\\"premises (C1)\\\",\\\"minimum (B1)\\\",\\\"written (B1)\\\",\\\"harbour (B1)\\\",\\\"scheduled (B2)\\\",\\\"prove (B1)\\\",\\\"inconvenient (B1)\\\",\\\"management (B1)\\\",\\\"arrange (B1)\\\",\\\"alternative (B1)\\\",\\\"failure (B1)\\\",\\\"respond (B1)\\\",\\\"construed (rare)\\\",\\\"consent (B2)\\\",\\\"proposed (B2)\\\",\\\"arrangement (B1)\\\",\\\"tenants (rare)\\\",\\\"obliged (C1)\\\",\\\"secured (B1)\\\",\\\"duration (C1)\\\"],\\\"facts\\\":[\\\"14\\\",\\\"24\\\",\\\"3\\\",\\\"18\\\",\\\"12\\\",\\\"10\\\",\\\"00\\\",\\\"020\\\",\\\"7946\\\",\\\"0321\\\",\\\"8\\\"],\\\"hardest\\\":[\\\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\\\",\\\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\\\",\\\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\\"]}\"}";
var req = java.net.http.HttpRequest.newBuilder(java.net.URI.create(base + "/estimate"))
.header("Authorization", "Bearer " + token).header("Content-Type", "application/json")
.POST(java.net.http.HttpRequest.BodyPublishers.ofString(body)).build();
System.out.println(http.send(req, java.net.http.HttpResponse.BodyHandlers.ofString()).body());
require "net/http"
require "json"
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
uri = URI("#{BASE}/estimate")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{TOKEN}"
req["Content-Type"] = "application/json"
req.body = "{\"task\": \"rewrite\", \"text\": \"Notice regarding the annual inspection of your property\\n\\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\n\\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.\", \"target\": \"A2\", \"target_label\": \"CEFR A2 (elementary)\", \"keep_terms\": \"\", \"audience\": \"tenants who are new to English\", \"prescan\": \"{\\\"words\\\":118,\\\"sentences\\\":6,\\\"avg_sentence_words\\\":19.7,\\\"grade\\\":12.7,\\\"flesch\\\":39.2,\\\"cefr\\\":\\\"B2\\\",\\\"vocabulary_level\\\":\\\"B2\\\",\\\"sentence_cap\\\":12,\\\"above_target\\\":[\\\"inspection (B1)\\\",\\\"regarding (B1)\\\",\\\"annual (B1)\\\",\\\"property (B1)\\\",\\\"accordance (rare)\\\",\\\"clause (B2)\\\",\\\"tenancy (rare)\\\",\\\"agreement (B1)\\\",\\\"landlord (B1)\\\",\\\"entitled (B2)\\\",\\\"conduct (B1)\\\",\\\"premises (C1)\\\",\\\"minimum (B1)\\\",\\\"written (B1)\\\",\\\"harbour (B1)\\\",\\\"scheduled (B2)\\\",\\\"prove (B1)\\\",\\\"inconvenient (B1)\\\",\\\"management (B1)\\\",\\\"arrange (B1)\\\",\\\"alternative (B1)\\\",\\\"failure (B1)\\\",\\\"respond (B1)\\\",\\\"construed (rare)\\\",\\\"consent (B2)\\\",\\\"proposed (B2)\\\",\\\"arrangement (B1)\\\",\\\"tenants (rare)\\\",\\\"obliged (C1)\\\",\\\"secured (B1)\\\",\\\"duration (C1)\\\"],\\\"facts\\\":[\\\"14\\\",\\\"24\\\",\\\"3\\\",\\\"18\\\",\\\"12\\\",\\\"10\\\",\\\"00\\\",\\\"020\\\",\\\"7946\\\",\\\"0321\\\",\\\"8\\\"],\\\"hardest\\\":[\\\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\\\",\\\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\\\",\\\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\\"]}\"}"
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
puts JSON.parse(res.body)["data"]
<?php
$token = "YOUR_TOKEN";
$base = "https://api.skillsafe.ai/v1/app-api";
$body = "{\"task\": \"rewrite\", \"text\": \"Notice regarding the annual inspection of your property\\n\\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\n\\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.\", \"target\": \"A2\", \"target_label\": \"CEFR A2 (elementary)\", \"keep_terms\": \"\", \"audience\": \"tenants who are new to English\", \"prescan\": \"{\\\"words\\\":118,\\\"sentences\\\":6,\\\"avg_sentence_words\\\":19.7,\\\"grade\\\":12.7,\\\"flesch\\\":39.2,\\\"cefr\\\":\\\"B2\\\",\\\"vocabulary_level\\\":\\\"B2\\\",\\\"sentence_cap\\\":12,\\\"above_target\\\":[\\\"inspection (B1)\\\",\\\"regarding (B1)\\\",\\\"annual (B1)\\\",\\\"property (B1)\\\",\\\"accordance (rare)\\\",\\\"clause (B2)\\\",\\\"tenancy (rare)\\\",\\\"agreement (B1)\\\",\\\"landlord (B1)\\\",\\\"entitled (B2)\\\",\\\"conduct (B1)\\\",\\\"premises (C1)\\\",\\\"minimum (B1)\\\",\\\"written (B1)\\\",\\\"harbour (B1)\\\",\\\"scheduled (B2)\\\",\\\"prove (B1)\\\",\\\"inconvenient (B1)\\\",\\\"management (B1)\\\",\\\"arrange (B1)\\\",\\\"alternative (B1)\\\",\\\"failure (B1)\\\",\\\"respond (B1)\\\",\\\"construed (rare)\\\",\\\"consent (B2)\\\",\\\"proposed (B2)\\\",\\\"arrangement (B1)\\\",\\\"tenants (rare)\\\",\\\"obliged (C1)\\\",\\\"secured (B1)\\\",\\\"duration (C1)\\\"],\\\"facts\\\":[\\\"14\\\",\\\"24\\\",\\\"3\\\",\\\"18\\\",\\\"12\\\",\\\"10\\\",\\\"00\\\",\\\"020\\\",\\\"7946\\\",\\\"0321\\\",\\\"8\\\"],\\\"hardest\\\":[\\\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\\\",\\\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\\\",\\\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\\"]}\"}";
$ch = curl_init("$base/estimate");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => ["Authorization: Bearer $token", "Content-Type: application/json"],
]);
print_r(json_decode(curl_exec($ch), true)["data"]);
using System.Net.Http.Headers;
using System.Text;
var token = "YOUR_TOKEN";
var baseUrl = "https://api.skillsafe.ai/v1/app-api";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var body = new StringContent("{\"task\": \"rewrite\", \"text\": \"Notice regarding the annual inspection of your property\\n\\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\n\\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.\", \"target\": \"A2\", \"target_label\": \"CEFR A2 (elementary)\", \"keep_terms\": \"\", \"audience\": \"tenants who are new to English\", \"prescan\": \"{\\\"words\\\":118,\\\"sentences\\\":6,\\\"avg_sentence_words\\\":19.7,\\\"grade\\\":12.7,\\\"flesch\\\":39.2,\\\"cefr\\\":\\\"B2\\\",\\\"vocabulary_level\\\":\\\"B2\\\",\\\"sentence_cap\\\":12,\\\"above_target\\\":[\\\"inspection (B1)\\\",\\\"regarding (B1)\\\",\\\"annual (B1)\\\",\\\"property (B1)\\\",\\\"accordance (rare)\\\",\\\"clause (B2)\\\",\\\"tenancy (rare)\\\",\\\"agreement (B1)\\\",\\\"landlord (B1)\\\",\\\"entitled (B2)\\\",\\\"conduct (B1)\\\",\\\"premises (C1)\\\",\\\"minimum (B1)\\\",\\\"written (B1)\\\",\\\"harbour (B1)\\\",\\\"scheduled (B2)\\\",\\\"prove (B1)\\\",\\\"inconvenient (B1)\\\",\\\"management (B1)\\\",\\\"arrange (B1)\\\",\\\"alternative (B1)\\\",\\\"failure (B1)\\\",\\\"respond (B1)\\\",\\\"construed (rare)\\\",\\\"consent (B2)\\\",\\\"proposed (B2)\\\",\\\"arrangement (B1)\\\",\\\"tenants (rare)\\\",\\\"obliged (C1)\\\",\\\"secured (B1)\\\",\\\"duration (C1)\\\"],\\\"facts\\\":[\\\"14\\\",\\\"24\\\",\\\"3\\\",\\\"18\\\",\\\"12\\\",\\\"10\\\",\\\"00\\\",\\\"020\\\",\\\"7946\\\",\\\"0321\\\",\\\"8\\\"],\\\"hardest\\\":[\\\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\\\",\\\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\\\",\\\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\\"]}\"}", Encoding.UTF8, "application/json");
var res = await http.PostAsync($"{baseUrl}/estimate", body);
Console.WriteLine(await res.Content.ReadAsStringAsync());
A science text to US grade 5, keeping two terms:
curl -s -X POST "https://api.skillsafe.ai/v1/app-api/estimate" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"task": "rewrite", "text": "Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy. Within the chloroplasts, the pigment chlorophyll absorbs predominantly red and blue wavelengths of sunlight, which is why foliage appears green to the human eye.\n\nThe plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots. The resulting glucose fuels growth and respiration, while oxygen is released into the atmosphere as a by-product. Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.", "target": "G5", "target_label": "US grade 5", "keep_terms": "photosynthesis, chlorophyll", "audience": "a class of 10-year-olds", "prescan": "{\"words\":104,\"sentences\":5,\"avg_sentence_words\":20.8,\"grade\":16.9,\"flesch\":24.7,\"cefr\":\"C2\",\"vocabulary_level\":\"C2\",\"sentence_cap\":11,\"above_target\":[\"energy (B2)\",\"photosynthesis (rare)\",\"biochemical (rare)\",\"algae (rare)\",\"bacteria (rare)\",\"convert (B2)\",\"chloroplasts (rare)\",\"pigment (rare)\",\"chlorophyll (rare)\",\"predominantly (rare)\",\"wavelengths (rare)\",\"foliage (rare)\",\"subsequently (rare)\",\"utilises (B2)\",\"carbon (B2)\",\"microscopic (B2)\",\"pores (rare)\",\"stomata (rare)\",\"glucose (rare)\",\"respiration (B2)\",\"phytoplankton (rare)\",\"terrestrial (rare)\",\"vegetation (C1)\"],\"facts\":[],\"hardest\":[\"The plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots.\",\"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy.\",\"Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\"]}"}'
import requests
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
H = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
body = {
"task": "rewrite",
"text": "Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy. Within the chloroplasts, the pigment chlorophyll absorbs predominantly red and blue wavelengths of sunlight, which is why foliage appears green to the human eye.\n\nThe plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots. The resulting glucose fuels growth and respiration, while oxygen is released into the atmosphere as a by-product. Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.",
"target": "G5",
"target_label": "US grade 5",
"keep_terms": "photosynthesis, chlorophyll",
"audience": "a class of 10-year-olds",
"prescan": "{\"words\":104,\"sentences\":5,\"avg_sentence_words\":20.8,\"grade\":16.9,\"flesch\":24.7,\"cefr\":\"C2\",\"vocabulary_level\":\"C2\",\"sentence_cap\":11,\"above_target\":[\"energy (B2)\",\"photosynthesis (rare)\",\"biochemical (rare)\",\"algae (rare)\",\"bacteria (rare)\",\"convert (B2)\",\"chloroplasts (rare)\",\"pigment (rare)\",\"chlorophyll (rare)\",\"predominantly (rare)\",\"wavelengths (rare)\",\"foliage (rare)\",\"subsequently (rare)\",\"utilises (B2)\",\"carbon (B2)\",\"microscopic (B2)\",\"pores (rare)\",\"stomata (rare)\",\"glucose (rare)\",\"respiration (B2)\",\"phytoplankton (rare)\",\"terrestrial (rare)\",\"vegetation (C1)\"],\"facts\":[],\"hardest\":[\"The plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots.\",\"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy.\",\"Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\"]}"
}
r = requests.post(f"{BASE}/estimate", headers={**H}, json=body, timeout=120).json()
print(r["data"]["hold_credits"])
const TOKEN = "YOUR_TOKEN";
const BASE = "https://api.skillsafe.ai/v1/app-api";
const H = { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json" };
const body = {
"task": "rewrite",
"text": "Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy. Within the chloroplasts, the pigment chlorophyll absorbs predominantly red and blue wavelengths of sunlight, which is why foliage appears green to the human eye.\n\nThe plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots. The resulting glucose fuels growth and respiration, while oxygen is released into the atmosphere as a by-product. Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.",
"target": "G5",
"target_label": "US grade 5",
"keep_terms": "photosynthesis, chlorophyll",
"audience": "a class of 10-year-olds",
"prescan": "{\"words\":104,\"sentences\":5,\"avg_sentence_words\":20.8,\"grade\":16.9,\"flesch\":24.7,\"cefr\":\"C2\",\"vocabulary_level\":\"C2\",\"sentence_cap\":11,\"above_target\":[\"energy (B2)\",\"photosynthesis (rare)\",\"biochemical (rare)\",\"algae (rare)\",\"bacteria (rare)\",\"convert (B2)\",\"chloroplasts (rare)\",\"pigment (rare)\",\"chlorophyll (rare)\",\"predominantly (rare)\",\"wavelengths (rare)\",\"foliage (rare)\",\"subsequently (rare)\",\"utilises (B2)\",\"carbon (B2)\",\"microscopic (B2)\",\"pores (rare)\",\"stomata (rare)\",\"glucose (rare)\",\"respiration (B2)\",\"phytoplankton (rare)\",\"terrestrial (rare)\",\"vegetation (C1)\"],\"facts\":[],\"hardest\":[\"The plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots.\",\"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy.\",\"Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\"]}"
};
const r = await (await fetch(`${BASE}/estimate`, { method: "POST", headers: { ...H }, body: JSON.stringify(body) })).json();
console.log(r.data.hold_credits);
package main
import ("bytes"; "encoding/json"; "fmt"; "net/http")
const base = "https://api.skillsafe.ai/v1/app-api"
const token = "YOUR_TOKEN"
func main() {
payload := []byte(`{"task": "rewrite", "text": "Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy. Within the chloroplasts, the pigment chlorophyll absorbs predominantly red and blue wavelengths of sunlight, which is why foliage appears green to the human eye.\n\nThe plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots. The resulting glucose fuels growth and respiration, while oxygen is released into the atmosphere as a by-product. Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.", "target": "G5", "target_label": "US grade 5", "keep_terms": "photosynthesis, chlorophyll", "audience": "a class of 10-year-olds", "prescan": "{\"words\":104,\"sentences\":5,\"avg_sentence_words\":20.8,\"grade\":16.9,\"flesch\":24.7,\"cefr\":\"C2\",\"vocabulary_level\":\"C2\",\"sentence_cap\":11,\"above_target\":[\"energy (B2)\",\"photosynthesis (rare)\",\"biochemical (rare)\",\"algae (rare)\",\"bacteria (rare)\",\"convert (B2)\",\"chloroplasts (rare)\",\"pigment (rare)\",\"chlorophyll (rare)\",\"predominantly (rare)\",\"wavelengths (rare)\",\"foliage (rare)\",\"subsequently (rare)\",\"utilises (B2)\",\"carbon (B2)\",\"microscopic (B2)\",\"pores (rare)\",\"stomata (rare)\",\"glucose (rare)\",\"respiration (B2)\",\"phytoplankton (rare)\",\"terrestrial (rare)\",\"vegetation (C1)\"],\"facts\":[],\"hardest\":[\"The plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots.\",\"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy.\",\"Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\"]}"}`)
req, _ := http.NewRequest("POST", base+"/estimate", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
var out map[string]any
json.NewDecoder(res.Body).Decode(&out)
fmt.Println(out["data"])
}
var token = "YOUR_TOKEN";
var base = "https://api.skillsafe.ai/v1/app-api";
var http = java.net.http.HttpClient.newHttpClient();
var body = "{\"task\": \"rewrite\", \"text\": \"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy. Within the chloroplasts, the pigment chlorophyll absorbs predominantly red and blue wavelengths of sunlight, which is why foliage appears green to the human eye.\\n\\nThe plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots. The resulting glucose fuels growth and respiration, while oxygen is released into the atmosphere as a by-product. Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\", \"target\": \"G5\", \"target_label\": \"US grade 5\", \"keep_terms\": \"photosynthesis, chlorophyll\", \"audience\": \"a class of 10-year-olds\", \"prescan\": \"{\\\"words\\\":104,\\\"sentences\\\":5,\\\"avg_sentence_words\\\":20.8,\\\"grade\\\":16.9,\\\"flesch\\\":24.7,\\\"cefr\\\":\\\"C2\\\",\\\"vocabulary_level\\\":\\\"C2\\\",\\\"sentence_cap\\\":11,\\\"above_target\\\":[\\\"energy (B2)\\\",\\\"photosynthesis (rare)\\\",\\\"biochemical (rare)\\\",\\\"algae (rare)\\\",\\\"bacteria (rare)\\\",\\\"convert (B2)\\\",\\\"chloroplasts (rare)\\\",\\\"pigment (rare)\\\",\\\"chlorophyll (rare)\\\",\\\"predominantly (rare)\\\",\\\"wavelengths (rare)\\\",\\\"foliage (rare)\\\",\\\"subsequently (rare)\\\",\\\"utilises (B2)\\\",\\\"carbon (B2)\\\",\\\"microscopic (B2)\\\",\\\"pores (rare)\\\",\\\"stomata (rare)\\\",\\\"glucose (rare)\\\",\\\"respiration (B2)\\\",\\\"phytoplankton (rare)\\\",\\\"terrestrial (rare)\\\",\\\"vegetation (C1)\\\"],\\\"facts\\\":[],\\\"hardest\\\":[\\\"The plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots.\\\",\\\"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy.\\\",\\\"Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\\\"]}\"}";
var req = java.net.http.HttpRequest.newBuilder(java.net.URI.create(base + "/estimate"))
.header("Authorization", "Bearer " + token).header("Content-Type", "application/json")
.POST(java.net.http.HttpRequest.BodyPublishers.ofString(body)).build();
System.out.println(http.send(req, java.net.http.HttpResponse.BodyHandlers.ofString()).body());
require "net/http"
require "json"
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
uri = URI("#{BASE}/estimate")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{TOKEN}"
req["Content-Type"] = "application/json"
req.body = "{\"task\": \"rewrite\", \"text\": \"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy. Within the chloroplasts, the pigment chlorophyll absorbs predominantly red and blue wavelengths of sunlight, which is why foliage appears green to the human eye.\\n\\nThe plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots. The resulting glucose fuels growth and respiration, while oxygen is released into the atmosphere as a by-product. Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\", \"target\": \"G5\", \"target_label\": \"US grade 5\", \"keep_terms\": \"photosynthesis, chlorophyll\", \"audience\": \"a class of 10-year-olds\", \"prescan\": \"{\\\"words\\\":104,\\\"sentences\\\":5,\\\"avg_sentence_words\\\":20.8,\\\"grade\\\":16.9,\\\"flesch\\\":24.7,\\\"cefr\\\":\\\"C2\\\",\\\"vocabulary_level\\\":\\\"C2\\\",\\\"sentence_cap\\\":11,\\\"above_target\\\":[\\\"energy (B2)\\\",\\\"photosynthesis (rare)\\\",\\\"biochemical (rare)\\\",\\\"algae (rare)\\\",\\\"bacteria (rare)\\\",\\\"convert (B2)\\\",\\\"chloroplasts (rare)\\\",\\\"pigment (rare)\\\",\\\"chlorophyll (rare)\\\",\\\"predominantly (rare)\\\",\\\"wavelengths (rare)\\\",\\\"foliage (rare)\\\",\\\"subsequently (rare)\\\",\\\"utilises (B2)\\\",\\\"carbon (B2)\\\",\\\"microscopic (B2)\\\",\\\"pores (rare)\\\",\\\"stomata (rare)\\\",\\\"glucose (rare)\\\",\\\"respiration (B2)\\\",\\\"phytoplankton (rare)\\\",\\\"terrestrial (rare)\\\",\\\"vegetation (C1)\\\"],\\\"facts\\\":[],\\\"hardest\\\":[\\\"The plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots.\\\",\\\"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy.\\\",\\\"Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\\\"]}\"}"
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
puts JSON.parse(res.body)["data"]
<?php
$token = "YOUR_TOKEN";
$base = "https://api.skillsafe.ai/v1/app-api";
$body = "{\"task\": \"rewrite\", \"text\": \"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy. Within the chloroplasts, the pigment chlorophyll absorbs predominantly red and blue wavelengths of sunlight, which is why foliage appears green to the human eye.\\n\\nThe plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots. The resulting glucose fuels growth and respiration, while oxygen is released into the atmosphere as a by-product. Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\", \"target\": \"G5\", \"target_label\": \"US grade 5\", \"keep_terms\": \"photosynthesis, chlorophyll\", \"audience\": \"a class of 10-year-olds\", \"prescan\": \"{\\\"words\\\":104,\\\"sentences\\\":5,\\\"avg_sentence_words\\\":20.8,\\\"grade\\\":16.9,\\\"flesch\\\":24.7,\\\"cefr\\\":\\\"C2\\\",\\\"vocabulary_level\\\":\\\"C2\\\",\\\"sentence_cap\\\":11,\\\"above_target\\\":[\\\"energy (B2)\\\",\\\"photosynthesis (rare)\\\",\\\"biochemical (rare)\\\",\\\"algae (rare)\\\",\\\"bacteria (rare)\\\",\\\"convert (B2)\\\",\\\"chloroplasts (rare)\\\",\\\"pigment (rare)\\\",\\\"chlorophyll (rare)\\\",\\\"predominantly (rare)\\\",\\\"wavelengths (rare)\\\",\\\"foliage (rare)\\\",\\\"subsequently (rare)\\\",\\\"utilises (B2)\\\",\\\"carbon (B2)\\\",\\\"microscopic (B2)\\\",\\\"pores (rare)\\\",\\\"stomata (rare)\\\",\\\"glucose (rare)\\\",\\\"respiration (B2)\\\",\\\"phytoplankton (rare)\\\",\\\"terrestrial (rare)\\\",\\\"vegetation (C1)\\\"],\\\"facts\\\":[],\\\"hardest\\\":[\\\"The plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots.\\\",\\\"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy.\\\",\\\"Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\\\"]}\"}";
$ch = curl_init("$base/estimate");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => ["Authorization: Bearer $token", "Content-Type: application/json"],
]);
print_r(json_decode(curl_exec($ch), true)["data"]);
using System.Net.Http.Headers;
using System.Text;
var token = "YOUR_TOKEN";
var baseUrl = "https://api.skillsafe.ai/v1/app-api";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var body = new StringContent("{\"task\": \"rewrite\", \"text\": \"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy. Within the chloroplasts, the pigment chlorophyll absorbs predominantly red and blue wavelengths of sunlight, which is why foliage appears green to the human eye.\\n\\nThe plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots. The resulting glucose fuels growth and respiration, while oxygen is released into the atmosphere as a by-product. Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\", \"target\": \"G5\", \"target_label\": \"US grade 5\", \"keep_terms\": \"photosynthesis, chlorophyll\", \"audience\": \"a class of 10-year-olds\", \"prescan\": \"{\\\"words\\\":104,\\\"sentences\\\":5,\\\"avg_sentence_words\\\":20.8,\\\"grade\\\":16.9,\\\"flesch\\\":24.7,\\\"cefr\\\":\\\"C2\\\",\\\"vocabulary_level\\\":\\\"C2\\\",\\\"sentence_cap\\\":11,\\\"above_target\\\":[\\\"energy (B2)\\\",\\\"photosynthesis (rare)\\\",\\\"biochemical (rare)\\\",\\\"algae (rare)\\\",\\\"bacteria (rare)\\\",\\\"convert (B2)\\\",\\\"chloroplasts (rare)\\\",\\\"pigment (rare)\\\",\\\"chlorophyll (rare)\\\",\\\"predominantly (rare)\\\",\\\"wavelengths (rare)\\\",\\\"foliage (rare)\\\",\\\"subsequently (rare)\\\",\\\"utilises (B2)\\\",\\\"carbon (B2)\\\",\\\"microscopic (B2)\\\",\\\"pores (rare)\\\",\\\"stomata (rare)\\\",\\\"glucose (rare)\\\",\\\"respiration (B2)\\\",\\\"phytoplankton (rare)\\\",\\\"terrestrial (rare)\\\",\\\"vegetation (C1)\\\"],\\\"facts\\\":[],\\\"hardest\\\":[\\\"The plant subsequently utilises this captured energy to combine carbon dioxide, absorbed through microscopic pores called stomata, with water transported upward from the roots.\\\",\\\"Photosynthesis is the biochemical process by which green plants, algae and certain bacteria convert light energy into chemical energy.\\\",\\\"Scientists estimate that roughly half of the oxygen on Earth is generated by marine phytoplankton rather than by terrestrial vegetation.\\\"]}\"}", Encoding.UTF8, "application/json");
var res = await http.PostAsync($"{baseUrl}/estimate", body);
Console.WriteLine(await res.Content.ReadAsStringAsync());
4. Run and poll
/run returns a job. Always send an Idempotency-Key — the same key is the same run, so a retry cannot bill twice. The web app derives it from a hash of the input plus an attempt number for its one automatic reformat retry.
curl -s -X POST "https://api.skillsafe.ai/v1/app-api/run" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: readability-check:rewrite:1q8z4k-3c2:a1" \
-d '{"task": "rewrite", "text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours'\'' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.", "target": "A2", "target_label": "CEFR A2 (elementary)", "keep_terms": "", "audience": "tenants who are new to English", "prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours'\'' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"}'
import requests
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
H = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
body = {
"task": "rewrite",
"text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.",
"target": "A2",
"target_label": "CEFR A2 (elementary)",
"keep_terms": "",
"audience": "tenants who are new to English",
"prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"
}
r = requests.post(f"{BASE}/run", headers={**H, "Idempotency-Key": "readability-check:rewrite:1q8z4k-3c2:a1"}, json=body, timeout=120).json()
job_id = r["data"]["job_id"]
const TOKEN = "YOUR_TOKEN";
const BASE = "https://api.skillsafe.ai/v1/app-api";
const H = { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json" };
const body = {
"task": "rewrite",
"text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.",
"target": "A2",
"target_label": "CEFR A2 (elementary)",
"keep_terms": "",
"audience": "tenants who are new to English",
"prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"
};
const r = await (await fetch(`${BASE}/run`, { method: "POST", headers: { ...H, "Idempotency-Key": "readability-check:rewrite:1q8z4k-3c2:a1" }, body: JSON.stringify(body) })).json();
const jobId = r.data.job_id;
package main
import ("bytes"; "encoding/json"; "fmt"; "net/http")
const base = "https://api.skillsafe.ai/v1/app-api"
const token = "YOUR_TOKEN"
func main() {
payload := []byte(`{"task": "rewrite", "text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.", "target": "A2", "target_label": "CEFR A2 (elementary)", "keep_terms": "", "audience": "tenants who are new to English", "prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"}`)
req, _ := http.NewRequest("POST", base+"/run", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "readability-check:rewrite:1q8z4k-3c2:a1")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
var out map[string]any
json.NewDecoder(res.Body).Decode(&out)
fmt.Println(out["data"])
}
var token = "YOUR_TOKEN";
var base = "https://api.skillsafe.ai/v1/app-api";
var http = java.net.http.HttpClient.newHttpClient();
var body = "{\"task\": \"rewrite\", \"text\": \"Notice regarding the annual inspection of your property\\n\\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\n\\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.\", \"target\": \"A2\", \"target_label\": \"CEFR A2 (elementary)\", \"keep_terms\": \"\", \"audience\": \"tenants who are new to English\", \"prescan\": \"{\\\"words\\\":118,\\\"sentences\\\":6,\\\"avg_sentence_words\\\":19.7,\\\"grade\\\":12.7,\\\"flesch\\\":39.2,\\\"cefr\\\":\\\"B2\\\",\\\"vocabulary_level\\\":\\\"B2\\\",\\\"sentence_cap\\\":12,\\\"above_target\\\":[\\\"inspection (B1)\\\",\\\"regarding (B1)\\\",\\\"annual (B1)\\\",\\\"property (B1)\\\",\\\"accordance (rare)\\\",\\\"clause (B2)\\\",\\\"tenancy (rare)\\\",\\\"agreement (B1)\\\",\\\"landlord (B1)\\\",\\\"entitled (B2)\\\",\\\"conduct (B1)\\\",\\\"premises (C1)\\\",\\\"minimum (B1)\\\",\\\"written (B1)\\\",\\\"harbour (B1)\\\",\\\"scheduled (B2)\\\",\\\"prove (B1)\\\",\\\"inconvenient (B1)\\\",\\\"management (B1)\\\",\\\"arrange (B1)\\\",\\\"alternative (B1)\\\",\\\"failure (B1)\\\",\\\"respond (B1)\\\",\\\"construed (rare)\\\",\\\"consent (B2)\\\",\\\"proposed (B2)\\\",\\\"arrangement (B1)\\\",\\\"tenants (rare)\\\",\\\"obliged (C1)\\\",\\\"secured (B1)\\\",\\\"duration (C1)\\\"],\\\"facts\\\":[\\\"14\\\",\\\"24\\\",\\\"3\\\",\\\"18\\\",\\\"12\\\",\\\"10\\\",\\\"00\\\",\\\"020\\\",\\\"7946\\\",\\\"0321\\\",\\\"8\\\"],\\\"hardest\\\":[\\\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\\\",\\\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\\\",\\\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\\"]}\"}";
var req = java.net.http.HttpRequest.newBuilder(java.net.URI.create(base + "/run"))
.header("Authorization", "Bearer " + token).header("Content-Type", "application/json")
.header("Idempotency-Key", "readability-check:rewrite:1q8z4k-3c2:a1")
.POST(java.net.http.HttpRequest.BodyPublishers.ofString(body)).build();
System.out.println(http.send(req, java.net.http.HttpResponse.BodyHandlers.ofString()).body());
require "net/http"
require "json"
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
uri = URI("#{BASE}/run")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{TOKEN}"
req["Content-Type"] = "application/json"
req["Idempotency-Key"] = "readability-check:rewrite:1q8z4k-3c2:a1"
req.body = "{\"task\": \"rewrite\", \"text\": \"Notice regarding the annual inspection of your property\\n\\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\n\\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.\", \"target\": \"A2\", \"target_label\": \"CEFR A2 (elementary)\", \"keep_terms\": \"\", \"audience\": \"tenants who are new to English\", \"prescan\": \"{\\\"words\\\":118,\\\"sentences\\\":6,\\\"avg_sentence_words\\\":19.7,\\\"grade\\\":12.7,\\\"flesch\\\":39.2,\\\"cefr\\\":\\\"B2\\\",\\\"vocabulary_level\\\":\\\"B2\\\",\\\"sentence_cap\\\":12,\\\"above_target\\\":[\\\"inspection (B1)\\\",\\\"regarding (B1)\\\",\\\"annual (B1)\\\",\\\"property (B1)\\\",\\\"accordance (rare)\\\",\\\"clause (B2)\\\",\\\"tenancy (rare)\\\",\\\"agreement (B1)\\\",\\\"landlord (B1)\\\",\\\"entitled (B2)\\\",\\\"conduct (B1)\\\",\\\"premises (C1)\\\",\\\"minimum (B1)\\\",\\\"written (B1)\\\",\\\"harbour (B1)\\\",\\\"scheduled (B2)\\\",\\\"prove (B1)\\\",\\\"inconvenient (B1)\\\",\\\"management (B1)\\\",\\\"arrange (B1)\\\",\\\"alternative (B1)\\\",\\\"failure (B1)\\\",\\\"respond (B1)\\\",\\\"construed (rare)\\\",\\\"consent (B2)\\\",\\\"proposed (B2)\\\",\\\"arrangement (B1)\\\",\\\"tenants (rare)\\\",\\\"obliged (C1)\\\",\\\"secured (B1)\\\",\\\"duration (C1)\\\"],\\\"facts\\\":[\\\"14\\\",\\\"24\\\",\\\"3\\\",\\\"18\\\",\\\"12\\\",\\\"10\\\",\\\"00\\\",\\\"020\\\",\\\"7946\\\",\\\"0321\\\",\\\"8\\\"],\\\"hardest\\\":[\\\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\\\",\\\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\\\",\\\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\\"]}\"}"
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
puts JSON.parse(res.body)["data"]
<?php
$token = "YOUR_TOKEN";
$base = "https://api.skillsafe.ai/v1/app-api";
$body = "{\"task\": \"rewrite\", \"text\": \"Notice regarding the annual inspection of your property\\n\\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\n\\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.\", \"target\": \"A2\", \"target_label\": \"CEFR A2 (elementary)\", \"keep_terms\": \"\", \"audience\": \"tenants who are new to English\", \"prescan\": \"{\\\"words\\\":118,\\\"sentences\\\":6,\\\"avg_sentence_words\\\":19.7,\\\"grade\\\":12.7,\\\"flesch\\\":39.2,\\\"cefr\\\":\\\"B2\\\",\\\"vocabulary_level\\\":\\\"B2\\\",\\\"sentence_cap\\\":12,\\\"above_target\\\":[\\\"inspection (B1)\\\",\\\"regarding (B1)\\\",\\\"annual (B1)\\\",\\\"property (B1)\\\",\\\"accordance (rare)\\\",\\\"clause (B2)\\\",\\\"tenancy (rare)\\\",\\\"agreement (B1)\\\",\\\"landlord (B1)\\\",\\\"entitled (B2)\\\",\\\"conduct (B1)\\\",\\\"premises (C1)\\\",\\\"minimum (B1)\\\",\\\"written (B1)\\\",\\\"harbour (B1)\\\",\\\"scheduled (B2)\\\",\\\"prove (B1)\\\",\\\"inconvenient (B1)\\\",\\\"management (B1)\\\",\\\"arrange (B1)\\\",\\\"alternative (B1)\\\",\\\"failure (B1)\\\",\\\"respond (B1)\\\",\\\"construed (rare)\\\",\\\"consent (B2)\\\",\\\"proposed (B2)\\\",\\\"arrangement (B1)\\\",\\\"tenants (rare)\\\",\\\"obliged (C1)\\\",\\\"secured (B1)\\\",\\\"duration (C1)\\\"],\\\"facts\\\":[\\\"14\\\",\\\"24\\\",\\\"3\\\",\\\"18\\\",\\\"12\\\",\\\"10\\\",\\\"00\\\",\\\"020\\\",\\\"7946\\\",\\\"0321\\\",\\\"8\\\"],\\\"hardest\\\":[\\\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\\\",\\\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\\\",\\\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\\"]}\"}";
$ch = curl_init("$base/run");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => ["Authorization: Bearer $token", "Content-Type: application/json", "Idempotency-Key: readability-check:rewrite:1q8z4k-3c2:a1"],
]);
print_r(json_decode(curl_exec($ch), true)["data"]);
using System.Net.Http.Headers;
using System.Text;
var token = "YOUR_TOKEN";
var baseUrl = "https://api.skillsafe.ai/v1/app-api";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var body = new StringContent("{\"task\": \"rewrite\", \"text\": \"Notice regarding the annual inspection of your property\\n\\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\n\\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.\", \"target\": \"A2\", \"target_label\": \"CEFR A2 (elementary)\", \"keep_terms\": \"\", \"audience\": \"tenants who are new to English\", \"prescan\": \"{\\\"words\\\":118,\\\"sentences\\\":6,\\\"avg_sentence_words\\\":19.7,\\\"grade\\\":12.7,\\\"flesch\\\":39.2,\\\"cefr\\\":\\\"B2\\\",\\\"vocabulary_level\\\":\\\"B2\\\",\\\"sentence_cap\\\":12,\\\"above_target\\\":[\\\"inspection (B1)\\\",\\\"regarding (B1)\\\",\\\"annual (B1)\\\",\\\"property (B1)\\\",\\\"accordance (rare)\\\",\\\"clause (B2)\\\",\\\"tenancy (rare)\\\",\\\"agreement (B1)\\\",\\\"landlord (B1)\\\",\\\"entitled (B2)\\\",\\\"conduct (B1)\\\",\\\"premises (C1)\\\",\\\"minimum (B1)\\\",\\\"written (B1)\\\",\\\"harbour (B1)\\\",\\\"scheduled (B2)\\\",\\\"prove (B1)\\\",\\\"inconvenient (B1)\\\",\\\"management (B1)\\\",\\\"arrange (B1)\\\",\\\"alternative (B1)\\\",\\\"failure (B1)\\\",\\\"respond (B1)\\\",\\\"construed (rare)\\\",\\\"consent (B2)\\\",\\\"proposed (B2)\\\",\\\"arrangement (B1)\\\",\\\"tenants (rare)\\\",\\\"obliged (C1)\\\",\\\"secured (B1)\\\",\\\"duration (C1)\\\"],\\\"facts\\\":[\\\"14\\\",\\\"24\\\",\\\"3\\\",\\\"18\\\",\\\"12\\\",\\\"10\\\",\\\"00\\\",\\\"020\\\",\\\"7946\\\",\\\"0321\\\",\\\"8\\\"],\\\"hardest\\\":[\\\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\\\",\\\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\\\",\\\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\\\"]}\"}", Encoding.UTF8, "application/json");
http.DefaultRequestHeaders.Add("Idempotency-Key", "readability-check:rewrite:1q8z4k-3c2:a1");
var res = await http.PostAsync($"{baseUrl}/run", body);
Console.WriteLine(await res.Content.ReadAsStringAsync());
curl -s "https://api.skillsafe.ai/v1/app-api/jobs/JOB_ID" \ -H "Authorization: Bearer YOUR_TOKEN" # repeat until data.status is "succeeded" or "failed"; # the rewrite is the JSON string at data.output.output
import requests
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
H = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
import json, time
job_id = "JOB_ID"
while True:
job = requests.get(f"{BASE}/jobs/{job_id}", headers=H, timeout=30).json()["data"]
if job["status"] in ("succeeded", "failed"):
break
time.sleep(1)
out = json.loads(job["output"]["output"].strip().strip("`").removeprefix("json"))
print(out["status"], out["rewrite"])
const TOKEN = "YOUR_TOKEN";
const BASE = "https://api.skillsafe.ai/v1/app-api";
const H = { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json" };
let job;
for (;;) {
job = (await (await fetch(`${BASE}/jobs/JOB_ID`, { headers: H })).json()).data;
if (job.status === "succeeded" || job.status === "failed") break;
await new Promise((r) => setTimeout(r, 1000));
}
const out = JSON.parse(job.output.output.replace(/^```(?:json)?\s*|\s*```$/g, ""));
console.log(out.status, out.rewrite);
package main
import ("bytes"; "encoding/json"; "fmt"; "net/http")
const base = "https://api.skillsafe.ai/v1/app-api"
const token = "YOUR_TOKEN"
// GET base+"/jobs/JOB_ID" every second until data.status is
// "succeeded" or "failed", then json.Unmarshal data.output.output.
func main() { fmt.Println("poll", base+"/jobs/JOB_ID"); _ = bytes.NewReader; _ = json.Marshal; _ = http.Get }
var token = "YOUR_TOKEN"; var base = "https://api.skillsafe.ai/v1/app-api"; var http = java.net.http.HttpClient.newHttpClient(); // GET base + "/jobs/JOB_ID" every second until data.status is // "succeeded" or "failed"; the rewrite is the JSON string at data.output.output.
require "net/http"
require "json"
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
loop do
uri = URI("#{BASE}/jobs/JOB_ID")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{TOKEN}"
job = JSON.parse(Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }.body)["data"]
if %w[succeeded failed].include?(job["status"])
puts JSON.parse(job["output"]["output"])["rewrite"]
break
end
sleep 1
end
<?php
$token = "YOUR_TOKEN";
$base = "https://api.skillsafe.ai/v1/app-api";
do {
$ch = curl_init("$base/jobs/JOB_ID");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["Authorization: Bearer $token"]]);
$job = json_decode(curl_exec($ch), true)["data"];
if (!in_array($job["status"], ["succeeded", "failed"])) sleep(1);
} while (!in_array($job["status"], ["succeeded", "failed"]));
echo json_decode($job["output"]["output"], true)["rewrite"];
using System.Net.Http.Headers;
using System.Text;
var token = "YOUR_TOKEN";
var baseUrl = "https://api.skillsafe.ai/v1/app-api";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// GET {baseUrl}/jobs/JOB_ID every second until data.status is
// "succeeded" or "failed"; the rewrite is the JSON string at data.output.output.
5. Stream it
/run-stream answers with server-sent events and ends with a done frame carrying the whole output, charged_credits and truncated. If truncated is true the balance ran low mid-answer: the rewrite stops early; top up and run again.
curl -sN -X POST "https://api.skillsafe.ai/v1/app-api/run-stream" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-H "Idempotency-Key: readability-check:rewrite:1q8z4k-3c2:a1" \
-d '{"task": "rewrite", "text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours'\'' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.", "target": "A2", "target_label": "CEFR A2 (elementary)", "keep_terms": "", "audience": "tenants who are new to English", "prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours'\'' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"}'
# event: job data: {"job_id": ...}
# event: delta data: {"text": "..."} (may be absent: a browser often gets only
# event: tick heartbeats and the whole answer in the final frame)
# event: done data: {"output": {"output": "<the JSON rewrite>"}, "charged_credits": ..., "truncated": false}
import requests
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
H = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
import json
body = {"task": "rewrite", "text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.", "target": "A2", "target_label": "CEFR A2 (elementary)", "keep_terms": "", "audience": "tenants who are new to English", "prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"}
with requests.post(f"{BASE}/run-stream", json=body, stream=True, timeout=300,
headers={**H, "Accept": "text/event-stream", "Idempotency-Key": "readability-check:rewrite:1q8z4k-3c2:a1"}) as r:
event, done = None, None
for line in r.iter_lines(decode_unicode=True):
if line.startswith("event:"): event = line[6:].strip()
elif line.startswith("data:") and event == "done": done = json.loads(line[5:])
out = json.loads(done["output"]["output"].strip().strip("`").removeprefix("json"))
print(out["rewrite"], done.get("charged_credits"), done.get("truncated"))
const TOKEN = "YOUR_TOKEN";
const BASE = "https://api.skillsafe.ai/v1/app-api";
const H = { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json" };
const res = await fetch(`${BASE}/run-stream`, { method: "POST",
headers: { ...H, Accept: "text/event-stream", "Idempotency-Key": "readability-check:rewrite:1q8z4k-3c2:a1" },
body: JSON.stringify({"task": "rewrite", "text": "Notice regarding the annual inspection of your property\n\nIn accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice. Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\n\nShould this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date. Failure to respond will be construed as consent to the proposed arrangement. Tenants are not obliged to be present; however, any pets must be secured for the duration of the visit.", "target": "A2", "target_label": "CEFR A2 (elementary)", "keep_terms": "", "audience": "tenants who are new to English", "prescan": "{\"words\":118,\"sentences\":6,\"avg_sentence_words\":19.7,\"grade\":12.7,\"flesch\":39.2,\"cefr\":\"B2\",\"vocabulary_level\":\"B2\",\"sentence_cap\":12,\"above_target\":[\"inspection (B1)\",\"regarding (B1)\",\"annual (B1)\",\"property (B1)\",\"accordance (rare)\",\"clause (B2)\",\"tenancy (rare)\",\"agreement (B1)\",\"landlord (B1)\",\"entitled (B2)\",\"conduct (B1)\",\"premises (C1)\",\"minimum (B1)\",\"written (B1)\",\"harbour (B1)\",\"scheduled (B2)\",\"prove (B1)\",\"inconvenient (B1)\",\"management (B1)\",\"arrange (B1)\",\"alternative (B1)\",\"failure (B1)\",\"respond (B1)\",\"construed (rare)\",\"consent (B2)\",\"proposed (B2)\",\"arrangement (B1)\",\"tenants (rare)\",\"obliged (C1)\",\"secured (B1)\",\"duration (C1)\"],\"facts\":[\"14\",\"24\",\"3\",\"18\",\"12\",\"10\",\"00\",\"020\",\"7946\",\"0321\",\"8\"],\"hardest\":[\"In accordance with clause 14 of your tenancy agreement, the landlord is entitled to conduct an inspection of the premises upon providing a minimum of 24 hours' written notice.\",\"Should this appointment prove inconvenient, kindly contact the management office on 020 7946 0321 no later than Friday 8 November to arrange an alternative date.\",\"Please be advised that the inspection of Flat 3, 18 Harbour Road, has been scheduled for Tuesday 12 November between 10:00 and 12:00.\"]}"}) });
const text = await res.text(); // or read res.body incrementally
let done = null;
for (const frame of text.split("\n\n")) {
const ev = /^event: *(.*)$/m.exec(frame), data = /^data: *(.*)$/m.exec(frame);
if (ev && ev[1] === "done" && data) done = JSON.parse(data[1]);
}
const out = JSON.parse(done.output.output.replace(/^```(?:json)?\s*|\s*```$/g, ""));
console.log(out.rewrite, done.truncated);
package main
import ("bytes"; "encoding/json"; "fmt"; "net/http")
const base = "https://api.skillsafe.ai/v1/app-api"
const token = "YOUR_TOKEN"
// POST base+"/run-stream" with Accept: text/event-stream, read lines with
// bufio.Scanner, and json.Unmarshal the data line of the "done" event.
func main() { fmt.Println("see the cURL tab for the frame format"); _ = bytes.NewReader; _ = json.Marshal; _ = http.Get }
var token = "YOUR_TOKEN"; var base = "https://api.skillsafe.ai/v1/app-api"; var http = java.net.http.HttpClient.newHttpClient(); // POST base + "/run-stream" with Accept: text/event-stream, read the body // line by line (BodyHandlers.ofLines()), and parse the data line of the "done" event.
require "net/http"
require "json"
TOKEN = "YOUR_TOKEN"
BASE = "https://api.skillsafe.ai/v1/app-api"
# POST to "#{BASE}/run-stream" with Accept: text/event-stream; read the body,
# split frames on blank lines, and JSON.parse the data line of the "done" event.
<?php $token = "YOUR_TOKEN"; $base = "https://api.skillsafe.ai/v1/app-api"; // POST to "$base/run-stream" with Accept: text/event-stream; split the body on // blank lines and json_decode the data line of the "done" event.
using System.Net.Http.Headers;
using System.Text;
var token = "YOUR_TOKEN";
var baseUrl = "https://api.skillsafe.ai/v1/app-api";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// POST {baseUrl}/run-stream with Accept: text/event-stream; read the response
// stream line by line and parse the data line of the "done" event.