# Generic TTS (/en/ai/models/tts/generic-http)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

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](/en/ai/build/custom-model-integration/custom-tts).

<CalloutContainer type="info">
  <CalloutTitle>
    Info
  </CalloutTitle>

  <CalloutDescription>
    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.
  </CalloutDescription>
</CalloutContainer>

### 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)

  ```json
  "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`**

  ```json
  "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`.

<CalloutContainer type="warning">
  <CalloutTitle>
    Caution
  </CalloutTitle>

  <CalloutDescription>
    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.
  </CalloutDescription>
</CalloutContainer>

### Key parameters

<ParameterList title="tts" required="true">
  <Parameter name="url" type="string" required="true">
    The OpenAI TTS protocol compatible service endpoint.
  </Parameter>

  <Parameter name="headers" type="object" required="false">
    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`.
  </Parameter>

  <Parameter name="params" type="object" required="true">
    <Parameter name="api_key" type="string" required="false">
      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`.
    </Parameter>

    <Parameter name="model" type="string" required="false">
      The name of the TTS model.
    </Parameter>

    <Parameter name="voice" type="string" required="false">
      The voice name. Omit this parameter if your TTS service does not support multiple voices.
    </Parameter>

    <Parameter name="speed" type="number" required="false">
      The speech rate.
    </Parameter>

    <Parameter name="sample_rate" type="integer" defaultValue="16000" required="false">
      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.
    </Parameter>

    <Parameter name="response_format" type="string" defaultValue="pcm" required="false">
      The output audio format. Currently only `pcm` is supported.
    </Parameter>

    <Parameter name="instruction" type="string" required="false">
      Instructions for voice style, emotion, or other playback directives.
    </Parameter>

    <Parameter name="enable_request_id" type="boolean" defaultValue="false" required="false">
      Whether to include `request_id`, `request_seq_id`, and `request_end` in the TTS request body.
    </Parameter>
  </Parameter>
</ParameterList>
