pi-lilac-provider 1.3.0 → 1.4.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 +28 -8
- package/index.ts +54 -10
- package/package.json +1 -1
- package/patch.json +48 -12
- package/scripts/update-models.js +10 -2
package/README.md
CHANGED
|
@@ -103,13 +103,33 @@ pi --provider lilac --model moonshotai/kimi-k2.6
|
|
|
103
103
|
|
|
104
104
|
### Thinking Mode
|
|
105
105
|
|
|
106
|
-
All Lilac models
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
All Lilac models toggle reasoning via `chat_template_kwargs`, but the key each
|
|
107
|
+
model's chat template honors differs per family. The provider uses pi's
|
|
108
|
+
`chat-template` thinkingFormat with per-model `chatTemplateKwargs` (configured in
|
|
109
|
+
`patch.json`) so the right key reaches each template:
|
|
110
|
+
|
|
111
|
+
| Model | Reasoning key | Default |
|
|
112
|
+
|-------|---------------|---------|
|
|
113
|
+
| Kimi K2.6 | `thinking` (bool) | on |
|
|
114
|
+
| GLM 5.1 | `enable_thinking` (bool) | on |
|
|
115
|
+
| GLM 5.2 | `enable_thinking` (bool) + `reasoning_effort` (`max`\|`high`) | on (`max`) |
|
|
116
|
+
| Gemma 4 | `enable_thinking` (bool) | off |
|
|
117
|
+
| MiniMax M2.7 | `thinking` + `enable_thinking` (bool) | on |
|
|
118
|
+
| MiniMax M3 | `thinking_mode` (`disabled`\|`adaptive`\|`enabled`) | adaptive (server) |
|
|
119
|
+
|
|
120
|
+
Kimi K2.6, GLM 5.1, Gemma 4, and MiniMax M2.7 use the forward-compatible form
|
|
121
|
+
that sends **both** `thinking` and `enable_thinking`, so whichever key the
|
|
122
|
+
template honors is set. GLM 5.2 additionally maps pi's thinking levels to
|
|
123
|
+
`reasoning_effort` (`high` = lower-latency, `xhigh` = `max`). MiniMax M3 uses
|
|
124
|
+
the `thinking_mode` enum, exposed as three pi thinking levels: `off` →
|
|
125
|
+
`disabled` (never think), `minimal` → `adaptive` (the model decides), `high` →
|
|
126
|
+
`enabled` (always think). Pi starts at `off` (`disabled`); cycle to `minimal`
|
|
127
|
+
for M3's adaptive "model decides" mode. (The selector/footer show pi's level
|
|
128
|
+
names — `minimal`/`high` — not the `thinking_mode` values; pi has no per-model
|
|
129
|
+
level-relabel hook.)
|
|
130
|
+
|
|
131
|
+
In pi, reasoning models automatically use the appropriate thinking format. Use
|
|
132
|
+
Shift+Tab to control thinking level.
|
|
113
133
|
|
|
114
134
|
### Vision
|
|
115
135
|
|
|
@@ -153,7 +173,7 @@ Add to your pi configuration for automatic loading:
|
|
|
153
173
|
|
|
154
174
|
Lilac's API is OpenAI-compatible with these specifics:
|
|
155
175
|
|
|
156
|
-
- **`thinkingFormat: "
|
|
176
|
+
- **`thinkingFormat: "chat-template"`** — All reasoning models. Lilac's vLLM backend toggles reasoning via `chat_template_kwargs`, but the honored key differs per model family. Per-model `chatTemplateKwargs` in `patch.json` send the right key(s): `thinking`+`enable_thinking` (bool) for Kimi K2.6, GLM 5.1, Gemma 4, and MiniMax M2.7; `enable_thinking` + `reasoning_effort` for GLM 5.2; `thinking_mode` (adaptive|enabled|disabled) for MiniMax M3.
|
|
157
177
|
- **`maxTokensField: "max_completion_tokens"`** — All models. Lilac supports `max_completion_tokens` (preferred for reasoning models as it includes reasoning tokens).
|
|
158
178
|
- **`supportsDeveloperRole: true`** — All models. Lilac's vLLM backend maps the developer role to system.
|
|
159
179
|
- **`supportsStore: false`** — All models. Lilac doesn't support the `store` parameter.
|
package/index.ts
CHANGED
|
@@ -5,14 +5,28 @@
|
|
|
5
5
|
* Base URL: https://api.getlilac.com/v1
|
|
6
6
|
*
|
|
7
7
|
* Lilac serves models via a customized fork of vLLM tuned for idle-GPU scheduling
|
|
8
|
-
* and shared warm endpoints.
|
|
8
|
+
* and shared warm endpoints. Reasoning is toggled via chat_template_kwargs, but
|
|
9
|
+
* the key each model's chat template honors differs per family, so per-model
|
|
10
|
+
* chatTemplateKwargs are configured in patch.json:
|
|
9
11
|
*
|
|
10
|
-
* - Kimi K2.6:
|
|
11
|
-
* - GLM 5.1:
|
|
12
|
-
* -
|
|
12
|
+
* - Kimi K2.6: honors `thinking` (bool); `enable_thinking` ignored. ON by default.
|
|
13
|
+
* - GLM 5.1: honors `enable_thinking` (bool). ON by default.
|
|
14
|
+
* - GLM 5.2: honors `enable_thinking` (bool) + `reasoning_effort` (max|high). ON by default.
|
|
15
|
+
* - Gemma 4: honors `enable_thinking` (bool). OFF by default.
|
|
16
|
+
* - MiniMax M2.7: forward-compatible `thinking` + `enable_thinking` (bool).
|
|
17
|
+
* - MiniMax M3: honors `thinking_mode` (disabled|adaptive|enabled); bool keys ignored.
|
|
13
18
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
19
|
+
* We use pi's `chat-template` thinkingFormat (NOT `qwen-chat-template`, which
|
|
20
|
+
* sends only `enable_thinking` + `preserve_thinking` and is ignored by Kimi and
|
|
21
|
+
* MiniMax M3). The forward-compatible form sends BOTH `thinking` and
|
|
22
|
+
* `enable_thinking` so whichever key the template honors is set:
|
|
23
|
+
* { chat_template_kwargs: { thinking: <bool>, enable_thinking: <bool> } }
|
|
24
|
+
* GLM 5.2 adds `reasoning_effort` (high = lower-latency, xhigh = max) via a
|
|
25
|
+
* thinkingLevelMap. MiniMax M3 maps to the `thinking_mode` enum as three pi
|
|
26
|
+
* thinking levels — off→disabled, minimal→adaptive (model decides), high→enabled
|
|
27
|
+
* — so adaptive is selectable via pi's Shift+Tab cycle (off→minimal→high). Pi
|
|
28
|
+
* shows the pi level names (minimal/high) in the selector/footer, not the
|
|
29
|
+
* thinking_mode values; there's no per-model level-relabel hook.
|
|
16
30
|
*
|
|
17
31
|
* Key API notes:
|
|
18
32
|
* - Uses `max_completion_tokens` (preferred for reasoning models)
|
|
@@ -99,6 +113,17 @@ type ThinkingLevelMap = {
|
|
|
99
113
|
xhigh?: string | null;
|
|
100
114
|
};
|
|
101
115
|
|
|
116
|
+
// A chat_template_kwargs value, mirroring pi-ai's ChatTemplateKwargSchema. Scalar
|
|
117
|
+
// values are passed through verbatim; { $var } values are resolved by pi-ai from
|
|
118
|
+
// the turn's thinking state ("thinking.enabled" → bool, "thinking.effort" → the
|
|
119
|
+
// mapped effort string). omitWhenOff drops the key entirely when thinking is off.
|
|
120
|
+
type ChatTemplateKwargValue =
|
|
121
|
+
| string
|
|
122
|
+
| number
|
|
123
|
+
| boolean
|
|
124
|
+
| null
|
|
125
|
+
| { $var: "thinking.enabled" | "thinking.effort"; omitWhenOff?: boolean };
|
|
126
|
+
|
|
102
127
|
interface JsonModel {
|
|
103
128
|
id: string;
|
|
104
129
|
name: string;
|
|
@@ -117,7 +142,19 @@ interface JsonModel {
|
|
|
117
142
|
supportsDeveloperRole?: boolean;
|
|
118
143
|
supportsStore?: boolean;
|
|
119
144
|
maxTokensField?: "max_completion_tokens" | "max_tokens";
|
|
120
|
-
thinkingFormat?:
|
|
145
|
+
thinkingFormat?:
|
|
146
|
+
| "openai"
|
|
147
|
+
| "openrouter"
|
|
148
|
+
| "together"
|
|
149
|
+
| "deepseek"
|
|
150
|
+
| "zai"
|
|
151
|
+
| "qwen"
|
|
152
|
+
| "chat-template"
|
|
153
|
+
| "qwen-chat-template"
|
|
154
|
+
| "string-thinking"
|
|
155
|
+
| "ant-ling";
|
|
156
|
+
chatTemplateKwargs?: Record<string, ChatTemplateKwargValue>;
|
|
157
|
+
zaiToolStream?: boolean;
|
|
121
158
|
supportsReasoningEffort?: boolean;
|
|
122
159
|
};
|
|
123
160
|
discount?: JsonDiscount;
|
|
@@ -252,14 +289,21 @@ function transformApiModel(apiModel: any): JsonModel | null {
|
|
|
252
289
|
maxTokens: apiModel.top_provider?.max_completion_tokens || apiModel.context_length || 131072,
|
|
253
290
|
};
|
|
254
291
|
|
|
255
|
-
// All Lilac models
|
|
292
|
+
// All Lilac models toggle reasoning via chat_template_kwargs, but the key each
|
|
293
|
+
// model's chat template honors differs per family. Default newly discovered
|
|
294
|
+
// models to the forward-compatible both-keys form (works across all current
|
|
295
|
+
// Lilac templates); per-model overrides in patch.json refine this — e.g. GLM
|
|
296
|
+
// 5.2 adds reasoning_effort, MiniMax M3 uses the thinking_mode enum.
|
|
256
297
|
if (features.includes("reasoning")) {
|
|
257
298
|
model.compat = {
|
|
258
299
|
supportsDeveloperRole: true,
|
|
259
300
|
supportsStore: false,
|
|
260
301
|
maxTokensField: "max_completion_tokens",
|
|
261
|
-
thinkingFormat: "
|
|
262
|
-
|
|
302
|
+
thinkingFormat: "chat-template",
|
|
303
|
+
chatTemplateKwargs: {
|
|
304
|
+
thinking: { $var: "thinking.enabled" },
|
|
305
|
+
enable_thinking: { $var: "thinking.enabled" },
|
|
306
|
+
},
|
|
263
307
|
};
|
|
264
308
|
} else {
|
|
265
309
|
model.compat = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-lilac-provider",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Lilac provider extension for pi - Access Kimi K2.6, GLM 5.1, and Gemma 4 models through Lilac's OpenAI-compatible API on idle GPUs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
package/patch.json
CHANGED
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
"cacheRead": 0.20
|
|
8
8
|
},
|
|
9
9
|
"compat": {
|
|
10
|
-
"thinkingFormat": "
|
|
10
|
+
"thinkingFormat": "chat-template",
|
|
11
|
+
"chatTemplateKwargs": {
|
|
12
|
+
"thinking": { "$var": "thinking.enabled" },
|
|
13
|
+
"enable_thinking": { "$var": "thinking.enabled" }
|
|
14
|
+
},
|
|
11
15
|
"maxTokensField": "max_completion_tokens",
|
|
12
16
|
"supportsDeveloperRole": false,
|
|
13
|
-
"supportsStore": false
|
|
14
|
-
"supportsReasoningEffort": true
|
|
17
|
+
"supportsStore": false
|
|
15
18
|
}
|
|
16
19
|
},
|
|
17
20
|
"zai-org/glm-5.1": {
|
|
@@ -23,20 +26,29 @@
|
|
|
23
26
|
"cacheRead": 0.27
|
|
24
27
|
},
|
|
25
28
|
"compat": {
|
|
26
|
-
"thinkingFormat": "
|
|
29
|
+
"thinkingFormat": "chat-template",
|
|
30
|
+
"chatTemplateKwargs": {
|
|
31
|
+
"thinking": { "$var": "thinking.enabled" },
|
|
32
|
+
"enable_thinking": { "$var": "thinking.enabled" }
|
|
33
|
+
},
|
|
27
34
|
"maxTokensField": "max_completion_tokens",
|
|
28
35
|
"supportsDeveloperRole": false,
|
|
29
36
|
"supportsStore": false,
|
|
30
|
-
"zaiToolStream": true
|
|
31
|
-
"supportsReasoningEffort": true
|
|
37
|
+
"zaiToolStream": true
|
|
32
38
|
}
|
|
33
39
|
},
|
|
34
40
|
"zai-org/glm-5.2": {
|
|
41
|
+
"compat": {
|
|
42
|
+
"thinkingFormat": "chat-template",
|
|
43
|
+
"chatTemplateKwargs": {
|
|
44
|
+
"enable_thinking": { "$var": "thinking.enabled" },
|
|
45
|
+
"reasoning_effort": { "$var": "thinking.effort", "omitWhenOff": true }
|
|
46
|
+
}
|
|
47
|
+
},
|
|
35
48
|
"thinkingLevelMap": {
|
|
36
|
-
"off": "minimal",
|
|
37
49
|
"minimal": null,
|
|
38
|
-
"low":
|
|
39
|
-
"medium":
|
|
50
|
+
"low": "high",
|
|
51
|
+
"medium": "high",
|
|
40
52
|
"high": "high",
|
|
41
53
|
"xhigh": "max"
|
|
42
54
|
}
|
|
@@ -49,16 +61,40 @@
|
|
|
49
61
|
"cacheRead": 0
|
|
50
62
|
},
|
|
51
63
|
"compat": {
|
|
52
|
-
"thinkingFormat": "
|
|
64
|
+
"thinkingFormat": "chat-template",
|
|
65
|
+
"chatTemplateKwargs": {
|
|
66
|
+
"thinking": { "$var": "thinking.enabled" },
|
|
67
|
+
"enable_thinking": { "$var": "thinking.enabled" }
|
|
68
|
+
},
|
|
53
69
|
"maxTokensField": "max_completion_tokens",
|
|
54
70
|
"supportsDeveloperRole": true,
|
|
55
|
-
"supportsStore": false
|
|
56
|
-
"supportsReasoningEffort": true
|
|
71
|
+
"supportsStore": false
|
|
57
72
|
}
|
|
58
73
|
},
|
|
59
74
|
"minimaxai/minimax-m2.7": {
|
|
60
75
|
"compat": {
|
|
76
|
+
"thinkingFormat": "chat-template",
|
|
77
|
+
"chatTemplateKwargs": {
|
|
78
|
+
"thinking": { "$var": "thinking.enabled" },
|
|
79
|
+
"enable_thinking": { "$var": "thinking.enabled" }
|
|
80
|
+
},
|
|
61
81
|
"supportsDeveloperRole": false
|
|
62
82
|
}
|
|
83
|
+
},
|
|
84
|
+
"minimaxai/minimax-m3": {
|
|
85
|
+
"compat": {
|
|
86
|
+
"thinkingFormat": "chat-template",
|
|
87
|
+
"chatTemplateKwargs": {
|
|
88
|
+
"thinking_mode": { "$var": "thinking.effort" }
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"thinkingLevelMap": {
|
|
92
|
+
"off": "disabled",
|
|
93
|
+
"minimal": "adaptive",
|
|
94
|
+
"low": null,
|
|
95
|
+
"medium": null,
|
|
96
|
+
"high": "enabled",
|
|
97
|
+
"xhigh": null
|
|
98
|
+
}
|
|
63
99
|
}
|
|
64
100
|
}
|
package/scripts/update-models.js
CHANGED
|
@@ -147,7 +147,11 @@ function transformApiModel(apiModel, existingModelsMap) {
|
|
|
147
147
|
maxTokens: apiModel.top_provider?.max_completion_tokens || apiModel.context_length || 131072,
|
|
148
148
|
};
|
|
149
149
|
|
|
150
|
-
// Add compat — all Lilac models
|
|
150
|
+
// Add compat — all Lilac models toggle reasoning via chat_template_kwargs, but
|
|
151
|
+
// the honored key differs per model family. Default newly discovered models to
|
|
152
|
+
// the forward-compatible both-keys form (works across all current Lilac
|
|
153
|
+
// templates); refine per-model in patch.json (e.g. GLM 5.2 adds reasoning_effort,
|
|
154
|
+
// MiniMax M3 uses the thinking_mode enum).
|
|
151
155
|
const compat = {
|
|
152
156
|
supportsDeveloperRole: true,
|
|
153
157
|
supportsStore: false,
|
|
@@ -155,7 +159,11 @@ function transformApiModel(apiModel, existingModelsMap) {
|
|
|
155
159
|
};
|
|
156
160
|
|
|
157
161
|
if (hasReasoning) {
|
|
158
|
-
compat.thinkingFormat = '
|
|
162
|
+
compat.thinkingFormat = 'chat-template';
|
|
163
|
+
compat.chatTemplateKwargs = {
|
|
164
|
+
thinking: { $var: 'thinking.enabled' },
|
|
165
|
+
enable_thinking: { $var: 'thinking.enabled' },
|
|
166
|
+
};
|
|
159
167
|
}
|
|
160
168
|
|
|
161
169
|
model.compat = compat;
|