360 Secure SkillHub
360 安全技能中心

liber-speechapi

基于自建 Liber SpeechAPI 后端的 Python 客户端,提供服务健康、模型和参数查询,批量 ASR 与 SRT/VTT 字幕导出,细粒度 TTS 参数和 VC 音色转换;日常聊天听写与朗读由 OpenClaw 语音插件负责,本 Skill 侧重诊断、批量处理和换音。

分类:效率
liberalchang
liberalchang
热度 29.25
最近更新 2026-12-01 03:29:01

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add liberalchang/liber-speechapi
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
liber-speechapi
description
Advanced Liber SpeechAPI toolkit for health/models/help diagnostics, batch ASR with SRT/VTT, fine-grained TTS parameters, and VC voice conversion. Prefer /api/v2 JSON with /api/v1 fallback. Daily chat dictation/TTS belongs to the OpenClaw liber-speech provider plugin, not this skill.
allowed-tools
Bash(python scripts/liber_speech_client.py:*), Read, Write
permissions
{"env":["LIBER_API_BASE_URL","LIBER_API_KEY","LIBER_API_VERSION"],"file_read":["speechapi_config.json","user-audio"],"file_write":["results","user-output-path"],"network":["configured-speech-origin"]}

Liber SpeechAPI

后端与安装(必读)

本 Skill 只是客户端。没有正在运行的 Liber Speech 语音服务时,health / tts / asr / vc 都无法工作。

来源 地址
后端仓库 https://github.com/liberalchang/Liber_SpeechAPI
本仓库镜像 https://github.com/liberalchang/liber_openclaw 的 Liber_SpeechAPI/ 子模块(与上面同一套代码)

