# Grammarly AI Text Detector & Content Checker (`dev00/grammarly-ai-detector`) Actor

Enterprise-grade AI text detection powered by Grammarly. Detects ChatGPT, GPT-4, Claude, Gemini, LLaMA, and AI writing with percentage scores, alert ranges, and readability metrics.

- **URL**: https://apify.com/dev00/grammarly-ai-detector.md
- **Developed by:** [dev00](https://apify.com/dev00) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 ai content checks

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Grammarly AI Text Detector & Content Checker

The **Grammarly AI Text Detector Actor** provides instant, enterprise-grade AI text detection powered by Grammarly's official AI detection engine. Detect whether any text was generated by ChatGPT (GPT-3.5, GPT-4, GPT-4o), Claude (Opus, Sonnet, Haiku), Google Gemini, LLaMA, or written by a human.

In addition to AI probability scores and highlight ranges, this Actor calculates comprehensive linguistic and readability metrics including Flesch Reading Ease, Flesch-Kincaid Grade Level, reading time, and sentence burstiness.

***

### ⚡ Key Features

- **Official Grammarly AI Detection**: Leverages Grammarly's state-of-the-art classifier with zero-prompt latency.
- **AI & Human Percentage Breakdown**: Returns exact `score` (AI percentage 0-100%) and `human_score` (100 - AI score).
- **Clear Verdict & Confidence**: Immediate categorical classification (`AI_GENERATED` vs. `HUMAN_WRITTEN`) with confidence levels.
- **Alert Highlight Ranges**: Pinpoints character start/end index ranges where AI patterns were detected.
- **Readability & Text Analytics**:
  - **Flesch Reading Ease** (0 - 100)
  - **Flesch-Kincaid Grade Level**
  - **Reading Level** (Easy, Standard, Difficult, etc.)
  - **Estimated Reading Time**
  - **Burstiness Score** (measures sentence length variability typical in human writing)
  - Word count, character count, sentence count, average word/sentence length.

***

### 📥 Input Parameters

The Actor takes a JSON object with the following fields:

| Field | Type | Required | Description |
|---|---|---|---|
| `text` | String | **Yes** | The text snippet or document to analyze for AI generation. |

#### Example Input

```json
{
  "text": "In the contemporary digital landscape, artificial intelligence serves as a cornerstone of technological advancement, radically reshaping industries ranging from healthcare diagnostics to financial modeling."
}
```

***

### 📤 Output Format

The Actor pushes the detection result to both the Apify Dataset and the default Key-Value store (`OUTPUT`).

```json
{
  "success": true,
  "engine": "Grammarly",
  "score": 100,
  "human_score": 0,
  "is_ai": true,
  "verdict": "AI_GENERATED",
  "confidence": "HIGH",
  "alert_ranges": [
    {
      "start": 0,
      "end": 194
    }
  ],
  "readability": {
    "flesch_reading_ease": 0,
    "flesch_kincaid_grade": 26.2,
    "reading_level": "Very Difficult",
    "reading_time": "6 sec",
    "burstiness_score": 0
  },
  "text_stats": {
    "words": 23,
    "characters": 194,
    "characters_no_spaces": 172,
    "sentences": 1,
    "avg_sentence_length": 23,
    "avg_word_length": 7.5
  }
}
```

***

### 💻 How to Use

#### Apify Client (JavaScript / TypeScript)

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({
  token: 'YOUR_APIFY_TOKEN'
});

const run = await client.actor('YOUR_USERNAME/grammarly-ai-detector-apify').call({
  text: 'Artificial intelligence is revolutionizing the modern workforce...'
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0]);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run_input = {
    "text": "Artificial intelligence is revolutionizing the modern workforce..."
}

run = client.actor("YOUR_USERNAME/grammarly-ai-detector-apify").call(run_input=run_input)

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

#### cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text": "Artificial intelligence is revolutionizing the modern workforce..."}'
```

***

### 🛡️ Best Practices & Minimum Length

- For maximum precision, supply texts of at least **30–50 words**. Grammarly's model analyzes sentence cadence and statistical token distribution.
- Very short fragments (under 15 words) may not contain sufficient structural signal to reach high confidence.

# Actor input Schema

## `text` (type: `string`):

The text string to analyze for AI generation.

## Actor input object example

```json
{
  "text": "In the contemporary digital landscape, artificial intelligence serves as a cornerstone of technological advancement, radically reshaping industries ranging from healthcare diagnostics to financial modeling."
}
```

# Actor output Schema

## `results` (type: `string`):

Direct link to dataset items containing the detection results, score, verdict, and readability metrics.

## `keyValueStoreResult` (type: `string`):

Direct link to OUTPUT record in Key-Value store with raw JSON detection response.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "text": "In the contemporary digital landscape, artificial intelligence serves as a cornerstone of technological advancement, radically reshaping industries ranging from healthcare diagnostics to financial modeling."
};

// Run the Actor and wait for it to finish
const run = await client.actor("dev00/grammarly-ai-detector").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "text": "In the contemporary digital landscape, artificial intelligence serves as a cornerstone of technological advancement, radically reshaping industries ranging from healthcare diagnostics to financial modeling." }

# Run the Actor and wait for it to finish
run = client.actor("dev00/grammarly-ai-detector").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "text": "In the contemporary digital landscape, artificial intelligence serves as a cornerstone of technological advancement, radically reshaping industries ranging from healthcare diagnostics to financial modeling."
}' |
apify call dev00/grammarly-ai-detector --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dev00/grammarly-ai-detector"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/0T9RSR0MmDTc2YZZR/builds/EgbJQvHfbvAvM4uLi/openapi.json
