pi-baseten-provider 1.0.2 → 1.0.4
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/index.ts +13 -3
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -25,12 +25,11 @@
|
|
|
25
25
|
* Then use /model to select from available models
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
import type
|
|
28
|
+
import { getAgentDir, type ExtensionAPI, type ModelRegistry } from "@earendil-works/pi-coding-agent";
|
|
29
29
|
import modelsData from "./models.json" with { type: "json" };
|
|
30
30
|
import customModelsData from "./custom-models.json" with { type: "json" };
|
|
31
31
|
import patchData from "./patch.json" with { type: "json" };
|
|
32
32
|
import fs from "fs";
|
|
33
|
-
import os from "os";
|
|
34
33
|
import path from "path";
|
|
35
34
|
|
|
36
35
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
@@ -156,7 +155,7 @@ function buildModels(base: JsonModel[], custom: JsonModel[], patch: PatchData):
|
|
|
156
155
|
const PROVIDER_ID = "baseten";
|
|
157
156
|
const BASE_URL = "https://inference.baseten.co/v1";
|
|
158
157
|
const MODELS_URL = `${BASE_URL}/models`;
|
|
159
|
-
const CACHE_DIR = path.join(
|
|
158
|
+
const CACHE_DIR = path.join(getAgentDir(), "cache");
|
|
160
159
|
const CACHE_PATH = path.join(CACHE_DIR, `${PROVIDER_ID}-models.json`);
|
|
161
160
|
const LIVE_FETCH_TIMEOUT_MS = 8000;
|
|
162
161
|
|
|
@@ -231,9 +230,20 @@ function mergeWithEmbedded(liveModels: JsonModel[], embeddedModels: JsonModel[])
|
|
|
231
230
|
const embedded = embeddedMap.get(liveModel.id);
|
|
232
231
|
seen.add(liveModel.id);
|
|
233
232
|
if (embedded) {
|
|
233
|
+
// Self-heal: live API pricing is authoritative field-by-field. Prefer the
|
|
234
|
+
// live cost when the API reports it (non-zero); fall back to embedded when
|
|
235
|
+
// the API is silent (0) so curated cacheRead/cacheWrite isn't clobbered and
|
|
236
|
+
// providers whose /models endpoint exposes no pricing keep their curated
|
|
237
|
+
// cost. Curation (reasoning/input/compat/name) still wins via ...embedded.
|
|
234
238
|
result.push({
|
|
235
239
|
...liveModel,
|
|
236
240
|
...embedded,
|
|
241
|
+
cost: {
|
|
242
|
+
input: liveModel.cost.input || embedded.cost.input,
|
|
243
|
+
output: liveModel.cost.output || embedded.cost.output,
|
|
244
|
+
cacheRead: liveModel.cost.cacheRead || embedded.cost.cacheRead,
|
|
245
|
+
cacheWrite: liveModel.cost.cacheWrite || embedded.cost.cacheWrite,
|
|
246
|
+
},
|
|
237
247
|
contextWindow: liveModel.contextWindow || embedded.contextWindow,
|
|
238
248
|
});
|
|
239
249
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-baseten-provider",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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",
|