Guides
Using Findings
The API returns findings and leaves the decisions to you. These recipes show common ways to act on them.
Deciding What Passes
The API gives no verdict, so the rule for what passes is yours to write. A simple rule is that a text passes when findings_count.red is 0. Treat yellow findings as a prompt for a judgment call, and blue findings as optional polish.
This script checks a file and fails when it has a red finding, so you can run it in your CI. Keep the key in a secret, and a non-zero exit code will fail the build.
import os
import sys
import requests
with open(sys.argv[1], encoding="utf-8") as file:
text = file.read()
response = requests.post(
"https://platform-api.getellora.com/v1/detect",
headers={"Authorization": f"Bearer {os.environ['ELLORA_API_KEY']}"},
json={"text": text},
timeout=10,
)
response.raise_for_status()
red = [f for f in response.json()["findings"] if f["severity"] == "red"]
for finding in red:
where = f"sentence {finding['sentence']}" if finding["sentence"] else "the text as a whole"
print(f"{where}: {finding['reason']}\n Suggestion: {finding['suggestion']}")
sys.exit(1 if red else 0)Run it with python check_text.py draft.md.
Rewriting and Checking Again
The API never rewrites your text. To improve a draft, send it, rewrite the sentences that have red findings, by hand or with your own tool, and send it again. Each finding gives you the excerpt to change, the reason it was flagged, and a short suggestion. The suggestion is a hint, not a replacement sentence.
Stop when red is 0, or after a fixed number of passes. Each pass is a call, and every call is charged.
text = open("draft.md", encoding="utf-8").read()
for attempt in range(3):
result = check(text) # sends the text to the API and returns the response
if result["findings_count"]["red"] == 0:
break
text = rewrite(text, result["findings"]) # your own step, by hand or with an LLMFindings You Disagree With
You cannot switch checks off for an API key, so every call runs the same checks. If a finding does not suit your text, filter it in your own code. Each finding has a stable rule_id, so you can keep a list of the ones you accept.
const ignored = new Set(["ai.delve"]); // rule IDs you have decided to accept
const findings = result.findings.filter((finding) => !ignored.has(finding.rule_id));
const red = findings.filter((finding) => finding.severity === "red").length;The counts in findings_count include every finding, so count the ones you keep yourself. The last line above does this.
Long Documents
A document over the length limit has to be sent in parts. Split it at paragraph breaks, check each part, and add up the counts. Splitting does not change the price, because you are charged by words. Preparing Your Text has a function that splits a document for you.
Staying Under the Rate Limit
Each API key may make 60 requests per minute, and all the keys in a workspace share a limit of 300. To stay under the limit of one key, send at most one request a second.
If you reach a limit anyway, the API answers 429 with a Retry-After header. Reliability shows how to wait and try again.
Estimating Cost
You can work out what a call will cost before you send it. Preparing Your Text has a short function for it, in Python and JavaScript.