@alisio/plugin-openai-compatible 0.1.0-alpha.8 → 0.1.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/README.md +54 -4
- package/dist/provider.js +5 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,57 @@
|
|
|
1
1
|
# @alisio/plugin-openai-compatible
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
**The built-in OpenAI-compatible model provider for [Alisio](https://github.com/GustavoGutierrez/alisio).**
|
|
4
|
+
Point it at any Chat Completions or Responses endpoint — OpenAI, a gateway, or a local server such
|
|
5
|
+
as llama.cpp — and use it from `/connect`.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
## What it is
|
|
8
|
+
|
|
9
|
+
A `model-provider` plugin that registers the `openai-compatible` provider with the Alisio host. It
|
|
10
|
+
ships as a built-in of the `alisio` CLI and is enabled by default. Configuration and credentials
|
|
11
|
+
are supplied by the Alisio provider registry; the plugin does not persist secrets itself.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Preinstalled in the `alisio` CLI. For an embedded host, register it through `createApplication`'s
|
|
16
|
+
`builtins` list.
|
|
17
|
+
|
|
18
|
+
## Using it: `/connect`
|
|
19
|
+
|
|
20
|
+
1. Run `alisio`, then `/connect` and choose **OpenAI compatible**.
|
|
21
|
+
2. Fields: **Base URL** (default `https://api.openai.com/v1`), **API key** (secret, optional),
|
|
22
|
+
**API key environment variable** (default `OPENAI_API_KEY`), **API mode** (`chat` or
|
|
23
|
+
`responses`), **Authentication** (`bearer` or `none`), **Token parameter** (`max_tokens`,
|
|
24
|
+
`max_completion_tokens` or `omit`), **Stream usage** (boolean).
|
|
25
|
+
3. Pick a model from the discovered catalog — or enter one manually when the endpoint exposes no
|
|
26
|
+
`GET /models` catalog (`/connect` then asks for an optional context window in tokens).
|
|
27
|
+
|
|
28
|
+
The key is read from the stored credential first, then from `process.env[apiKeyEnv]`:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
export OPENAI_API_KEY=... # never put the key in config files, profiles or READMEs
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- Model discovery via `GET /models`; per-model context windows (overridable per profile).
|
|
37
|
+
- Chat Completions and Responses modes; bearer or no authentication; configurable token parameter.
|
|
38
|
+
- Tool calls, usage metadata, reasoning deltas and image attachments.
|
|
39
|
+
- Provider-native web search available when the API mode is `responses`.
|
|
40
|
+
- Legacy `provider` configuration (`baseURL`, `apiKeyEnv`, `model`, `apiMode`, `auth`,
|
|
41
|
+
`tokenParameter`, `streamUsage`) keeps working for startup and headless runs.
|
|
42
|
+
|
|
43
|
+
While registered, the provider also appears in `/model` and `alisio doctor`.
|
|
44
|
+
|
|
45
|
+
## Docs
|
|
46
|
+
|
|
47
|
+
[Configuration](https://gustavogutierrez.github.io/alisio/configuration) ·
|
|
48
|
+
[Plugins](https://gustavogutierrez.github.io/alisio/plugins).
|
|
49
|
+
|
|
50
|
+
## Requirements
|
|
51
|
+
|
|
52
|
+
Node.js **>= 22.16** or Bun **>= 1.4.2**.
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT. Maintained by Gustavo Gutiérrez Mercado. Source: <https://github.com/GustavoGutierrez/alisio> ·
|
|
57
|
+
npm: <https://www.npmjs.com/settings/alisio/packages>.
|
package/dist/provider.js
CHANGED
|
@@ -135,10 +135,11 @@ export class OpenAICompatibleProvider {
|
|
|
135
135
|
if (finish !== "stop" && finish !== "tool_calls" && finish !== "length")
|
|
136
136
|
throw new Error(`Provider response incomplete: ${finish ?? "stream ended"}`);
|
|
137
137
|
const completed = [...calls.entries()].sort(([a], [b]) => a - b).map(([, c]) => c);
|
|
138
|
-
|
|
138
|
+
// A response cut by the output limit is reported as it is (`truncated: true`), even when it
|
|
139
|
+
// has no text or its tool calls are partial: the host decides whether to recover, and never
|
|
140
|
+
// executes a call whose arguments are incomplete.
|
|
141
|
+
if (finish !== "length" && completed.some((c) => !c.id || !c.name))
|
|
139
142
|
throw new Error("Incomplete tool call");
|
|
140
|
-
if (finish === "length" && !text.trim())
|
|
141
|
-
throw new Error("Provider response cut off by max output tokens before any usable content; raise limits.maxOutputTokens (/settings → Agent max output tokens)");
|
|
142
143
|
yield {
|
|
143
144
|
type: "completed",
|
|
144
145
|
message: {
|
|
@@ -215,10 +216,7 @@ export class OpenAICompatibleProvider {
|
|
|
215
216
|
.filter((x) => x.type === "output_text")
|
|
216
217
|
.map((x) => x.text)
|
|
217
218
|
.join("");
|
|
218
|
-
|
|
219
|
-
throw new Error("Provider response cut off by max output tokens before any usable content; raise limits.maxOutputTokens (/settings → Agent max output tokens)");
|
|
220
|
-
if (calls.some((c) => !c.id || !c.name))
|
|
221
|
-
throw new Error("Incomplete tool call");
|
|
219
|
+
// Reported as truncated even when empty or with partial calls: the host recovers.
|
|
222
220
|
yield {
|
|
223
221
|
type: "completed",
|
|
224
222
|
message: { role: "assistant", text, calls, providerData: r.output, truncated: true },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alisio/plugin-openai-compatible",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Built-in OpenAI-compatible model provider for Alisio.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"openai": "7.23.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@alisio/sdk": "^0.1.0
|
|
27
|
+
"@alisio/sdk": "^0.1.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@alisio/sdk": "0.1.0
|
|
30
|
+
"@alisio/sdk": "0.1.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public",
|