The plumbing every AI app eventually needs but nobody talks about. Stateless helper endpoints for cleaning up LLM-generated output - fixing busted JSON, stripping the AI tells from text, naturalising robotic wording. Free with any Qai key.
If you've shipped an LLM feature, you've had these two debugging days. Morning one: the model returned JSON wrapped in triple backticks and your parser exploded. Morning two: a customer flagged that the auto-generated email "sounded like AI" — em dashes, smart quotes, the word "delve" three times in one paragraph.
These utilities fix those problems as standalone endpoints. No need to spend tokens cleaning up another model's output. String in, sanitised string out.
LLMs love wrapping JSON in markdown fences, prefixing it with "Here you go!", and sprinkling in trailing commas. This endpoint takes a raw string and recovers valid JSON from the mess. It progressively applies fixes until it gets a clean parse, and tells you exactly what it corrected.
curl -X POST https://llm.quickcasa.ai/v1/utilities/clean-json \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "input": "```json\n{\"name\": \"Pat\", \"role\": \"CTO\",}\n```" }'
const response = await fetch('https://llm.quickcasa.ai/v1/utilities/clean-json', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY', }, body: JSON.stringify({ input: '```json\n{"name": "Pat", "role": "CTO",}\n```', }), }); const { data, corrections } = await response.json(); console.log(data); // { name: "Pat", role: "CTO" } console.log(corrections); // ["Removed markdown code fences", "Removed trailing commas"]
import requests response = requests.post( "https://llm.quickcasa.ai/v1/utilities/clean-json", headers={ "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_KEY", }, json={ "input": '```json\n{"name": "Pat", "role": "CTO",}\n```', }, ) result = response.json() print(result["data"]) # {"name": "Pat", "role": "CTO"} print(result["corrections"]) # ["Removed markdown code fences", "Removed trailing commas"]
$ch = curl_init('https://llm.quickcasa.ai/v1/utilities/clean-json'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: Bearer YOUR_API_KEY', ], CURLOPT_POSTFIELDS => json_encode([ 'input' => '```json\n{"name": "Pat", "role": "CTO",}\n```', ]), ]); $result = json_decode(curl_exec($ch), true); curl_close($ch); print_r($result['data']); // ["name" => "Pat", "role" => "CTO"] print_r($result['corrections']); // ["Removed markdown code fences", "Removed trailing commas"]
LLMs have a distinct typographic fingerprint: em dashes, curly quotes, fancy ellipses, exotic whitespace characters. This endpoint strips all of that out and replaces it with plain, human-typed equivalents. Optionally, pass naturalizeWording: true to run the text through a lightweight LLM that detects and rephrases AI-sounding wording without changing the meaning.
curl -X POST https://llm.quickcasa.ai/v1/utilities/humanize-text \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "input": "It\u2019s important to note that this feature \u2014 which leverages cutting-edge technology \u2014 will transform your workflow.", "naturalizeWording": true }'
const response = await fetch('https://llm.quickcasa.ai/v1/utilities/humanize-text', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY', }, body: JSON.stringify({ input: 'It’s important to note that this feature — which leverages cutting-edge technology — will transform your workflow.', naturalizeWording: true, }), }); const { text, corrections, naturalized } = await response.json(); console.log(text); // cleaned + rephrased text console.log(naturalized); // true (wording was rephrased) console.log(corrections); // ["Replaced curly single quotes...", "Replaced em dashes...", ...]
import requests response = requests.post( "https://llm.quickcasa.ai/v1/utilities/humanize-text", headers={ "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_KEY", }, json={ "input": "It’s important to note that this feature — which leverages cutting-edge technology — will transform your workflow.", "naturalizeWording": True, }, ) result = response.json() print(result["text"]) # cleaned + rephrased text print(result["naturalized"]) # True (wording was rephrased) print(result["corrections"]) # ["Replaced curly single quotes...", "Replaced em dashes...", ...]
$ch = curl_init('https://llm.quickcasa.ai/v1/utilities/humanize-text'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: Bearer YOUR_API_KEY', ], CURLOPT_POSTFIELDS => json_encode([ 'input' => "It’s important to note that this feature — which leverages cutting-edge technology — will transform your workflow.", 'naturalizeWording' => true, ]), ]); $result = json_decode(curl_exec($ch), true); curl_close($ch); echo $result['text']; // cleaned + rephrased text echo $result['naturalized']; // true print_r($result['corrections']); // ["Replaced curly single quotes...", ...]
Quick guide to picking the right utility for a problem.
naturalizeWording: true.naturalizeWording: false.
Utilities are free with any Qai API key. They do not consume LLM tokens (except in the optional naturalizeWording: true mode of Humanize Text, which routes through a small text model to do the rephrasing). You can call them as often as your account-wide rate limit allows.
Why free? Because making you pay LLM tokens to fix LLM output would be obnoxious. We absorb the regex and the small naturalisation calls as part of being a good citizen of the AI stack.
Q. Can I use these without signing up?
No. You need a free Qai account so we can rate-limit per key. Signup is two minutes.
Q. Do these utilities work with output from other providers (OpenAI, Anthropic, etc.)?
Yes. The input is just a string. We do not care which model produced it.
Q. What if Clean JSON cannot recover valid JSON from my input?
You get a 200 response with success: false and a list of every fix it tried. No exception thrown - your app stays in control of the fallback.
Q. Can I propose a new utility?
Please do. Email hi@quickcasa.ai with the use case. We are actively adding new ones - the bar is "I have hit this problem more than twice in my own builds."
Q. What is on the utility roadmap?
PII redaction, code fence extraction, markdown to plain text, plain text to safe HTML, sentiment scoring, language detection, basic moderation. All same shape: in goes a string, out comes a transformed string plus a record of what changed.