DSH Web GUI 已多出一个 provider:讯飞星辰 Spark,模型 Spark-X2.6 (1M)。改完即热加载,不需要重启 DSH。
| 文件 | 改动 |
|---|---|
~/.dsh/.credentials.yaml | refs 增加 XFYUN_SPARK_API_KEY: "ak-ca7d…c33bd" |
~/.dsh/profiles/web/cordis.patch.yml | llm-pi-ai.config.providers 增加 xfyun 块 |
备份:~/.dsh/profiles/web/cordis.patch.yml.bak-before-xfyun-<时间戳>(改动前原件)。
DSH 的 provider 配置在 profile 的 cordis.patch.yml,不在
~/.dsh/settings.yaml(那是旧格式备份)。密钥统一放.credentials.yaml的refs,provider 里用apiKeyEnv引用。两个文件都是热加载(patch 是patchReload: live,credentials 有 chokidar watch)。
| 项 | 取值 | 说明 |
|---|---|---|
| baseURL | https://maas-api.cn-huabei-1.xf-yun.com/v2 | 只填到 /v2,插件自己拼 /chat/completions。/v1 实测也能通,但官方文档把它留给 /v1/responses;spark-api-open.xf-yun.com(旧星火 HTTP 接口)返回 404,别用 |
| 模型 | spark-x2.6 | 上下文 1M,293B-A30B MoE,2026-10-20 上架 |
| 模型 | spark-x2.6-4b | 上下文 1M,4B 小模型(免费额度,2026-11-17 用户开通后追加),thinking 档位比 x2.6 严格 |
| 可用型号 | 上述两个 | spark-x2.6-preview / spark-x2.5* 仍返回 11200 no valid authorization(账号无有效订单) |
| 输入模态 | 纯文本 | 文档明确 content 数组当前只支持 type=text;传 image_url 报 10042(服务端拉图失败,不是不支持图片那么直白,但确实没有视觉能力) |
| 思考控制 | thinking:{type:enabled|disabled|auto} + reasoning_effort: none|low|high | 两者都认、可并存;实测 medium/max 也不报错但只有 low/high 是真的分档 → compat 用 thinkingFormat: deepseek,max 归并到 high |
| 输出长度 | max_completion_tokens | 官方已把 max_tokens 标废弃(仍兼容),maxTokensField: max_completion_tokens,模型档位设 65536 |
| 其它 compat | supportsDeveloperRole: false、requiresReasoningContentOnAssistantMessages: true | 讯飞只有 system 没有 developer;assistant 历史里回传 reasoning_content 实测被接受 |
| 超时 | streamIdleTimeoutMs: 600000 | 1M 上下文,长 prompt 预填可能很久,默认 300s 会掐断流 |
GET /v1/models(和 /v2 等价)→ {"data":[{"id":"spark-x2.6",…}]}content + reasoning_content,usage.completion_tokens_details.reasoning_tokens 有值reasoning_effort 三档对照(同一句「1+1=?」):
none → 正文 1+1=2,reasoning_tokens 0low → 思考 73 tokenhigh → 思考 158 tokenthinking:{type:"disabled"} + max_completion_tokens → 正文正常、reasoning_content: nullfunction.name + call_id,后续 arguments 分片,finish_reason: "tool_calls" —— DSH 的工具调用链路可用@earendil-works/pi-ai 的 openai-completions)按上述 compat 发了一次真实请求,实际发出的 body:
{"model":"spark-x2.6","messages":[…],"stream":true,"max_completion_tokens":512,"thinking":{"type":"disabled"}}… "max_completion_tokens":512,"thinking":{"type":"enabled"},"reasoning_effort":"high"}thinking 块 + text 块,usage.reasoning=51 ✅用户开通免费额度后 GET /models 返回两个模型,4B 立即可用。
none / low / high; 传 medium / max 直接 10005 invalid request(x2.6 只是静默忽略)。 所以 DSH 的 high/max 两档必须映射到 low/high,不能透传 —— 配置里两个模型都写成 off: none / low: low / high: high / max: high。low = 277 reasoning tokens,high = 342。thinking:{type:"disabled"}、流式 reasoning_content 增量(单次 14 个 chunk)、 流式 tool_calls(首 chunk 带 name+call_id,finish_reason: tool_calls)均正常。max_completion_tokens 传 32768 / 65536 / 131072 / 262144 均不报错(服务端不校验上限)。thinking:{type:"disabled"} 返回纯文本; high → thinking:{type:"enabled"} + reasoning_effort:"high",回来 thinking 块 + text 块, 且 usage.cacheRead=64 —— 服务端有提示缓存命中。off = 不思考(快、适合改写/分类),high = 深度思考(代码/推理)。cp -a ~/.dsh/profiles/web/cordis.patch.yml.bak-before-xfyun-* ~/.dsh/profiles/web/cordis.patch.yml
# 再从 ~/.dsh/.credentials.yaml 删掉 XFYUN_SPARK_API_KEY 一行
热加载,改完立刻回到接入前状态;不会影响其它 provider。