TTS

Convert text into speech audio files using the z-ai-web-dev-sdk TTS API.

Updated Jul 11, 2026
One-click install
npx skills add https://github.com/mukaddam-ali/Anadolu-Kitchen --skill tts-mukaddam-ali
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: TTS
Source: https://github.com/mukaddam-ali/Anadolu-Kitchen/tree/main/skills/TTS
Command: npx skills add https://github.com/mukaddam-ali/Anadolu-Kitchen --skill tts-mukaddam-ali

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires z-ai-web-dev-sdk, and includes scripts (resource) components.

What problem does it solve? It removes the need to manually record or source voice audio by programmatically converting text into natural-sounding speech files for applications, content, and accessibility features. ## Core Features & Use Cases - Text-to-Speech Generation: Convert text up to 1024 characters into WAV, MP3, or PCM audio with seven selectable voices, adjustable speed (0.5-2.0), and volume control. - CLI and SDK Modes: Use the z-ai CLI for quick one-off conversions or the z-ai-web-dev-sdk in backend code for dynamic, production integrations such as Next.js API routes. - Use Case: Build an e-learning app where lesson text is sent to a Next.js API route that returns generated narration audio, with long lessons automatically split into chunks under the 1024-character limit. ## Quick Start Ask the AI to convert the text "Hello, world" into a WAV audio file using the TTS skill and save it as output.wav.

Frequently Asked Questions about TTS

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert text to speech in a Next.js app?

Create a Next.js API route that imports z-ai-web-dev-sdk, calls zai.audio.tts.create with your text, voice, and speed, then returns the audio buffer with an audio/wav content type. The SDK must only run in server-side code, never client-side.

What voices and audio formats does z-ai TTS support?

Seven voices are available: tongtong, chuichui, xiaochen, jam, kazi, douji, and luodo. Non-streaming output supports WAV, MP3, and PCM formats at a 24000 Hz sample rate, while streaming mode only supports PCM.

What is the maximum text length for TTS API requests?

Each request accepts a maximum of 1024 characters. Longer text must be split into chunks, ideally at sentence boundaries, and processed as separate requests whose audio outputs can be concatenated.

Why is my generated TTS audio file empty or corrupted?

The SDK returns a standard Response object, so you must call await response.arrayBuffer() and convert it with Buffer.from(new Uint8Array(arrayBuffer)) before writing to disk. Accessing a response.audio property directly returns undefined.

When should I use the z-ai CLI versus the SDK for TTS?

Use the CLI (z-ai tts -i text -o file.wav) for quick conversions, voice testing, and simple automation scripts. Use the SDK for dynamic audio generation inside web services, custom processing pipelines, and production applications.