omp packages

pi-provider-cysuo0.1.2

词元所 (Cysuo) model provider for Pi: DeepSeek V4.1 Flash, ERNIE 5.1 and GLM-5.3 via https://api.cysuo.com/v1

GitHub Actions Published 2 days ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-provider-cysuo

词元所 (Cysuo) model provider for Pi. It adds the cysuo provider with DeepSeek V4.1 Flash (default), ERNIE 5.1 and GLM-5.3 via https://api.cysuo.com/v1.

为 Pi 增加词元所 provider,包含三个模型:

模型 上下文 最长输出 思考级别 图片 缓存
deepseek-v4.1-flash(默认) 1M 393,216 off / high / max ✓ ✓
ernie-5.1 122,880 65,536 off / high — —
glm-5.3 1M 131,072 low / high / max(始终思考) — ✓

安装

pi install npm:pi-provider-cysuo

只在当前项目启用:pi install --local npm:pi-provider-cysuo。不安装、只试一次:pi -e npm:pi-provider-cysuo。

升级:pi update --extensions。更新后 Pi 会在启动时显示 CHANGELOG 中的新条目。

配置 API key

在 词元所控制台 创建 API key,然后任选一种方式:

# 1. 存入 ~/.pi/agent/auth.json(推荐)
pi auth login cysuo --api-key      # 或在 Pi 里输入 /login,选择 “Cysuo”

# 2. 环境变量
export CYSUO_API_KEY=...

只粘贴 key 本身,不要带 Bearer 前缀。两种都配置时,auth.json 中的 key 优先。用 pi auth check --provider cysuo 检查,输出 ready 即可。

使用

pi --model cysuo/deepseek-v4.1-flash
pi --model cysuo/ernie-5.1 --thinking high
pi --model cysuo/glm-5.3 --thinking max

在 Pi 中用 /model 切换。

在 Pi 里用 /login 保存词元所 key 后,本扩展自动选中 cysuo/deepseek-v4.1-flash,并把它写入 ~/.pi/agent/settings.json 作为默认模型(等同于在 /model 中按 Ctrl+S),显示 Selected cysuo/deepseek-v4.1-flash and saved it as the default model。之后启动 Pi 都直接使用它,即使还配置了其他 provider。当前已经是某个 cysuo 模型时保留该模型,只把它存为默认。只改 defaultProvider 和 defaultModel 两项,其他设置不变。

当前没有选中模型时(例如第一次配置),Pi 会在上面那行之前先报 no default model is configured for provider "cysuo",可以忽略:这行提示写死在 Pi 里,扩展无法关闭。

用 pi auth login 或 CYSUO_API_KEY 配置 key 时不会自动保存默认模型。没有配置其他 provider 时,Pi 启动时会自动选中 cysuo/deepseek-v4.1-flash;否则在 /model 中选中后按 Ctrl+S 保存,或在 ~/.pi/agent/settings.json 中写:

{ "defaultProvider": "cysuo", "defaultModel": "deepseek-v4.1-flash" }

Pi 有时在扩展 provider 的 key 状态就绪前就选好启动模型,于是忽略已保存的 cysuo 默认模型,改用其他 provider 的模型(earendil-works/pi#8810)。本扩展在启动和 /new 时检查这种情况,改回保存的模型,并显示 Selected the saved default model cysuo/...。命令行带 --model / --provider / --models、启用了模型范围(enabledModels)或恢复已有对话时不做处理。

思考级别

三个模型不带思考字段时都默认思考,所以 off 必须显式关闭。

模型 Pi 级别 发送的请求字段
deepseek-v4.1-flash off thinking: {type: "disabled"}
high / max thinking: {type: "enabled"}, reasoning_effort: "high" / "max"
ernie-5.1 off thinking: {type: "disabled"}
high thinking: {type: "enabled"}(reasoning_effort 对它无效,不发送)
glm-5.3 low / high / max thinking: {type: "enabled"}, reasoning_effort: "low" / "high" / "max";带工具时加 tool_stream: true
  • 选择模型不支持的级别时,Pi 自动换成最接近的级别(例如 ernie-5.1 选 max 实际为 high)。
  • glm-5.3 无法关闭思考:接口对 thinking: {type: "disabled"} 返回 400。在 Pi 中选 off 会自动变成 low(思考很短)。
  • enable_thinking: false 对 deepseek-v4.1-flash 无效,所以本扩展统一用 thinking 字段。

价格

价格来自词元所模型广场(广州区域,含税),按 1 USD = 6.67 CNY 换算为 Pi 使用的 USD / 1M tokens:

模型 线路 输入 CNY 输出 CNY 缓存命中 CNY Pi 中输入 / 输出 / 缓存 USD
deepseek-v4.1-flash 博川科技 0.74 2.96 0.0148 0.110945 / 0.443778 / 0.002219
ernie-5.1 千帆 4 18 无缓存 0.5997 / 2.698651 / 0
glm-5.3 博川科技 4.64 16.24 1.16 0.695652 / 2.434783 / 0.173913

同一模型有多家供应商、价格不同,表中是调用量最大的线路。Pi 显示的费用是估算值,以词元所账单为准。

已验证行为

2026-12-01 对 https://api.cysuo.com/v1 实测,三个模型共同的部分:

  • 流式输出:先 reasoning_content 再 content,以 data: [DONE] 结束;Pi 读取最后一次 usage。
  • 工具调用:流式和非流式都可用,strict: true 可用,Pi 中多轮工具循环正常。
  • 历史回放:带或不带 reasoning_content 的 assistant 工具调用历史都返回 200。
  • 角色:system、developer、对话中间的 system 消息都生效。
  • max_tokens 生效;超过上表"最长输出"返回 400。
  • n > 1 只返回 1 个结果。

各模型的差异:

  • deepseek-v4.1-flash:image_url(data URI)可识别;相同前缀第二次请求起 cached_tokens 命中。
  • ernie-5.1:不支持图片(400);没有缓存;首 token 约 2–3 秒;超出 122,880 输入 token 时约 12 分钟后才返回 400 input token limit is 122880,本扩展把它标记为上下文溢出,让 Pi 自动压缩后重试。
  • glm-5.3:始终思考;reasoning_effort 只接受 low / high / max;不支持图片(400);缓存命中率高。low 的思考极短,个别请求不返回思考内容(不影响回答)。

常见问题

现象 原因与处理
--list-models 里没有 cysuo 未配置 key。执行 pi auth check --provider cysuo。
401 unauthorized:api key is invalid key 错误,或粘贴时带了 Bearer 前缀。
429 rate limiting:concurrency limit exceeded 并发请求过多。Pi 会自动重试,也可以减少并行的子任务。
404 model not exist 模型 ID 拼写错误。
glm-5.3 选了 off 仍在思考 正常,这个模型不能关闭思考,Pi 自动用 low。
--thinking off 仍在思考,请求里出现 enable_thinking ~/.pi/agent/models.json 里也定义了 cysuo provider,且在 provider 级别写了 compat,它会覆盖本扩展所有模型的设置。删除 models.json 中整个 cysuo 条目(三个模型都由本扩展提供)。
模型的上下文、输出上限与上表不符 models.json 的 cysuo 下有同 ID 的模型(例如以前手动配置的 ernie-5.1),它会覆盖本扩展的定义。删除该条目即可。

开发

npm install
npm run check                       # tsc
npm test                            # 离线测试
CYSUO_API_KEY=... npm run test:live # 真实接口测试(三个模型,约 40 秒)
pi -e ./index.ts                    # 用本地代码启动 Pi

License

MIT