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

# API

> API reference for Winston AI: every `winstonai.api.*` operation with input and output types.

Every `winstonai.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Detect

### aiImage

`detect.aiImage`

Score whether a public image URL was created by a human or generated by AI

**Risk:** `read`

```ts theme={null}
await corsair.winstonai.api.detect.aiImage({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | — |
| `version` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `score` | `number` | Yes | — |
| `human_probability` | `number` | No | — |
| `ai_probability` | `number` | No | — |
| `version` | `string` | No | — |
| `mime_type` | `string` | No | — |
| `credits_used` | `number` | No | — |
| `credits_remaining` | `number` | No | — |

***

### aiText

`detect.aiText`

Score whether text, a public file, or a website was written by a human or generated by AI

**Risk:** `read`

```ts theme={null}
await corsair.winstonai.api.detect.aiText({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `text` | `string` | No | — |
| `file` | `string` | No | — |
| `website` | `string` | No | — |
| `version` | `string` | No | — |
| `sentences` | `boolean` | No | — |
| `language` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `number` | No | — |
| `score` | `number` | Yes | — |
| `sentences` | `object[]` | No | — |
| `input` | `string` | No | — |
| `attack_detected` | `object` | No | — |
| `readability_score` | `number` | No | — |
| `credits_used` | `number` | No | — |
| `credits_remaining` | `number` | No | — |
| `version` | `string` | No | — |
| `language` | `string` | No | — |

> [accordion] sentences full type
>
> ```ts theme={null}
> {
>   text: string,
>   score: number
> }[]
> ```

> [accordion] attack\_detected full type
>
> ```ts theme={null}
> {
>   zero_width_space?: boolean,
>   homoglyph_attack?: boolean
> }
> ```

***

### plagiarism

`detect.plagiarism`

Scan text, a public file, or a website for matching sources on the web

**Risk:** `read`

```ts theme={null}
await corsair.winstonai.api.detect.plagiarism({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `text` | `string` | No | — |
| `file` | `string` | No | — |
| `website` | `string` | No | — |
| `excluded_sources` | `string[]` | No | — |
| `language` | `string` | No | — |
| `country` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `number` | No | — |
| `scanInformation` | `object` | No | — |
| `result` | `object` | No | — |
| `sources` | `object[]` | No | — |
| `attackDetected` | `object` | No | — |
| `text` | `string` | No | — |
| `credits_used` | `number` | No | — |
| `credits_remaining` | `number` | No | — |

> [accordion] scanInformation full type
>
> ```ts theme={null}
> {
>   service?: string,
>   scanTime?: string,
>   inputType?: string,
>   language?: string
> }
> ```

> [accordion] result full type
>
> ```ts theme={null}
> {
>   score?: number,
>   sourceCounts?: number,
>   textWordCounts?: number,
>   totalPlagiarismWords?: number,
>   identicalWordCounts?: number,
>   similarWordCounts?: number
> }
> ```

> [accordion] sources full type
>
> ```ts theme={null}
> {
>   score?: number,
>   canAccess?: boolean,
>   url?: string,
>   title?: string,
>   plagiarismWords?: number,
>   identicalWordCounts?: number,
>   similarWordCounts?: number,
>   totalNumberOfWords?: number,
>   author?: string | null,
>   description?: string | null,
>   publishedDate?: number | null,
>   source?: string | null,
>   citation?: boolean,
>   plagiarismFound?: {
>     startIndex?: number,
>     endIndex?: number,
>     sequence?: string | null
>   }[],
>   is_excluded?: boolean
> }[]
> ```

> [accordion] attackDetected full type
>
> ```ts theme={null}
> {
>   zero_width_space?: boolean,
>   homoglyph_attack?: boolean
> }
> ```

***

## Text

### compare

`text.compare`

Compare two texts and return similarity scores

**Risk:** `read`

```ts theme={null}
await corsair.winstonai.api.text.compare({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `first_text` | `string` | Yes | — |
| `second_text` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `number` | No | — |
| `similarity_score` | `number` | Yes | — |
| `first_text` | `object` | No | — |
| `second_text` | `object` | No | — |
| `credits_used` | `number` | No | — |
| `credits_remaining` | `number` | No | — |

> [accordion] first\_text full type
>
> ```ts theme={null}
> {
>   total_word_count?: number,
>   matching_word_count?: number,
>   similarity_percentage?: number,
>   items?: {
>     type?: string,
>     word_count?: number,
>     index_start?: number,
>     length?: number
>   }[]
> }
> ```

> [accordion] second\_text full type
>
> ```ts theme={null}
> {
>   total_word_count?: number,
>   matching_word_count?: number,
>   similarity_percentage?: number,
>   items?: {
>     type?: string,
>     word_count?: number,
>     index_start?: number,
>     length?: number
>   }[]
> }
> ```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.