@vincemakes/kiso-provider-openai 0.1.32 → 0.1.34
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 +20 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ export function createOpenAICompatAdapter(client) {
|
|
|
61
61
|
options.signal !== undefined ? { signal: options.signal } : undefined);
|
|
62
62
|
}
|
|
63
63
|
catch (err) {
|
|
64
|
-
throw toOpenAIError(err);
|
|
64
|
+
throw toOpenAIError(err, options.model);
|
|
65
65
|
}
|
|
66
66
|
const pending = new Map();
|
|
67
67
|
let finishReason = null;
|
|
@@ -199,7 +199,7 @@ export function createOpenAICompatAdapter(client) {
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
catch (err) {
|
|
202
|
-
throw toOpenAIError(err);
|
|
202
|
+
throw toOpenAIError(err, options.model);
|
|
203
203
|
}
|
|
204
204
|
// Close out any streamed tool calls.
|
|
205
205
|
for (const call of [...pending.values()].sort((a, b) => a.index - b.index)) {
|
|
@@ -388,16 +388,30 @@ function toOpenAITool(tool) {
|
|
|
388
388
|
function: { name: tool.name, description: tool.description, parameters: tool.inputSchema },
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
/**
|
|
392
|
+
* P3 (0.1.42) — the honest vendor label: an openai-compat SDK error's raw
|
|
393
|
+
* message is OpenAI-branded ("Incorrect API key provided") even when the
|
|
394
|
+
* backend is a compat provider (DeepSeek, GLM, Kimi, ...). The label names
|
|
395
|
+
* the endpoint the user ACTUALLY configured — the model id's vendor
|
|
396
|
+
* prefix: the part after the last "/" (provider/model forms), then before
|
|
397
|
+
* the first "-" (deepseek-v4-flash → deepseek). A model without a hyphen
|
|
398
|
+
* prefix keeps its own name — never a fabricated vendor.
|
|
399
|
+
*/
|
|
400
|
+
function vendorOf(model) {
|
|
401
|
+
const id = model.split("/").at(-1) ?? model;
|
|
402
|
+
return (id.split("-")[0] ?? id).toLowerCase();
|
|
403
|
+
}
|
|
404
|
+
function toOpenAIError(err, model) {
|
|
405
|
+
const label = `[${vendorOf(model)}] request failed: `;
|
|
392
406
|
// D4: connection-level failures are recognized, not lumped into unknown.
|
|
393
407
|
if (err instanceof OpenAI.APIConnectionTimeoutError) {
|
|
394
|
-
return { code: "timeout", retryable: true, message: err.message };
|
|
408
|
+
return { code: "timeout", retryable: true, message: label + err.message };
|
|
395
409
|
}
|
|
396
410
|
if (err instanceof OpenAI.APIConnectionError) {
|
|
397
|
-
return { code: "network", retryable: true, message: err.message };
|
|
411
|
+
return { code: "network", retryable: true, message: label + err.message };
|
|
398
412
|
}
|
|
399
413
|
if (err instanceof OpenAI.APIError) {
|
|
400
|
-
return mapApiError(err.status, err.message);
|
|
414
|
+
return mapApiError(err.status, label + err.message);
|
|
401
415
|
}
|
|
402
416
|
return err;
|
|
403
417
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-provider-openai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"description": "kiso OpenAI-compatible adapter — OpenAI + the compat family (GLM, Kimi, DeepSeek, OpenRouter) via base_url swap, reasoning dialects digested.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"test": "vitest run"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@vincemakes/kiso-core": "0.1.
|
|
24
|
+
"@vincemakes/kiso-core": "0.1.33",
|
|
25
25
|
"openai": "^7.3.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|