Skip to main content

AI Detector

The endpoint computes the probability that a piece of text is AI-generated, as well as the probability that each constituent sentence and token is AI-generated.

Try it out

Accuracy and Trade-offs

All AI detection systems have false positives and false negatives. In some cases, small modifications to AI-generated text can cause that text to no longer be flagged as AI-generated. In other cases, human-written (but perhaps rote) text can be misclassified as AI-generated. Depending on the application, false positives or false negatives may be less desirable. Contact us for ways to adjust for your use case.

Sample Code

curl -X POST \
-H "Content-Type: application/json" \
-d '{"key":"<api-key>", "text":"This is sample text."}'
AI Detector UI integration

Sapling's Javascript SDK provides a complete end-to-end UI integration for AI content detection capabilities. Head over to our AI Detect JavaScript Quickstart for more details.

AI Detector POST

Request Parameters

HTTP method: POST

The AI Detector API POST endpoint takes JSON parameters documented below:

key: String
32-character API key.

text: String
Text to run detection on. The limit is currently 50,000 characters. If latency is high or requests time out, we recommend adapting this script. Please contact us if you need to run the system on longer inputs. We can also provide suggestions on how to chunk your text into smaller pieces and then combine detection results.

sent_scores: Boolean
Whether to return sentence scores. Defaults to true. If speed is of the essence, you can disable this setting.

score_string: Boolean
Whether to return string highlighting token-level scores. Defaults to false. This allows you to visualize which portions of the text are likely AI-generated similar to on Sapling's AI detector page.

version: String
There are currently 2 versions of the detector available

  1. 20231024 (default)
  2. 20230317 While we have found the default to be more performant, you may wish to use the older version to ensure consistency in your application.

Response Parameters

A score from 0 to 1 be returned, with 0 indicating the maximum confidence that the text is human-written, and 1 indicating the maximum confidence that the text is AI-generated.

A field sentence_scores containing scores for each sentence will also be returned. The per-sentence scores may not correlate with the overall score field as they're computed using a different method from the overall score.

The AI Detector POST endpoint returns JSON of the following format:

"score": 0.98,
"sentence_scores": [
"sentence": "Here is a sentence.",
"score": 0.999