在有 Docker 的机器上安装并启动后端(默认 http://127.0.0.1:5555):

git clone https://github.com/liberalchang/Liber_SpeechAPI.git
cd Liber_SpeechAPI
cp .env.example .env
docker compose build
docker compose up -d

已经克隆本仓库时,进入 Liber_SpeechAPI/ 后执行同样的 cp .env.example .env、docker compose build、docker compose up -d。服务端 LIBER_SPEECH_API_KEY 留空则免鉴权;设置了密钥时,客户端 LIBER_API_KEY 必须与它相同。权重不随仓库分发,首次合成由服务下载。环境变量、离线权重和接口细节见后端 README。

安装本 Skill 客户端:Python 3.10+,在本 Skill 目录执行 pip install -r requirements.txt(锁定 requests==2.34.2)。然后按下方 Configuration 设置 LIBER_API_BASE_URL。

与 OpenClaw 语音插件的分工(必读)

场景 走哪条通道
聊天框听写、上传语音自动转写、/tts / 明确朗读、频道自动语音条、Talk 连续对话 OpenClaw 语音提供商插件(liber-speech,Task 3)——日常主通道
服务诊断(health/models/help)、批量字幕(srt/vtt)、词级时间戳 / VAD / 热词调优、精细语速响度、VC 换音、非插件环境兜底脚本 本 Skill(liber-speechapi)——高级 / 运维 / 批量工具

已安装语音插件时,不要用本 Skill 劫持日常对话朗读或听写。

本 Skill 负责

  1. 服务端诊断与自发现:health、models、help(11 个 TTS 包、3 个 ASR、2 个 VC)
  2. 高级 / 批量命令行:批量转写、导出字幕、词级时间戳、VAD/热词/prompt、speed/exaggeration/cfg_weight/normalize_loudness
  3. 音色替换(VC:chatterbox / seed-vc)——插件明确不做 VC
  4. 独立于 OpenClaw 网关或非插件环境的兜底脚本(含旧 Telegram 脚本兼容)

Follow this workflow

  1. Read references/config.md to resolve .env and speechapi_config.json.
  2. Read references/workflow.md for advanced / VC workflows(日常听写朗读见语音插件)。
  3. Read references/api.md for v2/v1 endpoint details.
  4. Read references/parameters.md for TTS/ASR/VC parameter meanings and defaults.
  5. Use scripts/liber_speech_client.py for deterministic calls instead of rewriting HTTP logic.
  6. Use /api/v2/help when you need the authoritative parameter list for a model.

API version

  • New deployments support /api/v2: file upload → JSON request.
  • Old deployments only support /api/v1: multipart request.
  • The client defaults to auto: probe /api/v2/help, then fall back to /api/v1.
  • Force a version with --api-version v1|v2 or LIBER_API_VERSION.
  • v2-only parameters on a v1 server fail with a clear error instead of being silently ignored.

Configuration

.env:

  • LIBER_API_BASE_URL: http://host:5555, .../api/v1, or .../api/v2
  • LIBER_API_KEY: same value as the server's LIBER_SPEECH_API_KEY(服务端留空时本客户端也可不传密钥)
  • LIBER_API_VERSION: optional auto / v1 / v2

加载优先级:CLI > 进程环境变量 > ~/.openclaw/.env > 本 Skill 目录 .env。不读取当前工作目录的 .env。从 .env 文件只复制上面三个 LIBER_API_* 键,其它键留在文件里,不进入进程环境。

speechapi_config.json:

  • asr、tts、vc、global sections
  • options object inside each section for model-specific parameters
  • values "default" or null are omitted from requests
  • language 默认是 default(不传)。不锁定中文或任何其它语言。用户用 --language(如 zh、en、ja)或在配置里写 language 自行选择;省略时由服务端自动检测或使用服务端默认。下文命令里的 --language zh 只是示例。
  • 旧版配置(无 vc/options、含 insanely-fast-whisper 废弃字段)可加载:值为 default 的废弃字段静默丢弃,非 default 会告警或温和规范化。告警不回显 hf_token 等密钥字段的原值。

Never print or log API keys or legacy hf_token values.

Health, models, and help

python scripts/liber_speech_client.py health
python scripts/liber_speech_client.py models
python scripts/liber_speech_client.py help
python scripts/liber_speech_client.py help tts multilingual_v3
python scripts/liber_speech_client.py help asr large-v3 --include model
python scripts/liber_speech_client.py help vc seed-vc --format markdown

models uses v2 /api/v2/models when available and falls back to /api/v1/models.

Direct text-to-speech

python scripts/liber_speech_client.py tts "你好世界" --language zh --format wav
python scripts/liber_speech_client.py tts "你好世界" --speed 0.9 --exaggeration 0.7 --cfg-weight 0.3
python scripts/liber_speech_client.py tts "你好世界" --params '{"temperature":0.8,"top_p":0.9}'
python scripts/liber_speech_client.py tts "你好世界" --format ogg_opus
  • Default output: wav;Telegram 兼容语音条用 ogg_opus(本地保存后缀 .ogg)。
  • v2 supports speed, exaggeration, cfg_weight, temperature, repetition_penalty, min_p, top_p, top_k, norm_loudness, normalize_loudness, target_lufs, ref_start, ref_duration.
  • Model differences:
    • multilingual / standard / language packs: exaggeration, cfg_weight, speed
    • turbo / nano: speed, temperature, top_p, top_k; no exaggeration/cfg_weight
    • v1 servers: only model, language, format, and reference audio
  • Reference audio is uploaded as prompt_file_id on v2 and as form field prompt on v1(不是旧的 audio_prompt)。

Direct speech-to-text

python scripts/liber_speech_client.py asr audio.wav --language zh
python scripts/liber_speech_client.py asr audio.wav --timestamps word
python scripts/liber_speech_client.py asr audio.wav --vad-filter --initial-prompt "术语"
python scripts/liber_speech_client.py asr audio.wav --output srt
  • Default output: structured JSON; text, srt, vtt are available.
  • Backend: faster-whisper(large-v3 / large-v3-turbo)与 qwen3-asr-1.7b(不再使用 insanely-fast-whisper)。
  • v2 supports timestamps=none|segment|word, VAD, initial_prompt, hotwords, beam_size, condition_on_previous_text.
  • Qwen3-ASR supports timestamps, max_new_tokens, and max_inference_batch_size; it does not support VAD, beam, hotwords, initial_prompt, or task=translate.
  • Batch transcription writes results next to each input; --output is only valid for a single input.

Voice conversion

python scripts/liber_speech_client.py vc source.wav --prompt ref.wav --model seed-vc --convert-all
python scripts/liber_speech_client.py vc source.wav --prompt ref.wav --segments '[{"start":0,"end":3.2}]'
python scripts/liber_speech_client.py vc source.wav --prompt ref.wav --seed 42 --diffusion-steps 20
  • VC requires v2;语音插件不做 VC,换音请用本 Skill。
  • Seed-VC supports seed, diffusion_steps, inference_cfg_rate, n_quantizers, temperature, max_window, context, fade, ref_max_len, length_adjust, overlap_frame_len.
  • Chatterbox VC has no model-level sampling parameters; reference audio uses the first 10 seconds.

Safety and robustness

  • Never print or log API keys. 旧配置里的 hf_token 只报告字段名,告警写成 <redacted>。
  • 权限范围:只读 LIBER_API_BASE_URL、LIBER_API_KEY、LIBER_API_VERSION;网络只访问配置的语音服务 origin;音频写到 results/ 或用户给出的输出路径,拒绝写到 .env、.ssh、.aws 等凭据位置。
  • 下载绝对 audio_url 时校验同源:跨源默认拒绝,避免把 Authorization 发到非同源主机。
  • 上传得到的临时文件由服务端按 expires_at 过期清理。客户端自动上传 TTS 参考音频、ASR 输入和 VC 源/参考音频,不要求代理去删除这些文件。
  • Validate input files and non-empty text before calls.
  • Use timeouts; default 120s, synthesis/transcription/VC 600s.
  • Retry only connection errors, timeouts, and HTTP 5xx; do not retry 4xx.
  • Exit codes: 0 success, 2 config/input, 3 network/service unreachable, 4 API error.
  • If clone audio is configured but missing, continue without cloning.
  • Use /api/v2/help rather than hardcoding parameter ranges or model capabilities.