Voice-clone provider for the dsh-pet desktop pet: registers a SiliconFlow CosyVoice2 voice so the pet speaks its lines in a voice cloned from a short recording of your own. Requires a SiliconFlow API key and a 10 to 30 second reference clip.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:RonaWhite/dsh-pet-voice-clone
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
这是什么
一个给 dsh-pet 桌面宠物用的 DSH 插件。它往桌宠的「音色」列表里塞进一个新的 provider,于是桌宠设置页的语音音色下拉里会多出一组:
- 自建音色 → 我的音色(id
clone/custom)
选中它,桌宠说话(打卡问候、碎碎念、待办提醒)就改用复刻出来的音色合成。声音本身来自云端的声音复刻服务,插件只负责「把文本变成音频字节」这一件事——什么时候播、播什么,仍然由桌宠决定。
你需要准备什么
| 需要 | 说明 |
|---|---|
| DSH | 插件运行的宿主 |
| dsh-pet | 桌宠本体。没有它,本插件会静默等待,什么也不做 |
| 硅基流动账号 + API Key | 声音复刻与合成都在它上面跑,注册地址(手机号即可,有免费额度) |
| 一段参考录音 | 你自己说话,单人、无背景音乐、10 秒左右(硬上限 30 秒) |
安装
和所有 DSH 插件一样,两步:放到磁盘 → 告诉 DSH 装它。
git clone https://github.com/RonaWhite/dsh-pet-voice-clone.git E:\DSH\plugins\dsh-pet-voice-clone
没有 git 就下 ZIP 解压。确认目录里直接能看到 package.json(不要多套一层)。
然后在 DSH 的插件管理里安装这个目录,或直接对助手说「把 E:\DSH\plugins\dsh-pet-voice-clone 装成插件」。热加载,不用重启。
装好后插件列表里出现 「桌宠声音复刻」。
配置
第 1 步:拿到 API Key
在硅基流动控制台创建一个 API Key(形如 sk-...)。
第 2 步:准备参考录音
- 一个人说话,不要有第二个人声、不要有音乐
- 10 秒左右最稳(超过 30 秒会失败)
- wav / mp3 都行,采样率不必特殊
手边只有长音频的话,用 ffmpeg 裁一段:
ffmpeg -i 原文件.m4a -t 10 -ac 1 -ar 24000 -b:a 64k 参考音频.mp3
第 3 步:填设置文件
插件首次启动会自动生成模板:
<DSH_HOME>/dsh-pet/voice-clone.json # Windows 默认 C:\Users\<你>\.dsh\dsh-pet\voice-clone.json
只需要改这几项:
{
"apiKey": "sk-你的key", // 也可以留空,改用环境变量 SILICONFLOW_API_KEY
"referenceAudio": "D:\\voice\\我的声音.mp3", // 绝对路径
"referenceText": "" // 留空 = 自动转写录音内容
}
改完不用重启,插件每次合成都会重新读这个文件。
其余字段(customName、voiceUri、model、baseUrl)见 docs/DETAIL.md。
第 4 步:启用
桌宠设置 → 语音 → 打开语音播报 → 音色选 「我的音色」 → 随便让它说一句话。
第一次合成会比较慢(要先上传录音做一次声音复刻),之后音色 uri 会被缓存,就不再重复上传了。
它会做什么、不会做什么
| 会 | 不会 |
|---|---|
| 把你给的参考录音上传到硅基流动做一次声音复刻 | 把录音存到别的地方 |
| 用复刻出的音色合成桌宠要说的每一句话 | 改变桌宠说什么、什么时候说 |
| 把复刻结果(音色 uri)缓存在本地 | 把 API Key 写到仓库或日志里 |
关于隐私,请认真看这一条:参考录音是声纹,属于生物特征。它会上传到硅基流动才能完成复刻。不要用别人的声音,除非你已经获得对方明确的同意;也不要随便把录音文件提交到公开仓库(本仓库的 .gitignore 已经拦住了音频文件,但请你自己也留意)。
费用
- 声音复刻上传(
/v1/uploads/audio/voice)和自动转写(SenseVoiceSmall)不收费。 - 真正发声(
/v1/audio/speech)按量计费,CosyVoice2 不在免费额度范围内。价格约 ¥105 / 百万 UTF-8 字节,一个汉字 3 字节,算下来大约 ¥0.0003/字。桌宠说的都是短句,充 10 元能用很久。
常见问题
复刻成功了,但没声音 / 日志里是 402
八成是余额不足。硅基流动在余额为零时对 /v1/audio/speech 一律返回:
402 {"code":30001,"message":"Sorry, your account balance is insufficient"}
充一点钱就好。注意「复刻成功」不代表「合成能用」——前者免费,后者收费。
桌宠设置里没有「我的音色」这一项 按顺序查:dsh-pet 装了没 → 本插件是启用状态吗 → 桌宠设置页刷新了吗。插件是软依赖,dsh-pet 晚加载时它会每 3 秒重试一次注册;如果 3 分钟还没注册上,日志里会有一条 warn。
报「未配置 API key」
apiKey 是空的,环境变量 SILICONFLOW_API_KEY 也没设。
报参考音频相关错误 大概率是路径写错(要用绝对路径)或音频超过 30 秒。
能复刻多个音色吗
目前是单音色槽(固定 id clone/custom)。换一段录音时建议同时改 customName,否则可能命中旧的复刻结果。
兼容性
- 依赖 dsh-pet 的
petApi7340.voice注册表——这是它的内部接口(dsh-pet 暂未提供公开的插件 SDK)。dsh-pet 改版可能失效。 - 依赖硅基流动的两个接口:
POST /v1/uploads/audio/voice(复刻)、POST /v1/audio/speech(合成)。baseUrl可配置,指向兼容代理也行。 - 开发时对
dsh-pet@0.4.9验证。
开发
node --test test/mock.test.mjs # 起一个假硅基流动,不需要真 key
node --check index.js
License
MIT
Links
More in this category
Yuuyuko-uu/dsh-tts-bridge★ 269
Reads DSH conversations aloud using the DeepSeek web page's built-in read-aloud, driven by a small browser extension.
Fishsb/dsh-voice-prompt-enhancer★ 136
Rewrites a composer draft into a clearer, structured prompt (5 modes, model fallback chain, optional multi-round memory) and adds stop-on-silence, hotkey and filler-word cleanup to DSH voice input; transcription stays with the official speechToText, the plugin ships no engine.
PolinniZhong/dsh-omi-voice★ 75
In-chat read-aloud for DeepSeek Harness: tap to read, pause and resume AI replies with natural Doubao TTS voices (BYOK), reading only the final answer with code, tables and diagrams filtered; local engine, plugin keeps no API key.
ppy-web/dsh-plugin-xiaomi-mimo-tts★ 70
Voice Studio for DSH with 10+ cloud and local speech engines (Xiaomi MiMo, Doubao, Breeze, DeepSeek, local MOSS-Nano, browser speech, external adapters) plus cloud ASR, smart text filtering, live subtitles and voice orbs, /director multi-role WAV drama studio, and desktop pet, novel, QQ Bot, dsh-Go, and AI Passport integrations. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
cloudoyx/any-audio★ 68
DSH has its own audio workstation too: real recordings, multiple TTS engines, genuine sound effects and local singing synthesis, with every generated sound landing as its own clip on one visible timeline that you can audition, balance and fine-tune track by track. Use it for scoring animation, producing audiobooks and radio drama, composing and mixing on your own, making ASMR, and whatever else you come up with.
1624318455/dsh-plugin-tts★ 65
Reads assistant replies aloud via free Edge TTS or your own RVC voice models: read-aloud buttons + auto-read, adaptive chunked progressive playback (gapless long reads), one-click voice-pack installs from a registry, and a portable RVC runtime.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.