@jacobbd/relay-ai 0.4.9 → 0.5.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/{chunk-XTBJCRT3.js → chunk-44KQK6Y5.js} +43 -10
- package/dist/chunk-44KQK6Y5.js.map +1 -0
- package/dist/{chunk-DO5FAMNC.js → chunk-MVBA7ABV.js} +22 -2
- package/dist/chunk-MVBA7ABV.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/{provider-templates-LYGIFRRT.js → provider-templates-6XYKAZB5.js} +2 -2
- package/dist/ui/public/provider-logo.js +4 -0
- package/dist/{ui-command-GATWK5JC.js → ui-command-M7KMKIQC.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-DO5FAMNC.js.map +0 -1
- package/dist/chunk-XTBJCRT3.js.map +0 -1
- /package/dist/{provider-templates-LYGIFRRT.js.map → provider-templates-6XYKAZB5.js.map} +0 -0
- /package/dist/{ui-command-GATWK5JC.js.map → ui-command-M7KMKIQC.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getTemplateById,
|
|
4
4
|
init_provider_templates
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MVBA7ABV.js";
|
|
6
6
|
|
|
7
7
|
// src/constants.ts
|
|
8
8
|
import { homedir } from "os";
|
|
@@ -11,7 +11,7 @@ import { join } from "path";
|
|
|
11
11
|
// package.json
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "@jacobbd/relay-ai",
|
|
14
|
-
version: "0.
|
|
14
|
+
version: "0.5.0",
|
|
15
15
|
publishConfig: {
|
|
16
16
|
access: "public"
|
|
17
17
|
},
|
|
@@ -3413,6 +3413,14 @@ function migrateOAuthXaiProvider(registry) {
|
|
|
3413
3413
|
};
|
|
3414
3414
|
return true;
|
|
3415
3415
|
}
|
|
3416
|
+
function migrateAlibabaDashScopeChinaLabel(registry) {
|
|
3417
|
+
const provider = registry.providers.find(
|
|
3418
|
+
(p8) => p8.id === "alibaba" && p8.templateId === "alibaba" && p8.name === "Alibaba DashScope" && p8.api.url === "https://dashscope.aliyuncs.com/compatible-mode/v1"
|
|
3419
|
+
);
|
|
3420
|
+
if (!provider) return false;
|
|
3421
|
+
provider.name = "Alibaba DashScope (China)";
|
|
3422
|
+
return true;
|
|
3423
|
+
}
|
|
3416
3424
|
|
|
3417
3425
|
// src/registry/validate.ts
|
|
3418
3426
|
var PROVIDER_ID_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
|
|
@@ -3523,6 +3531,7 @@ function loadRegistry(path = getProvidersPath()) {
|
|
|
3523
3531
|
let migrated = migrateLegacyCloudProviders(registry);
|
|
3524
3532
|
if (migrateOAuthOpenAiProvider(registry)) migrated = true;
|
|
3525
3533
|
if (migrateOAuthXaiProvider(registry)) migrated = true;
|
|
3534
|
+
if (migrateAlibabaDashScopeChinaLabel(registry)) migrated = true;
|
|
3526
3535
|
if (migrated) {
|
|
3527
3536
|
try {
|
|
3528
3537
|
saveRegistry(registry, path);
|
|
@@ -3600,11 +3609,15 @@ var TEMPLATE_TO_PRICING_PLATFORM = {
|
|
|
3600
3609
|
openai: "openai",
|
|
3601
3610
|
google: "google_ai_studio",
|
|
3602
3611
|
alibaba: "alibaba",
|
|
3612
|
+
"qwen-cloud-payg": "alibaba",
|
|
3603
3613
|
openrouter: "openrouter",
|
|
3604
3614
|
anthropic: "anthropic",
|
|
3605
3615
|
nvidia: "nvidia",
|
|
3606
3616
|
venice: "openrouter"
|
|
3607
3617
|
};
|
|
3618
|
+
var PRICING_OPT_OUT_TEMPLATE_IDS = /* @__PURE__ */ new Set([
|
|
3619
|
+
"qwen-cloud-token-plan"
|
|
3620
|
+
]);
|
|
3608
3621
|
function loadBundledPricingCache() {
|
|
3609
3622
|
return pricing_cache_default;
|
|
3610
3623
|
}
|
|
@@ -3727,13 +3740,27 @@ function enrichModelsWithPricing(models, index, platform) {
|
|
|
3727
3740
|
return { ...model, cost, isFree: isFreeStatus(freeStatus), freeStatus };
|
|
3728
3741
|
});
|
|
3729
3742
|
}
|
|
3743
|
+
function enrichModelsForProviderPricing(models, index, templateId, providerId) {
|
|
3744
|
+
if (PRICING_OPT_OUT_TEMPLATE_IDS.has(templateId) || PRICING_OPT_OUT_TEMPLATE_IDS.has(providerId)) {
|
|
3745
|
+
return models.map(({ cost: _cost, isFree: _isFree, freeStatus: _freeStatus, ...model }) => model);
|
|
3746
|
+
}
|
|
3747
|
+
return enrichModelsWithPricing(
|
|
3748
|
+
models,
|
|
3749
|
+
index,
|
|
3750
|
+
pricingPlatformForProvider(templateId, providerId)
|
|
3751
|
+
);
|
|
3752
|
+
}
|
|
3730
3753
|
function applyPricingToRegistryProviders(registry, cache) {
|
|
3731
3754
|
const index = buildPricingIndex(cache);
|
|
3732
3755
|
let changed = false;
|
|
3733
3756
|
for (const provider of registry.providers) {
|
|
3734
3757
|
if (!provider.modelsCache?.models.length) continue;
|
|
3735
|
-
const
|
|
3736
|
-
|
|
3758
|
+
const enriched = enrichModelsForProviderPricing(
|
|
3759
|
+
provider.modelsCache.models,
|
|
3760
|
+
index,
|
|
3761
|
+
provider.templateId,
|
|
3762
|
+
provider.id
|
|
3763
|
+
);
|
|
3737
3764
|
if (JSON.stringify(enriched) !== JSON.stringify(provider.modelsCache.models)) {
|
|
3738
3765
|
provider.modelsCache = { ...provider.modelsCache, models: enriched };
|
|
3739
3766
|
changed = true;
|
|
@@ -3779,6 +3806,8 @@ var REGISTRY_TO_MODELS_DEV = {
|
|
|
3779
3806
|
perplexity: "perplexity",
|
|
3780
3807
|
cohere: "cohere",
|
|
3781
3808
|
alibaba: "alibaba",
|
|
3809
|
+
"qwen-cloud-token-plan": "alibaba-token-plan",
|
|
3810
|
+
"qwen-cloud-payg": "alibaba",
|
|
3782
3811
|
openrouter: "openrouter",
|
|
3783
3812
|
anthropic: "anthropic",
|
|
3784
3813
|
nvidia: "nvidia",
|
|
@@ -9188,11 +9217,11 @@ async function addProviderFromTemplate(template, apiKey, opts) {
|
|
|
9188
9217
|
}
|
|
9189
9218
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
9190
9219
|
const pricingCache = loadPricingCache();
|
|
9191
|
-
const
|
|
9192
|
-
const pricedModels = enrichModelsWithPricing(
|
|
9220
|
+
const pricedModels = enrichModelsForProviderPricing(
|
|
9193
9221
|
usableModels.map((m) => ({ ...m, apiUrl: fetched.baseUrl })),
|
|
9194
9222
|
buildPricingIndex(pricingCache),
|
|
9195
|
-
|
|
9223
|
+
template.id,
|
|
9224
|
+
template.id
|
|
9196
9225
|
);
|
|
9197
9226
|
const entry = {
|
|
9198
9227
|
id: template.id,
|
|
@@ -9838,10 +9867,14 @@ async function refreshProviderModels(providerId, apiKey, registry = loadRegistry
|
|
|
9838
9867
|
baseUrl = fetched.baseUrl;
|
|
9839
9868
|
}
|
|
9840
9869
|
const pricingCache = loadPricingCache();
|
|
9841
|
-
const platform = pricingPlatformForProvider(provider.templateId, provider.id);
|
|
9842
9870
|
const enriched = compatibleCachedModels(
|
|
9843
9871
|
provider,
|
|
9844
|
-
|
|
9872
|
+
enrichModelsForProviderPricing(
|
|
9873
|
+
models,
|
|
9874
|
+
buildPricingIndex(pricingCache),
|
|
9875
|
+
provider.templateId,
|
|
9876
|
+
provider.id
|
|
9877
|
+
)
|
|
9845
9878
|
);
|
|
9846
9879
|
if (provider.id === "antigravity" && enriched.length === 0) {
|
|
9847
9880
|
return {
|
|
@@ -10902,4 +10935,4 @@ export {
|
|
|
10902
10935
|
supportsClaudeTransparentMode,
|
|
10903
10936
|
buildHttpProxyRoutes
|
|
10904
10937
|
};
|
|
10905
|
-
//# sourceMappingURL=chunk-
|
|
10938
|
+
//# sourceMappingURL=chunk-44KQK6Y5.js.map
|