is-it-spam 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -14
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# is-it-spam
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
LLM-based spam classifier. Works with any OpenAI-compatible API.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm
|
|
8
|
+
npm i is-it-spam
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { createClassifier } from "spam
|
|
14
|
+
import { createClassifier } from "is-it-spam";
|
|
15
15
|
|
|
16
|
-
// Set up once
|
|
17
16
|
const isSpam = createClassifier({
|
|
18
17
|
apiKey: process.env.OPENROUTER_API_KEY!,
|
|
18
|
+
zdr: true
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
// Use anywhere - returns true/false
|
|
22
21
|
if (await isSpam("Need a quote for your services")) {
|
|
23
|
-
// spam
|
|
22
|
+
// spam
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
//
|
|
25
|
+
// or get details
|
|
27
26
|
const result = await isSpam.details("Need a quote");
|
|
28
|
-
// { isSpam: false, confidence: 0.95, reason: "
|
|
27
|
+
// { isSpam: false, confidence: 0.95, reason: "..." }
|
|
29
28
|
```
|
|
30
29
|
|
|
31
30
|
## Options
|
|
32
31
|
|
|
33
32
|
| Option | Type | Default | Description |
|
|
34
33
|
|--------|------|---------|-------------|
|
|
35
|
-
| `apiKey` | string |
|
|
36
|
-
| `model` | string | `
|
|
34
|
+
| `apiKey` | string | required | API key |
|
|
35
|
+
| `model` | string | `openai/gpt-5.4-nano` | Model to use |
|
|
37
36
|
| `baseUrl` | string | OpenRouter | API endpoint |
|
|
38
|
-
| `zdr` | boolean | `false` |
|
|
37
|
+
| `zdr` | boolean | `false` | Zero Data Retention |
|
|
39
38
|
|
|
40
39
|
## Providers
|
|
41
40
|
|
|
@@ -45,7 +44,7 @@ Works with any OpenAI-compatible API:
|
|
|
45
44
|
// OpenRouter (default)
|
|
46
45
|
const isSpam = createClassifier({ apiKey: process.env.OPENROUTER_API_KEY! });
|
|
47
46
|
|
|
48
|
-
// OpenAI
|
|
47
|
+
// OpenAI
|
|
49
48
|
const isSpam = createClassifier({
|
|
50
49
|
apiKey: process.env.OPENAI_API_KEY!,
|
|
51
50
|
baseUrl: "https://api.openai.com/v1/chat/completions",
|
|
@@ -66,7 +65,7 @@ Returns `false` (legitimate) if the API fails, so you never block real customers
|
|
|
66
65
|
|
|
67
66
|
## Cost
|
|
68
67
|
|
|
69
|
-
~$0.0002 per
|
|
68
|
+
~$0.0002 per check. 10,000 checks = ~$2.
|
|
70
69
|
|
|
71
70
|
## License
|
|
72
71
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED