Generic TTS

Updated

Integrate a custom TTS service using the OpenAI TTS protocol into Conversational AI Engine.

The generic_http TTS vendor lets you integrate a custom TTS service that implements the OpenAI TTS protocol into the Conversational AI Engine. For a walkthrough of preparing and verifying a compatible TTS service, see Connect your own TTS service.

Info

This integration is fully supported for use with Conversational AI Engine. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.

Sample configuration

Use the following tts configuration when starting a conversational AI agent using the REST API. generic_http requires tts.url, and at least one of tts.headers.Authorization or tts.params.api_key for authentication.

  • Authenticate using headers (recommended)

    "tts": {
      "vendor": "generic_http",
      "url": "https://your-tts-service.example.com/v1/audio/speech",
      "headers": {
        "Authorization": "Bearer your_tts_api_key"
      },
      "params": {
        "model": "gpt-4o-mini-tts",
        "voice": "alloy",
        "speed": 1.0,
        "sample_rate": 16000,
        "response_format": "pcm",
        "instruction": "calm",
        "enable_request_id": false
      }
    }
  • Authenticate using params.api_key

    "tts": {
      "vendor": "generic_http",
      "url": "https://your-tts-service.example.com/v1/audio/speech",
      "params": {
        "api_key": "your_tts_api_key",
        "model": "gpt-4o-mini-tts",
        "voice": "alloy",
        "speed": 1.0,
        "sample_rate": 16000,
        "response_format": "pcm",
        "instruction": "calm",
        "enable_request_id": false
      }
    }

    If you provide both tts.headers.Authorization and tts.params.api_key, the Conversational AI Engine uses tts.headers.Authorization.

Caution

Your TTS service must implement the OpenAI TTS protocol. The parameters listed on this page are validated for use with Conversational AI Engine. Any additional fields in params are passed through directly to your TTS service without validation.

Key parameters

ttsrequired
urlstring
required

The OpenAI TTS protocol compatible service endpoint.

headersobject
optional

Custom request headers to include in requests to the TTS service, such as authentication credentials. Provide at least one of headers.Authorization or params.api_key. If you provide both, the Conversational AI Engine uses headers.Authorization.

paramsobject
required
api_keystring
optional

The API key used to authenticate with the TTS service. Provide at least one of headers.Authorization or params.api_key. If you provide both, the Conversational AI Engine uses headers.Authorization.

modelstring
optional

The name of the TTS model.

voicestring
optional

The voice name. Omit this parameter if your TTS service does not support multiple voices.

speednumber
optional

The speech rate.

sample_rateinteger
optional
Default value
16000

The sample rate, in Hz, of the output audio. If your TTS service does not support multiple sample rates, make sure the sample rate of the returned audio matches this value.

response_formatstring
optional
Default value
pcm

The output audio format. Currently only pcm is supported.

instructionstring
optional

Instructions for voice style, emotion, or other playback directives.

enable_request_idboolean
optional
Default value
false

Whether to include request_id, request_seq_id, and request_end in the TTS request body.