@levelcode/cli 0.3.2 → 0.3.3
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/index.js +11 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -108692,7 +108692,7 @@ var init_provider_registry = __esm(() => {
|
|
|
108692
108692
|
perplexity: {
|
|
108693
108693
|
id: "perplexity",
|
|
108694
108694
|
name: "Perplexity",
|
|
108695
|
-
baseUrl: "https://api.perplexity.ai",
|
|
108695
|
+
baseUrl: "https://api.perplexity.ai/v1",
|
|
108696
108696
|
envVars: ["PERPLEXITY_API_KEY"],
|
|
108697
108697
|
apiFormat: "openai-compatible",
|
|
108698
108698
|
authType: "bearer",
|
|
@@ -108783,10 +108783,11 @@ var init_provider_registry = __esm(() => {
|
|
|
108783
108783
|
id: "azure-openai",
|
|
108784
108784
|
name: "Azure OpenAI",
|
|
108785
108785
|
baseUrl: "",
|
|
108786
|
-
envVars: ["AZURE_OPENAI_API_KEY"],
|
|
108786
|
+
envVars: ["AZURE_OPENAI_API_KEY", "AZURE_API_KEY"],
|
|
108787
108787
|
apiFormat: "openai-compatible",
|
|
108788
108788
|
authType: "bearer",
|
|
108789
|
-
category: "enterprise"
|
|
108789
|
+
category: "enterprise",
|
|
108790
|
+
description: "Requires custom baseUrl: https://<resource>.openai.azure.com/openai/deployments/<deployment>/v1"
|
|
108790
108791
|
},
|
|
108791
108792
|
"github-models": {
|
|
108792
108793
|
id: "github-models",
|
|
@@ -109066,6 +109067,9 @@ function createProviderModel(providerId, modelId, apiKey, baseUrl, oauthAccessTo
|
|
|
109066
109067
|
const definition2 = getProviderDefinition(providerId);
|
|
109067
109068
|
const effectiveBaseUrl = baseUrl ?? definition2?.baseUrl ?? "";
|
|
109068
109069
|
const effectiveApiKey = oauthAccessToken ?? apiKey;
|
|
109070
|
+
if (!effectiveBaseUrl && definition2?.apiFormat !== "anthropic") {
|
|
109071
|
+
throw new Error(`Provider "${providerId}" requires a custom baseUrl. ` + (definition2?.description ?? `Set baseUrl in /provider:add or providers.json.`));
|
|
109072
|
+
}
|
|
109069
109073
|
if (definition2?.apiFormat === "anthropic") {
|
|
109070
109074
|
const anthropic2 = createAnthropic({ apiKey: effectiveApiKey });
|
|
109071
109075
|
return anthropic2(modelId);
|
|
@@ -109079,6 +109083,8 @@ function createProviderModel(providerId, modelId, apiKey, baseUrl, oauthAccessTo
|
|
|
109079
109083
|
h2["Authorization"] = `Bearer ${effectiveApiKey}`;
|
|
109080
109084
|
} else if (definition2?.authType === "x-api-key" && effectiveApiKey) {
|
|
109081
109085
|
h2["x-api-key"] = effectiveApiKey;
|
|
109086
|
+
} else if (definition2?.authType === "aws-credentials" && effectiveApiKey) {
|
|
109087
|
+
h2["Authorization"] = `Bearer ${effectiveApiKey}`;
|
|
109082
109088
|
}
|
|
109083
109089
|
if (definition2?.defaultHeaders) {
|
|
109084
109090
|
Object.assign(h2, definition2.defaultHeaders);
|
|
@@ -109132,7 +109138,7 @@ async function resolveModelFromProviders(modelId) {
|
|
|
109132
109138
|
}
|
|
109133
109139
|
}
|
|
109134
109140
|
if (modelId.includes("/")) {
|
|
109135
|
-
const aggregatorProviders = ["openrouter", "together", "deepinfra", "fireworks
|
|
109141
|
+
const aggregatorProviders = ["openrouter", "together", "deepinfra", "fireworks", "groq", "aihubmix"];
|
|
109136
109142
|
for (const providerId of aggregatorProviders) {
|
|
109137
109143
|
const entry = config2.providers[providerId];
|
|
109138
109144
|
if (!entry?.enabled)
|
|
@@ -198378,6 +198384,7 @@ async function testProvider(providerId, apiKey, baseUrl, oauthAccessToken) {
|
|
|
198378
198384
|
const headers = {};
|
|
198379
198385
|
switch (definition2.authType) {
|
|
198380
198386
|
case "bearer":
|
|
198387
|
+
case "aws-credentials":
|
|
198381
198388
|
headers["Authorization"] = `Bearer ${effectiveApiKey}`;
|
|
198382
198389
|
break;
|
|
198383
198390
|
case "x-api-key":
|