@agentistics/mcp 2.204.3 → 2.204.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/dist/agentistics-mcp.js +26 -2
- package/package.json +1 -1
package/dist/agentistics-mcp.js
CHANGED
|
@@ -1613,7 +1613,7 @@ function pricingKey(modelId) {
|
|
|
1613
1613
|
let forwardKey = "";
|
|
1614
1614
|
let reverseKey = "";
|
|
1615
1615
|
for (const key of Object.keys(MODEL_PRICING)) {
|
|
1616
|
-
if (id.startsWith(key)) {
|
|
1616
|
+
if (id.startsWith(key) && !/^(?:\d|-\d{1,2}(?!\d))/.test(id.slice(key.length))) {
|
|
1617
1617
|
if (key.length > forwardKey.length)
|
|
1618
1618
|
forwardKey = key;
|
|
1619
1619
|
} else if (id && key.startsWith(id) && key[id.length] === "-") {
|
|
@@ -1631,7 +1631,31 @@ function getModelPrice(modelId) {
|
|
|
1631
1631
|
if (isLocalModelId(modelId))
|
|
1632
1632
|
return LOCAL_MODEL_PRICE;
|
|
1633
1633
|
const hit = pricingKey(modelId);
|
|
1634
|
-
|
|
1634
|
+
if (hit)
|
|
1635
|
+
return MODEL_PRICING[hit];
|
|
1636
|
+
const canonical = canonicalModelId(modelId);
|
|
1637
|
+
if (canonical && canonical !== modelId) {
|
|
1638
|
+
const viaGateway = MODEL_PRICING[canonical] ? canonical : pricingKey(canonical);
|
|
1639
|
+
if (viaGateway)
|
|
1640
|
+
return MODEL_PRICING[viaGateway];
|
|
1641
|
+
}
|
|
1642
|
+
return UNPRICED_PRICE;
|
|
1643
|
+
}
|
|
1644
|
+
function canonicalModelId(modelId) {
|
|
1645
|
+
let id = String(modelId ?? "").trim().toLowerCase();
|
|
1646
|
+
if (!id)
|
|
1647
|
+
return null;
|
|
1648
|
+
id = id.slice(id.lastIndexOf("/") + 1);
|
|
1649
|
+
const bedrock = /(?:^|\.)(claude-.*)$/.exec(id);
|
|
1650
|
+
if (bedrock)
|
|
1651
|
+
id = bedrock[1];
|
|
1652
|
+
else if (id.includes("claude-"))
|
|
1653
|
+
return null;
|
|
1654
|
+
id = id.replace(/[:@].*$/, "");
|
|
1655
|
+
id = id.replace(/(\d)\.(?=\d)/g, "$1-");
|
|
1656
|
+
if (/^(fable|opus|sonnet|haiku|mythos)-/.test(id))
|
|
1657
|
+
id = `claude-${id}`;
|
|
1658
|
+
return id || null;
|
|
1635
1659
|
}
|
|
1636
1660
|
var isUnpricedModel = (modelId) => getModelPrice(modelId) === UNPRICED_PRICE;
|
|
1637
1661
|
function sessionModelUsage(s, fallbackModel) {
|
package/package.json
CHANGED