slash-tokens 1.0.0 → 1.1.0
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/dist/intercept.js +21 -14
- package/dist/models.js +11 -12
- package/package.json +1 -1
package/dist/intercept.js
CHANGED
|
@@ -26,30 +26,37 @@ const AI_ENDPOINTS = [
|
|
|
26
26
|
// Normalize model names to our pricing table keys
|
|
27
27
|
function normalizeModel(raw) {
|
|
28
28
|
const lower = raw.toLowerCase();
|
|
29
|
+
// Anthropic
|
|
29
30
|
if (lower.includes('opus'))
|
|
30
31
|
return 'claude-opus';
|
|
31
32
|
if (lower.includes('sonnet'))
|
|
32
33
|
return 'claude-sonnet';
|
|
33
34
|
if (lower.includes('haiku'))
|
|
34
35
|
return 'claude-haiku';
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
// xAI
|
|
37
|
+
if (lower.includes('grok') && lower.includes('fast'))
|
|
38
|
+
return 'grok-4-1-fast';
|
|
37
39
|
if (lower.includes('grok'))
|
|
38
|
-
return 'grok-
|
|
40
|
+
return 'grok-4.20';
|
|
41
|
+
// Google
|
|
39
42
|
if (lower.includes('gemini') && lower.includes('pro'))
|
|
40
|
-
return 'gemini-
|
|
43
|
+
return 'gemini-3.1-pro';
|
|
41
44
|
if (lower.includes('gemini'))
|
|
42
|
-
return 'gemini-2.
|
|
45
|
+
return 'gemini-2.5-flash';
|
|
46
|
+
// OpenAI
|
|
47
|
+
if (lower.includes('5.4') && lower.includes('nano'))
|
|
48
|
+
return 'gpt-5.4-nano';
|
|
49
|
+
if (lower.includes('5.4') && lower.includes('mini'))
|
|
50
|
+
return 'gpt-5.4-mini';
|
|
51
|
+
if (lower.includes('5.4'))
|
|
52
|
+
return 'gpt-5.4';
|
|
53
|
+
// Legacy fallbacks
|
|
43
54
|
if (lower.includes('4o-mini') || lower.includes('4o_mini'))
|
|
44
|
-
return 'gpt-
|
|
45
|
-
if (lower.includes('4o'))
|
|
46
|
-
return 'gpt-
|
|
47
|
-
if (lower.includes('
|
|
48
|
-
return '
|
|
49
|
-
if (lower.includes('4.1') && lower.includes('mini'))
|
|
50
|
-
return 'gpt-4.1-mini';
|
|
51
|
-
if (lower.includes('4.1'))
|
|
52
|
-
return 'gpt-4.1';
|
|
55
|
+
return 'gpt-5.4-mini';
|
|
56
|
+
if (lower.includes('4o') || lower.includes('4.1'))
|
|
57
|
+
return 'gpt-5.4';
|
|
58
|
+
if (lower.includes('grok-3'))
|
|
59
|
+
return 'grok-4.20';
|
|
53
60
|
return raw;
|
|
54
61
|
}
|
|
55
62
|
// Extract message content from request body
|
package/dist/models.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
+
// Pricing as of April 2026 — USD per million tokens
|
|
1
2
|
export const MODELS = {
|
|
2
3
|
// Anthropic
|
|
3
|
-
'claude-opus': { input:
|
|
4
|
-
'claude-sonnet': { input: 3.00, output: 15.00, context:
|
|
5
|
-
'claude-haiku': { input:
|
|
4
|
+
'claude-opus': { input: 5.00, output: 25.00, context: 1000000 },
|
|
5
|
+
'claude-sonnet': { input: 3.00, output: 15.00, context: 1000000 },
|
|
6
|
+
'claude-haiku': { input: 1.00, output: 5.00, context: 200000 },
|
|
6
7
|
// xAI
|
|
7
|
-
'grok-
|
|
8
|
-
'grok-
|
|
8
|
+
'grok-4.20': { input: 2.00, output: 6.00, context: 2000000 },
|
|
9
|
+
'grok-4-1-fast': { input: 0.20, output: 0.50, context: 2000000 },
|
|
9
10
|
// Google
|
|
10
|
-
'gemini-
|
|
11
|
-
'gemini-2.
|
|
11
|
+
'gemini-3.1-pro': { input: 2.00, output: 12.00, context: 1000000 },
|
|
12
|
+
'gemini-2.5-flash': { input: 0.30, output: 2.50, context: 1000000 },
|
|
12
13
|
// OpenAI
|
|
13
|
-
'gpt-
|
|
14
|
-
'gpt-
|
|
15
|
-
'gpt-4
|
|
16
|
-
'gpt-4.1-mini': { input: 0.40, output: 1.60, context: 1047576 },
|
|
17
|
-
'gpt-4.1-nano': { input: 0.10, output: 0.40, context: 1047576 },
|
|
14
|
+
'gpt-5.4': { input: 2.50, output: 15.00, context: 1000000 },
|
|
15
|
+
'gpt-5.4-mini': { input: 0.75, output: 4.50, context: 128000 },
|
|
16
|
+
'gpt-5.4-nano': { input: 0.20, output: 1.25, context: 128000 },
|
|
18
17
|
};
|
|
19
18
|
export function getModel(name) {
|
|
20
19
|
return MODELS[name] || MODELS[name.toLowerCase()];
|
package/package.json
CHANGED