PieBox
Documentation

Text-to-Speech (TTS)

Speech synthesis with Gemini TTS and ElevenLabs TTS

Gemini TTS (Multilingual)

Best results in English. Supports 24 common languages. Returns raw PCM audio data.

Request:

POST /v2/extend/tts/gemini/synthesize

Parameters:

ParameterTypeRequiredDescription
textstringYesText to synthesize (≤ 10,000 characters)
voice_namestringNoVoice name (e.g. Kore, Puck, Charon)
promptstringNoVoice style hint (e.g. "speak slowly and clearly")
language_codestringNoLanguage code (e.g. en-US, zh-CN)
temperaturenumberNoControls randomness

Example:

curl https://tokenhub.piegateway.me/v2/extend/tts/gemini/synthesize \
  -H "X-API-Key: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello, this is a test.", "voice_name": "Kore"}' \
  -o output.pcm

Response: Raw PCM audio stream (LINEAR16, 24kHz, mono).

Convert to a playable format with ffmpeg:

ffmpeg -f s16le -ar 24000 -ac 1 -i output.pcm output.mp3

ElevenLabs TTS (High Quality)

Industry-leading audio quality. Supports 70+ languages.

Request:

POST /v2/extend/tts/elevenlabs/synthesize

Parameters:

ParameterTypeRequiredDescription
textstringYesText to synthesize (≤ 10,000 characters)
voice_idstringYesVoice ID
language_codestringNoLanguage code
output_formatstringNoOutput format

Example:

curl https://tokenhub.piegateway.me/v2/extend/tts/elevenlabs/synthesize \
  -H "X-API-Key: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello world", "voice_id": "21m00Tcm4TlvDq8ikWAM"}' \
  -o output.mp3