@d3ara1n/pi-provider-sensenova 1.0.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 +62 -0
- package/package.json +25 -0
- package/src/index.ts +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @d3ara1n/pi-provider-sensenova
|
|
2
|
+
|
|
3
|
+
SenseNova (商汤日日新) provider for [Pi Coding Agent](https://pi.dev) — registers the SenseNova Token Plan models via OpenAI-compatible API.
|
|
4
|
+
|
|
5
|
+
## Provider
|
|
6
|
+
|
|
7
|
+
| Provider ID | Name | API Key Env |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `sensenova-plan` | SenseNova (Token Plan) | `$SENSENOVA_API_KEY` |
|
|
10
|
+
|
|
11
|
+
## Models
|
|
12
|
+
|
|
13
|
+
| Model | Reasoning | Input | Context | Max Output |
|
|
14
|
+
|---|---|---|---|---|
|
|
15
|
+
| `sensenova-6.7-flash-lite` | Yes | text, image | 256K | 64K |
|
|
16
|
+
|
|
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)
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
Add the extension path to `~/.pi/agent/settings.json`:
|
|
27
|
+
|
|
28
|
+
```jsonc
|
|
29
|
+
{
|
|
30
|
+
"extensions": [
|
|
31
|
+
"/path/to/pi-extensions/packages/pi-provider-sensenova"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Set your API key:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
export SENSENOVA_API_KEY="sk-..."
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or use `/login` in pi to store it in `~/.pi/agent/auth.json`:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{ "sensenova-plan": { "apiKey": "sk-..." } }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Getting an API Key
|
|
49
|
+
|
|
50
|
+
1. Visit [SenseNova Platform](https://platform.sensenova.cn/console)
|
|
51
|
+
2. Go to 管理中心 → API-Key 管理 → 创建 API-Key
|
|
52
|
+
3. Copy the key immediately (it's shown only once)
|
|
53
|
+
|
|
54
|
+
The Token Plan is currently in **free public beta** — no credit card required, up to 1,500 calls per model every 5 hours, with up to 20 API keys.
|
|
55
|
+
|
|
56
|
+
## Dependencies
|
|
57
|
+
|
|
58
|
+
None — this is a standalone provider with no pi-extension dependencies. It uses pi's built-in `openai-completions` streaming.
|
|
59
|
+
|
|
60
|
+
## Usage Quota Reporting
|
|
61
|
+
|
|
62
|
+
Not yet implemented. SenseNova does not currently expose a public quota or balance API. When one becomes available, quota reporting will be added via `@d3ara1n/pi-usage-block-core`.
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@d3ara1n/pi-provider-sensenova",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "SenseNova (商汤日日新) provider for pi — registers sensenova-6.7-flash-lite model via OpenAI-compatible API",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pi-package",
|
|
8
|
+
"pi"
|
|
9
|
+
],
|
|
10
|
+
"main": "src/index.ts",
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"@earendil-works/pi-coding-agent": "*"
|
|
13
|
+
},
|
|
14
|
+
"pi": {
|
|
15
|
+
"extensions": [
|
|
16
|
+
"./src/index.ts"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/d3ara1n/pi-extensions",
|
|
23
|
+
"directory": "packages/pi-provider-sensenova"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pi-provider-sensenova
|
|
3
|
+
*
|
|
4
|
+
* Registers "sensenova-plan" provider for SenseNova (商汤日日新) Token Plan.
|
|
5
|
+
*
|
|
6
|
+
* Currently only includes sensenova-6.7-flash-lite — the lightweight
|
|
7
|
+
* multimodal agent model for real-world workflows.
|
|
8
|
+
*
|
|
9
|
+
* Usage quota/balance reporting is not yet implemented — SenseNova does not
|
|
10
|
+
* currently expose a public quota or balance API. Free during public beta.
|
|
11
|
+
*/
|
|
12
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
13
|
+
|
|
14
|
+
// ── Constants ─────────────────────────────────────────────────────────────
|
|
15
|
+
|
|
16
|
+
const PROVIDER_ID = "sensenova-plan";
|
|
17
|
+
const PROVIDER_NAME = "SenseNova (Token Plan)";
|
|
18
|
+
const BASE_URL = "https://token.sensenova.cn/v1";
|
|
19
|
+
const API_KEY_ENV = "SENSENOVA_API_KEY";
|
|
20
|
+
|
|
21
|
+
// ── Model ─────────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
const MODELS = [
|
|
24
|
+
{
|
|
25
|
+
id: "sensenova-6.7-flash-lite",
|
|
26
|
+
name: "SenseNova 6.7 Flash-Lite",
|
|
27
|
+
reasoning: true,
|
|
28
|
+
input: ["text", "image"] as ("text" | "image")[],
|
|
29
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, // free during beta
|
|
30
|
+
contextWindow: 262_144,
|
|
31
|
+
maxTokens: 65_536,
|
|
32
|
+
compat: {
|
|
33
|
+
supportsDeveloperRole: false, // uses `system` role, not `developer`
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
// ── Entry point ───────────────────────────────────────────────────────────
|
|
39
|
+
|
|
40
|
+
export default function (pi: ExtensionAPI) {
|
|
41
|
+
pi.registerProvider(PROVIDER_ID, {
|
|
42
|
+
name: PROVIDER_NAME,
|
|
43
|
+
baseUrl: BASE_URL,
|
|
44
|
+
apiKey: `$${API_KEY_ENV}`,
|
|
45
|
+
api: "openai-completions",
|
|
46
|
+
authHeader: true,
|
|
47
|
+
models: MODELS,
|
|
48
|
+
});
|
|
49
|
+
}
|