Stay up to date with AI tools, model releases, and developer workflows that matter.
It has been revealed that weekly. Free. One click to leave.
It has been revealed that 7 Day Free Trial. Cancel Anytime.
Sooner or later someone on your team asks it. Maybe it’s a product manager, maybe the head of content, maybe a teacher who’s just marked forty near-identical essays: can we tell when people are pasting in ChatGPT output?
The short answer is no, not with certainty. Anyone who promises you that is selling something.
But you can get a useful signal, and you can show it to the people who actually make the call: editors, teachers, moderators. In this tutorial you’ll build a small Express app that takes some text, sends it to an AI detector API, waits for the result, and highlights the sentences that look machine-written.
I’m using the Quetext AI Detector API here. It scores each sentence, not just the whole document, and you can try it without a subscription. Most detection APIs follow the same submit, poll, fetch pattern, though. If you switch providers later, you’ll rewrite one file.
According to recent reports, put the key in an environment variable. Don’t hard-code it, and don’t let it anywhere near the browser.
You’ll make three calls. Analysis takes a few seconds, so the API hands you a ticket and makes you come back for the result. Keep the Quetext API docs open in another tab while you follow along; they list every endpoint, field and error code.
Every request sends your key in an X-API-Key header. The minimum input is 50 words, which sounds annoying until you realise no detector can say anything useful about a two-line comment.
And remember this number: 10 requests every 5 seconds, per account. Progress checks count. It’ll come back to bite you in the production section if you ignore it.
It has been revealed that create quetext.js. I like keeping everything provider-specific in one file, so the rest of the app has no idea who’s doing the detecting.
Three decisions in there that are worth a sentence each:.
The errors keep their HTTP status code. A 402 means you’ve run out of credit and a 429 means you’re polling too fast, and you’ll want to handle those differently from “something broke.”.
It polls every 2.5 seconds because Quetext’s docs suggest 2 to 3. Polling faster won’t speed the report up. You’ll just burn through the rate limit.
According to recent reports, and there’s a hard timeout. Leave it out and one stuck report can hang a request forever. That’s a miserable bug to track down at 11pm.
Next, server.js. It checks the input, runs the three calls, and gives the frontend a simple response that doesn’t mention Quetext anywhere.
Sources indicate that look at the mapping at the end. generated_prob becomes probability, and ai_score comes back as a string like "82.50", so it gets parsed into a number. It’s a small detail. But it means your frontend never learns which provider’s field names it’s dealing with, and that’s what makes swapping providers a one-file change.
Show someone “64% AI” and they’ll jump to a conclusion. Show them a paragraph with three sentences shaded pink and they’ll actually read it.
So the page demonstrates every sentence, coloured by how likely it is to be AI-generated. Create public/index.html:.
Run node server.js and open http://localhost:3000. Try two samples: something you wrote yourself, then a raw chatbot answer on the same topic. Seeing which sentences light up teaches you more about how these detectors work than any diagram I could draw.
Recent findings suggest that A quick security point. Those sentences came from your customers, then went through an outside service. Treat them as untrusted. That’s why the code uses textContent and never innerHTML, as the OWASP XSS prevention cheat sheet recommends.
It has been revealed that the demo keeps an HTTP request open while it polls. Fine on your laptop. Not fine with real traffic.
In a recent development, submit the text, save the report id with a pending status, and respond straight away. A worker (BullMQ, a cron job, a serverless queue, whatever you already use) does the polling and updates the record once it’s done. The UI says “Checking…” until the result highlights up.
According to recent reports, here’s how it goes wrong. It’s Monday morning, 20 editors open their review queues and click “Check” at roughly the same time. Each request polls on its own, and within a few seconds you’ve hit 429s across the board, because the 10-per-5-seconds limit covers your whole account, not each user.
Use one worker that loops through every pending report, with a short pause between calls. Problem solved.
It has been revealed that you pay per word, so don’t check every blog comment. Article submissions, assignments and paid freelance work usually justify the cost. Cache results against a hash of the text too. Someone who submits the same draft three times shouldn’t cost you three times.
AI detection doesn’t catch copying. Someone can lift a 2019 blog post word for word and it’ll score 0% AI, because a human wrote it. Just not this human. If originality matters to your product, the same API has plagiarism endpoints that work exactly the same way. The API documentation covers both.
Recent findings suggest that developers skip this part. It’s also the part that ends up in angry support tickets.
In 2023, Liang and colleagues at Stanford ran essays written by non-native English speakers (all human, written for the TOEFL) through seven AI detectors. On average, the detectors labelled more than 61% of them as AI-generated. Simple vocabulary and textbook grammar read as “predictable,” and predictability is exactly what detectors look for.
According to recent reports, picture an international student getting an automatic zero because a script noted so. You don’t want to be the person who built that.
Do that and the detector is a fast first pass that points people at what’s worth a closer look. Your humans still make the call.
In a recent development, you send text, the service checks how predictable each sentence would be to a language model, and you get back a probability that a machine wrote it. Most of these APIs are asynchronous. You submit, get a report ID, poll until it’s ready, then fetch the result. The better ones score individual sentences as well as the whole text, which makes building a sensible review screen much easier.
It has been revealed that more than you’d think. Quetext’s API won’t accept fewer than 50 words, and in practice scores settle down once you’re past about 300. A product title or a one-line comment just doesn’t give a detector enough to go on. For short content, either group related pieces together or don’t bother checking it.
Recent findings suggest that no. Detectors make mistakes, and research reveals they flag non-native English writers far more often than native speakers. Use the score to decide what a human looks at first, not to block anything. Give reviewers the highlighted sentences, give users a way to explain themselves, and log what you decided. Your users get treated fairly and your support team avoids a pile of angry tickets.
Poll at the speed the provider recommends (every 2 to 3 seconds for Quetext), and remember that those polls count against your limit too. Once you’re in production, move checks into a background queue and let one worker poll every pending report, rather than having each user request poll by itself. When you do get a 429, wait a moment and retry.
Recent findings suggest that no. If the browser calls the API directly, your key ends up in the frontend code where anyone can copy it and spend your credit. Keep the key in an environment variable on your server and send requests through your own endpoint, like the one in this tutorial. That also gives you somewhere to check input length, apply per-user limits and cache results before you pay for anything.
In a recent development, 7 Day Free Trial. Cancel Anytime.
