Reference

API

Local OpenAI-compatible server at http://localhost:11435. No API key required. Binary audio responses; progressive download when stream: true.

Generate speech from text. Response is binary audio (audio/mpeg, audio/pcm, …).

Body

  • modelstring

    Required. e.g. chatterbox-turbo

  • inputstring

    Required. Text to synthesize (max 4096)

  • voicestring

    Optional. Saved voice, named speaker (Qwen Ryan, Kokoro af_heart, …), path, or default

  • languagestring

    Optional. Chatterbox Multilingual ISO (fr, zh, …), Qwen language name, or Kokoro ISO / voice prefix

  • response_formatstring

    Optional. Default mp3. Also wav, opus, flac, aac, pcm, pcm_16000, pcm_22050, pcm_24000, pcm_44100

  • speedfloat

    Optional 0.25–4.0 (currently ignored)

  • streambool

    Optional. Default false. Progressive download; only mp3 and pcm / pcm_*

Streamingstream: true returns chunked bytes. Allowed: mp3, pcm, pcm_*. Rejected with 400: wav, opus, aac, flac. For pcm, Content-Type is audio/pcm at the model's native sample rate.

Errors: 400 bad params / unsupported stream format · 404 model not found · 500 generation failed.

Example

curl http://localhost:11435/v1/audio/speech \
  -H "Content-Type: application/json" \
  -d '{
    "model": "chatterbox-turbo",
    "input": "Hello from Wavhost!",
    "voice": "my-voice",
    "response_format": "mp3"
  }' \
  --output speech.mp3

Streaming

curl http://127.0.0.1:11435/v1/audio/speech \
  -H "Content-Type: application/json" \
  -d '{
    "model": "chatterbox-nano",
    "input": "Hello",
    "voice": "default",
    "stream": true,
    "response_format": "pcm"
  }' \
  --output out.pcm

Example

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:11435/v1",
    api_key="not-needed",
)

speech = client.audio.speech.create(
    model="chatterbox-turbo",
    voice="my-voice",
    input="Hello from Wavhost!",
)
speech.write_to_file("hello.mp3")