@d3ara1n/pi-provider-sensenova 1.1.0 → 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 +12 -6
  2. package/package.json +2 -2
  3. package/src/index.ts +44 -7
package/README.md CHANGED
@@ -13,13 +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. It supports:
18
- - **Text + image input** (OpenAI Vision-compatible format)
19
- - **Reasoning** (chain-of-thought via `reasoning` field, controlled by `reasoning_effort`)
20
- - **Tool calling** (`tools` / `tool_choice`)
21
- - **JSON mode** (`response_format: { type: "json_object" }`)
22
- - **Streaming** (SSE, with `usage` in last chunk)
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:
22
+
23
+ - **OpenAI-compatible chat/completions transport** via pi's built-in provider layer
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
27
+
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).
23
29
 
24
30
  ## Installation
25
31
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@d3ara1n/pi-provider-sensenova",
3
- "version": "1.1.0",
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,12 +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
- compat: {
33
- supportsDeveloperRole: false, // uses `system` role, not `developer`
34
- },
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,
35
72
  },
36
73
  ];
37
74