Skip to content

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

    Environment variables

    The canonical list of runtime environment variables. Names are case-insensitive and carry no prefix. Defaults reflect the server configuration (api/src/core/config.py) and the container startup scripts.

    VariableDefaultPurpose
    HOST0.0.0.0Bind address.
    PORT8880Bind port.
    API_LOG_LEVELINFOApplication (loguru) log level: TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL.
    UVICORN_LOG_LEVELinfoUvicorn server log level.
    UVICORN_ROOT_PATH(unset)Root path prefix when served behind a reverse proxy; surfaced to the web console via /web/config.
    VariableDefaultPurpose
    API_KEY(unset)When set, /v1, /dev, and /debug require Authorization: Bearer <key>. Unset leaves the API open. /health, /ready, /system, and /web always stay open.
    VariableDefaultPurpose
    TLS_ENABLEDfalseServe HTTPS directly via uvicorn.
    TLS_SELF_SIGNEDtrueGenerate a self-signed certificate on first run if none is supplied.
    TLS_CNlocalhostCommon name (and a SAN) of the generated certificate.
    TLS_SAN(unset)Extra SANs, comma-separated (e.g. host.local,10.0.0.5).
    TLS_CERT_FILE{OUTPUT_DIR}/tls/cert.pemPath to an existing certificate to use instead of self-signing.
    TLS_KEY_FILE{OUTPUT_DIR}/tls/key.pemPath to an existing private key.

    See Security hardening for the full TLS behavior.

    VariableDefaultPurpose
    USE_GPUtrueUse CUDA/MPS if available; false forces CPU inference.
    DEVICE_TYPE(auto)Force cuda, mps, or cpu; auto-detected when unset.
    WARMUP_ON_STARTtrueEagerly load and warm the model in a background task at startup; false defers loading to the first request.
    DEFAULT_VOICEaf_heartVoice used for warmup and when a request omits one.
    DEFAULT_VOICE_CODE(unset)Overrides the language code otherwise derived from the voice name (a request lang_code still wins).
    VariableDefaultPurpose
    OUTPUT_DIRoutputWhere generated audio and the self-signed TLS certificate are written. Mount a volume here (e.g. OUTPUT_DIR=/data) to persist both.
    VariableDefaultPurpose
    ENABLE_WEB_PLAYERtrueServe the web console at /web.
    CORS_ENABLEDtrueEnable CORS middleware.
    CORS_ORIGINS["*"]Allowed origins, JSON array.
    VariableDefaultPurpose
    TARGET_MIN_TOKENS175Target minimum tokens per synthesis chunk.
    TARGET_MAX_TOKENS250Target maximum tokens per chunk.
    ABSOLUTE_MAX_TOKENS450Hard cap on tokens per chunk.

    Published images already bake in the weights; these apply when building an image or when DOWNLOAD_MODEL=true.

    VariableDefaultPurpose
    DOWNLOAD_MODEL(unset)true downloads weights at container start (otherwise the baked-in weights are used).
    MODEL_DOWNLOAD_BASE_URLHugging Face hexgrad/Kokoro-82MWhere weights are fetched from.
    MODEL_SHA256pinned for the default URLSHA-256 checksum verification. Required if you set a custom base URL.
    MODEL_DOWNLOAD_TIMEOUT120Per-attempt download timeout (seconds).
    MODEL_DOWNLOAD_RETRIES4Download attempts with exponential backoff.

    The server exposes further advanced settings (audio sample rate, volume multiplier, normalization toggles, gap-trim padding, temp-file limits, combined-voice saving, and container model/voice paths) with sensible defaults. These rarely need changing; the authoritative source is api/src/core/config.py. Notable ones:

    VariableDefaultPurpose
    ALLOW_LOCAL_VOICE_SAVINGfalseAllow POST /v1/audio/voices/combine to persist a combined voicepack (returns 403 when disabled).
    VOICE_WEIGHT_NORMALIZATIONtrueNormalize combined-voice weights to sum to 1.
    DEFAULT_VOLUME_MULTIPLIER1.0Global output volume multiplier.