> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stealthgpt.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Detector

> Score text for AI-generated content with the /api/stealthify/detect endpoint

The `/api/stealthify/detect` endpoint runs the same AI-detection backend that powers the [StealthGPT AI Detector](https://www.stealthgpt.ai/ai-detector) on the website. Submit a piece of text and receive a 0-100 score indicating how likely it is to be flagged as AI-generated by detection tools.

## Request Parameters

<ParamField header="api-token" type="string" required>
  Your unique API authentication token. You can find this in your StealthGPT dashboard under the API Key tab.
</ParamField>

<ParamField body="text" type="string" required>
  The text to analyze. Maximum 3,000 words per request.
</ParamField>

## Response

<ResponseField name="howLikelyToBeDetected" type="number">
  A score from 0 to 100 indicating how likely the text is to be flagged as AI-generated by detection tools. Higher means more likely to be flagged.
</ResponseField>

<ResponseField name="wordsSpent" type="number">
  Number of words charged for this request (equal to the input word count).
</ResponseField>

<ResponseField name="remainingCredits" type="number">
  Number of prepaid words remaining in your account after this request.
</ResponseField>

<ResponseField name="billingMode" type="string">
  Whether the request was billed from prepaid words (`prepaid`) or pay-as-you-go metered billing (`payg`).
</ResponseField>

<ResponseField name="meteredChargedCredits" type="number">
  If billed via pay-as-you-go, the number of words added to metered usage for this request (0 when billed from prepaid).
</ResponseField>

## Example Request

<CodeGroup>
  ```bash curl-example theme={null}
  curl --location 'https://stealthgpt.ai/api/stealthify/detect' \
      --header 'api-token: YOUR_API_TOKEN' \
      --header 'Content-Type: application/json' \
      --data '{
          "text": "Renewable energy sources, including solar and wind power, represent inexhaustible resources unlike finite fossil fuels."
      }'
  ```

  ```python python-example theme={null}
  import requests

  response = requests.post(
      'https://stealthgpt.ai/api/stealthify/detect',
      headers={
          'api-token': 'YOUR_API_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'text': 'Renewable energy sources, including solar and wind power, represent inexhaustible resources unlike finite fossil fuels.'
      }
  )

  print(response.json())
  ```

  ```javascript nodejs-example theme={null}
  const axios = require('axios');

  axios.post('https://stealthgpt.ai/api/stealthify/detect', {
      text: 'Renewable energy sources, including solar and wind power, represent inexhaustible resources unlike finite fossil fuels.'
  }, {
      headers: {
          'api-token': 'YOUR_API_TOKEN',
          'Content-Type': 'application/json'
      }
  }).then(response => {
      console.log(response.data);
  });
  ```
</CodeGroup>

## Example Response

```json theme={null}
{
  "howLikelyToBeDetected": 87,
  "wordsSpent": 16,
  "remainingCredits": 984984,
  "billingMode": "prepaid",
  "meteredChargedCredits": 0
}
```

## Score Interpretation

The `howLikelyToBeDetected` score is a probability expressed on a 0-100 scale.

| Score range | Interpretation                                                  |
| ----------- | --------------------------------------------------------------- |
| 0 - 30      | Likely human-written. Low risk of being flagged as AI.          |
| 31 - 70     | Mixed signals. May be partially AI-generated or heavily edited. |
| 71 - 100    | Likely AI-generated. High risk of being flagged by detectors.   |

<Note>
  Detection scores are probabilistic. Short inputs (under \~50 words) and highly templated text (e.g. resumes, legal boilerplate) can produce noisy results regardless of how the text was written.
</Note>

## Pairing With Humanizer

A common workflow is to humanize text with [`/api/stealthify`](/api-reference/endpoints/stealthify) and then verify the result with `/api/stealthify/detect`:

```javascript theme={null}
const stealthified = await fetch('https://stealthgpt.ai/api/stealthify', {
  method: 'POST',
  headers: {
    'api-token': 'YOUR_API_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ prompt: sourceText, rephrase: true }),
}).then(r => r.json())

const detection = await fetch('https://stealthgpt.ai/api/stealthify/detect', {
  method: 'POST',
  headers: {
    'api-token': 'YOUR_API_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ text: stealthified.result }),
}).then(r => r.json())

console.log('humanizer score:', stealthified.howLikelyToBeDetected)
console.log('independent detector score:', detection.howLikelyToBeDetected)
```

<Warning>
  The two `howLikelyToBeDetected` fields are **inverse** orientations. On
  `/api/stealthify` (and the humanizer runs) it is a **human-likeness** score
  where **higher is better** (more human). On `/api/stealthify/detect` it is an
  **AI-likelihood** score where **higher means more likely AI**. A good
  humanizer result is therefore **high** on `/api/stealthify` and **low** on
  `/api/stealthify/detect`.
</Warning>

Use `/api/stealthify/detect` when you need to score arbitrary text that did not pass through the humanizer.

## Usage Notes

* Billing is `input words` per request (1 charged word per input word). See [Pricing](/api-reference/pricing) for rates.
* Inputs over 3,000 words return `400 Bad Request`. Split long documents into multiple calls and average the scores client-side if needed.
* The detector is language-agnostic; non-English input is supported.
