pi-baseten-provider 1.0.9 → 1.0.11
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 +2 -3
- package/deprecated-models.json +48 -1
- package/models.json +23 -45
- package/package.json +1 -1
- package/patch.json +1 -0
- package/scripts/update-models.js +107 -3
package/README.md
CHANGED
|
@@ -71,18 +71,17 @@ pi
|
|
|
71
71
|
|-------|---------|--------|-----------|-----------|------------|
|
|
72
72
|
| Deepseek V4 Flash 0731 | 1.0M | ❌ | ✅ | $0.13 | $0.26 |
|
|
73
73
|
| Deepseek V4 Pro | 262K | ❌ | ✅ | $1.74 | $3.48 |
|
|
74
|
+
| Deepseek V4 Pro 0813 | 1.0M | ❌ | ✅ | $1.32 | $3.96 |
|
|
74
75
|
| GLM 4.7 | 200K | ❌ | ✅ | $0.60 | $2.20 |
|
|
75
76
|
| GLM 5.2 | 1.0M | ❌ | ✅ | $1.40 | $4.40 |
|
|
76
|
-
| GLM 5.2 Fast |
|
|
77
|
+
| GLM 5.2 Fast | 1.0M | ❌ | ✅ | $2.10 | $6.60 |
|
|
77
78
|
| Inkling | 1.0M | ✅ | ✅ | $1.00 | $4.05 |
|
|
78
79
|
| Inkling Small | 1.0M | ✅ | ✅ | $0.50 | $1.20 |
|
|
79
80
|
| Kimi K2.6 | 262K | ✅ | ✅ | $0.95 | $4.00 |
|
|
80
81
|
| Kimi K2.7 Code | 262K | ✅ | ✅ | $0.95 | $4.00 |
|
|
81
82
|
| Kimi K3 | 1.0M | ✅ | ✅ | $3.00 | $15.00 |
|
|
82
|
-
| Mercury 2 | 8K | ❌ | ✅ | Free | Free |
|
|
83
83
|
| Nemotron Ultra | 203K | ❌ | ✅ | $0.60 | $2.40 |
|
|
84
84
|
| OpenAI GPT 120B | 128K | ❌ | ✅ | $0.10 | $0.50 |
|
|
85
|
-
| SID-1 | 33K | ❌ | ❌ | Free | Free |
|
|
86
85
|
|
|
87
86
|
*Costs are per million tokens. Prices subject to change — check [baseten.co/pricing](https://www.baseten.co/pricing/) for current pricing.*
|
|
88
87
|
|
package/deprecated-models.json
CHANGED
|
@@ -1 +1,48 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"inception/mercury-2": {
|
|
3
|
+
"id": "inception/mercury-2",
|
|
4
|
+
"name": "Mercury 2",
|
|
5
|
+
"reasoning": true,
|
|
6
|
+
"input": [
|
|
7
|
+
"text"
|
|
8
|
+
],
|
|
9
|
+
"cost": {
|
|
10
|
+
"input": 0,
|
|
11
|
+
"output": 0,
|
|
12
|
+
"cacheRead": 0,
|
|
13
|
+
"cacheWrite": 0
|
|
14
|
+
},
|
|
15
|
+
"contextWindow": 8192,
|
|
16
|
+
"maxTokens": 5000,
|
|
17
|
+
"compat": {
|
|
18
|
+
"supportsDeveloperRole": true,
|
|
19
|
+
"supportsStore": false,
|
|
20
|
+
"maxTokensField": "max_completion_tokens",
|
|
21
|
+
"thinkingFormat": "openai"
|
|
22
|
+
},
|
|
23
|
+
"deprecatedAt": "2026-08-05T02:00:12.114Z"
|
|
24
|
+
},
|
|
25
|
+
"sid/sid-1": {
|
|
26
|
+
"id": "sid/sid-1",
|
|
27
|
+
"name": "SID-1",
|
|
28
|
+
"reasoning": true,
|
|
29
|
+
"input": [
|
|
30
|
+
"text"
|
|
31
|
+
],
|
|
32
|
+
"cost": {
|
|
33
|
+
"input": 0,
|
|
34
|
+
"output": 0,
|
|
35
|
+
"cacheRead": 0,
|
|
36
|
+
"cacheWrite": 0
|
|
37
|
+
},
|
|
38
|
+
"contextWindow": 32768,
|
|
39
|
+
"maxTokens": 5000,
|
|
40
|
+
"compat": {
|
|
41
|
+
"supportsDeveloperRole": true,
|
|
42
|
+
"supportsStore": false,
|
|
43
|
+
"maxTokensField": "max_completion_tokens",
|
|
44
|
+
"thinkingFormat": "openai"
|
|
45
|
+
},
|
|
46
|
+
"deprecatedAt": "2026-08-05T02:00:12.114Z"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/models.json
CHANGED
|
@@ -43,6 +43,28 @@
|
|
|
43
43
|
"thinkingFormat": "openai"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"id": "deepseek-ai/DeepSeek-V4-Pro-0813",
|
|
48
|
+
"name": "Deepseek V4 Pro 0813",
|
|
49
|
+
"reasoning": true,
|
|
50
|
+
"input": [
|
|
51
|
+
"text"
|
|
52
|
+
],
|
|
53
|
+
"cost": {
|
|
54
|
+
"input": 1.32,
|
|
55
|
+
"output": 3.96,
|
|
56
|
+
"cacheRead": 0.132,
|
|
57
|
+
"cacheWrite": 0
|
|
58
|
+
},
|
|
59
|
+
"contextWindow": 1000000,
|
|
60
|
+
"maxTokens": 262144,
|
|
61
|
+
"compat": {
|
|
62
|
+
"supportsDeveloperRole": true,
|
|
63
|
+
"supportsStore": false,
|
|
64
|
+
"maxTokensField": "max_completion_tokens",
|
|
65
|
+
"thinkingFormat": "openai"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
46
68
|
{
|
|
47
69
|
"id": "zai-org/GLM-4.7",
|
|
48
70
|
"name": "GLM 4.7",
|
|
@@ -100,7 +122,7 @@
|
|
|
100
122
|
"cacheRead": 0.21,
|
|
101
123
|
"cacheWrite": 0
|
|
102
124
|
},
|
|
103
|
-
"contextWindow":
|
|
125
|
+
"contextWindow": 1048576,
|
|
104
126
|
"maxTokens": 262144,
|
|
105
127
|
"compat": {
|
|
106
128
|
"supportsDeveloperRole": true,
|
|
@@ -224,28 +246,6 @@
|
|
|
224
246
|
"thinkingFormat": "openai"
|
|
225
247
|
}
|
|
226
248
|
},
|
|
227
|
-
{
|
|
228
|
-
"id": "inception/mercury-2",
|
|
229
|
-
"name": "Mercury 2",
|
|
230
|
-
"reasoning": true,
|
|
231
|
-
"input": [
|
|
232
|
-
"text"
|
|
233
|
-
],
|
|
234
|
-
"cost": {
|
|
235
|
-
"input": 0,
|
|
236
|
-
"output": 0,
|
|
237
|
-
"cacheRead": 0,
|
|
238
|
-
"cacheWrite": 0
|
|
239
|
-
},
|
|
240
|
-
"contextWindow": 8192,
|
|
241
|
-
"maxTokens": 5000,
|
|
242
|
-
"compat": {
|
|
243
|
-
"supportsDeveloperRole": true,
|
|
244
|
-
"supportsStore": false,
|
|
245
|
-
"maxTokensField": "max_completion_tokens",
|
|
246
|
-
"thinkingFormat": "openai"
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
249
|
{
|
|
250
250
|
"id": "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B",
|
|
251
251
|
"name": "Nemotron Ultra",
|
|
@@ -290,27 +290,5 @@
|
|
|
290
290
|
"thinkingFormat": "openai",
|
|
291
291
|
"supportsReasoningEffort": true
|
|
292
292
|
}
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
"id": "sid/sid-1",
|
|
296
|
-
"name": "SID-1",
|
|
297
|
-
"reasoning": true,
|
|
298
|
-
"input": [
|
|
299
|
-
"text"
|
|
300
|
-
],
|
|
301
|
-
"cost": {
|
|
302
|
-
"input": 0,
|
|
303
|
-
"output": 0,
|
|
304
|
-
"cacheRead": 0,
|
|
305
|
-
"cacheWrite": 0
|
|
306
|
-
},
|
|
307
|
-
"contextWindow": 32768,
|
|
308
|
-
"maxTokens": 5000,
|
|
309
|
-
"compat": {
|
|
310
|
-
"supportsDeveloperRole": true,
|
|
311
|
-
"supportsStore": false,
|
|
312
|
-
"maxTokensField": "max_completion_tokens",
|
|
313
|
-
"thinkingFormat": "openai"
|
|
314
|
-
}
|
|
315
293
|
}
|
|
316
294
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-baseten-provider",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Baseten provider extension for pi - Access DeepSeek, Kimi, GLM, MiniMax, Nemotron, and GPT-OSS models through the Baseten Model API",
|
|
5
5
|
"author": "monotykamary",
|
|
6
6
|
"homepage": "https://github.com/monotykamary/pi-baseten-provider#readme",
|
package/patch.json
CHANGED
package/scripts/update-models.js
CHANGED
|
@@ -17,15 +17,119 @@
|
|
|
17
17
|
* patch.json and custom-models.json are applied at runtime by the provider.
|
|
18
18
|
* They are NOT baked into models.json, but ARE used to generate the README table.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* API key: the stored `baseten` credential in ~/.pi/agent/auth.json wins, then
|
|
21
|
+
* the BASETEN_API_KEY environment variable. The script refuses to run without one.
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
import fs from 'fs';
|
|
25
|
+
import os from 'os';
|
|
26
|
+
import { execSync } from 'child_process';
|
|
24
27
|
import path from 'path';
|
|
25
28
|
import { fileURLToPath } from 'url';
|
|
26
29
|
|
|
27
30
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
28
31
|
|
|
32
|
+
// pi's agent directory: PI_CODING_AGENT_DIR (with ~ expansion) or ~/.pi/agent.
|
|
33
|
+
function piAgentDir() {
|
|
34
|
+
const envDir = process.env.PI_CODING_AGENT_DIR;
|
|
35
|
+
if (envDir) {
|
|
36
|
+
return envDir.startsWith('~/') || envDir === '~'
|
|
37
|
+
? path.join(os.homedir(), envDir.slice(1))
|
|
38
|
+
: envDir;
|
|
39
|
+
}
|
|
40
|
+
return path.join(os.homedir(), '.pi', 'agent');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const AUTH_JSON_PATH = path.join(piAgentDir(), 'auth.json');
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a configured value using pi's semantics (resolve-config-value.ts in
|
|
47
|
+
* pi-mono): "!command" runs via the shell (10s timeout) and uses trimmed
|
|
48
|
+
* stdout; "$VAR" / "${VAR}" interpolate environment variables ("$$" escapes a
|
|
49
|
+
* literal "$", "$!" a literal "!"); anything else is a literal. Returns
|
|
50
|
+
* undefined when a referenced env var is unset or a command fails.
|
|
51
|
+
*/
|
|
52
|
+
function resolveConfigValue(config, env) {
|
|
53
|
+
if (typeof config !== 'string' || config.length === 0) return undefined;
|
|
54
|
+
if (config.startsWith('!')) {
|
|
55
|
+
try {
|
|
56
|
+
const out = execSync(config.slice(1), {
|
|
57
|
+
encoding: 'utf8',
|
|
58
|
+
timeout: 10000,
|
|
59
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
60
|
+
});
|
|
61
|
+
return out.trim() || undefined;
|
|
62
|
+
} catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
67
|
+
let resolved = '';
|
|
68
|
+
let index = 0;
|
|
69
|
+
while (index < config.length) {
|
|
70
|
+
const dollar = config.indexOf('$', index);
|
|
71
|
+
if (dollar < 0) {
|
|
72
|
+
resolved += config.slice(index);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
resolved += config.slice(index, dollar);
|
|
76
|
+
const next = config[dollar + 1];
|
|
77
|
+
let name;
|
|
78
|
+
if (next === '$' || next === '!') {
|
|
79
|
+
resolved += next;
|
|
80
|
+
index = dollar + 2;
|
|
81
|
+
continue;
|
|
82
|
+
} else if (next === '{') {
|
|
83
|
+
const end = config.indexOf('}', dollar + 2);
|
|
84
|
+
if (end < 0) {
|
|
85
|
+
resolved += '$';
|
|
86
|
+
index = dollar + 1;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const inner = config.slice(dollar + 2, end);
|
|
90
|
+
if (!ENV_NAME_RE.test(inner)) {
|
|
91
|
+
resolved += config.slice(dollar, end + 1);
|
|
92
|
+
index = end + 1;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
name = inner;
|
|
96
|
+
index = end + 1;
|
|
97
|
+
} else {
|
|
98
|
+
const match = config.slice(dollar + 1).match(/^[A-Za-z_][A-Za-z0-9_]*/);
|
|
99
|
+
if (!match) {
|
|
100
|
+
resolved += '$';
|
|
101
|
+
index = dollar + 1;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
name = match[0];
|
|
105
|
+
index = dollar + 1 + name.length;
|
|
106
|
+
}
|
|
107
|
+
const value = (env && env[name]) || process.env[name] || undefined;
|
|
108
|
+
if (value === undefined) return undefined;
|
|
109
|
+
resolved += value;
|
|
110
|
+
}
|
|
111
|
+
return resolved;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The API key, resolved the way pi itself resolves it for this provider: the
|
|
116
|
+
* stored `baseten` credential in ~/.pi/agent/auth.json wins, then
|
|
117
|
+
* the BASETEN_API_KEY environment variable.
|
|
118
|
+
*/
|
|
119
|
+
function resolveApiKey() {
|
|
120
|
+
try {
|
|
121
|
+
const auth = JSON.parse(fs.readFileSync(AUTH_JSON_PATH, 'utf8'));
|
|
122
|
+
const credential = auth?.baseten;
|
|
123
|
+
if (credential && credential.type === 'api_key' && typeof credential.key === 'string') {
|
|
124
|
+
const key = resolveConfigValue(credential.key, credential.env);
|
|
125
|
+
if (key) return key;
|
|
126
|
+
}
|
|
127
|
+
} catch {
|
|
128
|
+
// Missing or unparseable auth.json: fall through to the env var.
|
|
129
|
+
}
|
|
130
|
+
return process.env.BASETEN_API_KEY || undefined;
|
|
131
|
+
}
|
|
132
|
+
|
|
29
133
|
const MODELS_API_URL = 'https://inference.baseten.co/v1/models';
|
|
30
134
|
const MODELS_JSON_PATH = path.join(__dirname, '..', 'models.json');
|
|
31
135
|
const PATCH_JSON_PATH = path.join(__dirname, '..', 'patch.json');
|
|
@@ -58,9 +162,9 @@ function toPerMillion(val) {
|
|
|
58
162
|
// ─── API fetch ───────────────────────────────────────────────────────────────
|
|
59
163
|
|
|
60
164
|
async function fetchModels() {
|
|
61
|
-
const apiKey =
|
|
165
|
+
const apiKey = resolveApiKey();
|
|
62
166
|
if (!apiKey) {
|
|
63
|
-
throw new Error('
|
|
167
|
+
throw new Error('No API key found: no `baseten` credential resolved from ' + AUTH_JSON_PATH + ' and BASETEN_API_KEY is not set');
|
|
64
168
|
}
|
|
65
169
|
|
|
66
170
|
console.log(`Fetching models from ${MODELS_API_URL}...`);
|