Skip to content

    Development documentation — this describes the current development branch. Documented behavior may not exist in the latest release.

    OpenAI-compatible API

    Everything under /v1 follows OpenAI conventions. When API_KEY is set, these routes require Authorization: Bearer <key>. The full interactive schema is at /docs.

    Synthesize speech from text.

    FieldTypeDefaultNotes
    modelstringkokoroOne of tts-1, tts-1-hd, kokoro, gpt-4o-mini-tts. Unknown → 400.
    inputstring(required)Text to synthesize.
    voicestringaf_heartA voice name or a weighted combination (see Voices).
    response_formatstringmp3mp3, opus, flac, wav, pcm. (aac is accepted by the schema but not currently supported.)
    download_formatstringnullOptional alternate format for a download link.
    speednumber1.0Range 0.254.0.
    streambooleantrueStream chunks as encoded, or return one complete body.
    return_download_linkbooleanfalseAlso write a file and return its path in X-Download-Path.
    lang_codestringnullOverride the pipeline language; otherwise derived from the voice name.
    volume_multipliernumber1.0Output volume multiplier.
    normalization_optionsobject(defaults)Text-normalization toggles; set {"normalize": false} to disable.
    Terminal window
    curl -X POST http://localhost:8880/v1/audio/speech \
    -H 'Content-Type: application/json' \
    -d '{"model":"kokoro","input":"Hello world!","voice":"af_heart","response_format":"mp3"}' \
    -o hello.mp3

    Streaming responses use chunked transfer encoding with X-Accel-Buffering: no. See Streaming and audio formats.

    StatusWhen
    400Unknown model, unknown/malformed voice, or invalid input.
    401Missing/invalid bearer token (when API_KEY is set).
    503Model warming (model_warming, Retry-After: 10) or failed (model_failed).
    500Unexpected processing error.

    List available voices.

    Terminal window
    curl http://localhost:8880/v1/audio/voices
    # {"voices":[{"id":"af_heart","name":"af_heart"}, ...]}

    Pass ?legacy=true to get a flat array of voice-name strings instead.

    Persist a weighted voice combination as a reusable .pt voicepack. Disabled by default — returns 403 unless ALLOW_LOCAL_VOICE_SAVING=true.

    Terminal window
    curl -X POST http://localhost:8880/v1/audio/voices/combine \
    -H 'Content-Type: application/json' \
    -d '"af_bella(2)+af_sky(1)"' -o combined.pt

    List the model catalog, or fetch one entry. Unknown model IDs return 404.

    Terminal window
    curl http://localhost:8880/v1/models
    # {"object":"list","data":[{"id":"kokoro","object":"model","owned_by":"kokoro"}, ...]}

    Download a file previously produced with return_download_link (served from the temp directory; path-traversal-guarded). Missing files return 404.

    from openai import OpenAI
    client = OpenAI(base_url="http://localhost:8880/v1", api_key="not-needed")
    with client.audio.speech.with_streaming_response.create(
    model="kokoro", voice="af_bella", input="Hello world!",
    ) as response:
    response.stream_to_file("output.mp3")

    When authentication is enabled, pass the real key as api_key.