@d3ara1n/pi-provider-sensenova 1.1.1 → 1.2.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.
Files changed (3) hide show
  1. package/README.md +8 -4
  2. package/package.json +2 -2
  3. package/src/index.ts +44 -17
package/README.md CHANGED
@@ -13,15 +13,19 @@ SenseNova (商汤日日新) provider for [Pi Coding Agent](https://pi.dev) — r
13
13
  | Model | Reasoning | Input | Context | Max Output |
14
14
  |---|---|---|---|---|
15
15
  | `sensenova-6.7-flash-lite` | Yes | text, image | 256K | 64K |
16
+ | `deepseek-v4-flash` | Yes | text | 1M | 64K |
17
+ | `glm-5.2` | Yes | text | 1M | 128K |
16
18
 
17
- `sensenova-6.7-flash-lite` is SenseTime's lightweight multimodal agent model for real-world workflows. This provider registers the model with:
19
+ `sensenova-u1-fast` is intentionally not registered because it is an image-generation model served by a separate Images API, not Chat Completions.
20
+
21
+ This provider registers the chat models with:
18
22
 
19
- - **Text + image input**
20
- - **Reasoning enabled** in pi's model metadata
21
23
  - **OpenAI-compatible chat/completions transport** via pi's built-in provider layer
22
24
  - **`system` role compatibility** (`supportsDeveloperRole: false`)
25
+ - **Reasoning controls** via `reasoning_effort`; pi's `minimal` thinking level is omitted because SenseNova only accepts `low` / `medium` / `high` / `none`
26
+ - **Tool calling and streaming usage** verified against the live API
23
27
 
24
- Other compatibility details such as tool-call streaming quirks, usage chunks, and overflow error text should be re-verified against the live API before changing compat flags; see [`PROVIDER.md`](../../PROVIDER.md).
28
+ Other compatibility details such as overflow error text should be re-verified against the live API before changing compat flags; see [`PROVIDER.md`](../../PROVIDER.md).
25
29
 
26
30
  ## Installation
27
31
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@d3ara1n/pi-provider-sensenova",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
- "description": "SenseNova (商汤日日新) provider for pi — registers sensenova-6.7-flash-lite model via OpenAI-compatible API",
5
+ "description": "SenseNova (商汤日日新) provider for pi — registers Token Plan chat models via OpenAI-compatible API",
6
6
  "keywords": [
7
7
  "pi-package",
8
8
  "pi",
package/src/index.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Registers "sensenova-plan" provider for SenseNova (商汤日日新) Token Plan.
5
5
  *
6
- * Currently only includes sensenova-6.7-flash-lite — the lightweight
7
- * multimodal agent model for real-world workflows.
6
+ * Registers all Token Plan chat-completions models. Image-generation-only
7
+ * models are intentionally excluded.
8
8
  *
9
9
  * Usage quota/balance reporting is not yet implemented — SenseNova does not
10
10
  * currently expose a public quota or balance API. Free during public beta.
@@ -18,7 +18,23 @@ const PROVIDER_NAME = "SenseNova (Token Plan)";
18
18
  const BASE_URL = "https://token.sensenova.cn/v1";
19
19
  const API_KEY_ENV = "SENSENOVA_API_KEY";
20
20
 
21
- // ── Model ─────────────────────────────────────────────────────────────────
21
+ // ── Models ────────────────────────────────────────────────────────────────
22
+
23
+ const COST = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
24
+
25
+ const REASONING = {
26
+ // SenseNova rejects pi's `minimal` level. The API accepts low/medium/high/none.
27
+ off: "none",
28
+ minimal: null,
29
+ low: "low",
30
+ medium: "medium",
31
+ high: "high",
32
+ } as const;
33
+
34
+ const CHAT_COMPAT = {
35
+ supportsDeveloperRole: false, // uses `system` role, not `developer`
36
+ supportsReasoningEffort: true, // required for thinkingLevelMap to emit reasoning_effort
37
+ } as const;
22
38
 
23
39
  const MODELS = [
24
40
  {
@@ -26,22 +42,33 @@ const MODELS = [
26
42
  name: "SenseNova 6.7 Flash-Lite",
27
43
  reasoning: true,
28
44
  input: ["text", "image"] as ("text" | "image")[],
29
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, // free during beta
45
+ cost: COST,
30
46
  contextWindow: 262_144,
31
47
  maxTokens: 65_536,
32
- // sensenova reasons by default (~560 tokens / ~10s, enough to trip scout's
33
- // 15s side-agent timeout); only reasoning_effort=none actually disables it.
34
- thinkingLevelMap: {
35
- off: "none",
36
- minimal: null, // rejected with HTTP 400 — only low/medium/high/none valid
37
- low: "low",
38
- medium: "medium",
39
- high: "high",
40
- },
41
- compat: {
42
- supportsDeveloperRole: false, // uses `system` role, not `developer`
43
- supportsReasoningEffort: true, // required for thinkingLevelMap to emit reasoning_effort
44
- },
48
+ thinkingLevelMap: REASONING,
49
+ compat: CHAT_COMPAT,
50
+ },
51
+ {
52
+ id: "deepseek-v4-flash",
53
+ name: "DeepSeek V4 Flash",
54
+ reasoning: true,
55
+ input: ["text"] as ("text" | "image")[],
56
+ cost: COST,
57
+ contextWindow: 1_048_576,
58
+ maxTokens: 65_536,
59
+ thinkingLevelMap: REASONING,
60
+ compat: CHAT_COMPAT,
61
+ },
62
+ {
63
+ id: "glm-5.2",
64
+ name: "GLM-5.2",
65
+ reasoning: true,
66
+ input: ["text"] as ("text" | "image")[],
67
+ cost: COST,
68
+ contextWindow: 1_048_576,
69
+ maxTokens: 131_072,
70
+ thinkingLevelMap: REASONING,
71
+ compat: CHAT_COMPAT,
45
72
  },
46
73
  ];
47
74