Skip to main content

ZAI/GLM TTS to OpenAI Speech API

Project description

🗣️ ZAI/GLM TTS

Install / 安装

🐳 Docker compose

mkdir /opt/zai-tts2api
cd /opt/zai-tts2api
echo "ZAI_USERID=xxxx-yyyy" > .env
echo "ZAI_TOKEN=eyJhbGc..." >> .env
wget https://raw.githubusercontent.com/aahl/zai-tts2api/refs/heads/main/docker-compose.yml
docker compose up -d

ZAI_USERIDZAI_TOKEN可在audio.z.ai登录后,通过F12开发者工具在控制台执行localStorage['auth-storage']获取

🐳 Docker run

docker run -d \
  --name zai-tts2api \
  --restart=unless-stopped \
  -p 8823:80 \
  -e ZAI_USERID=xxxx-yyyy \
  -e ZAI_TOKEN=eyJhbGc... \
  ghcr.io/aahl/zai-tts2api:main

🏠 Home Assistant OS Add-on

  1. 添加加载项仓库

    • 打开 HomeAssistant,点击左侧菜单的 配置 (Settings) -> 加载项 (Add-ons)
    • 点击右下角的 加载项商店 (Add-on Store)
    • 点击右上角的三个点 -> 仓库 (Repositories)
    • 在输入框填入:https://gitee.com/hasscc/addons, 点击添加 添加加载项仓库
  2. 安装加载项

    • 刷新页面,找到并点击 智谱TTS
    • 点击 安装 (Install)
    • 切换到 配置 标签页,添加ZAI_USERIDZAI_TOKEN环境变量
    • 启动并设置开机启动

💻 Usage / 使用

🎼 内置音色

  • system_001: 活泼女声
  • system_002: 温柔女声
  • system_003: 通用男声

如果想要使用克隆的音色,请在audio.z.ai完成音色克隆,并通过接口http://localhost:8823/v1/models获取

🌐 CURL调用示例

curl --request POST \
  --url http://localhost:8823/v1/audio/speech \
  --header 'Content-Type: application/json' \
  --data '{"voice":"system_001", "input":"hello", "speed":1.0, "volume":1}' \
  --output output.wav

🏠 Home Assistant

  1. 安装 AI Conversation 集成

    点击这里 一键安装,安装完记得重启HA

  2. 添加 AI Conversation 服务,配置模型提供商

    服务商: 自定义; 接口: http://4e0de88e-zai-tts/v1; 密钥留空

  3. 添加TTS模型,模型ID随意
  4. 配置语音助手

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zai_tts-0.1.0b1.tar.gz (70.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zai_tts-0.1.0b1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file zai_tts-0.1.0b1.tar.gz.

File metadata

  • Download URL: zai_tts-0.1.0b1.tar.gz
  • Upload date:
  • Size: 70.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zai_tts-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 cb86da069dbab50e81001c672ca31147bb9db60119e651dfc733894a5622eec0
MD5 0df7e480e3c57d1901a4434544e96f1b
BLAKE2b-256 f3cb7e0efacc499a39ee1250a823cbf2548845b63163e4ad78e0b9dfde9c2cd4

See more details on using hashes here.

File details

Details for the file zai_tts-0.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: zai_tts-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zai_tts-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4f514c3ed512da6904fcec1c7ae96ce17bed708f1fa5273a58be9de60ceec4f
MD5 e556e86ab81ecdd03cd18ff03690177f
BLAKE2b-256 21bee2658dc7a382986797b9b3bee38e9421fc3ccf9237f948943c21e0f5d456

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page