Error when creating a custom TTS integration
# support
l
Patching my assistant with the following voice configuration, according to the [docs](https://docs.vapi.ai/customization/custom-voices/custom-tts)
Copy code
{
  "voice": {
    "server": {
      "url": "https://WEBHOOK_URL",
      "secret": "SECRET",
      "headers": {
        "Content-Type": "application/json",
        "X-API-Version": "v1"
      },
      "timeoutSeconds": 45
    },
    "provider": "custom-voice",
    "fallbackPlan": {
      "voices": [
        {
          "model": "gpt-4o-mini-tts",
          "voiceId": "shimmer",
          "provider": "openai",
          "instructions": "Speak in calm and professional tone. "
        }
      ]
    }
  }
}
Cannot access the assistant in the dashboard:
Copy code
Error: TypeError
Message: Cannot read properties of undefined (reading 'models')
Tried also removing the
secret
field, and add a custom header instead, but without success.
v
It looks like your fallback plan includes a
model
field for the
openai
provider, but the [documentation](https://docs.vapi.ai/customization/custom-voices/custom-tts) only shows
provider
and
voiceId
in fallback examples.
This may be causing the dashboard error:
Copy code
TypeError: Cannot read properties of undefined (reading 'models')
Could you try removing the
"model": "gpt-4o-mini-tts"
line from your fallback plan and see if the error persists? Source: - [Custom TTS integration](https://docs.vapi.ai/customization/custom-voices/custom-tts)
l
Tried, still the same error. Btw, in the [API reference](https://docs.vapi.ai/api-reference/assistants/update) these fields are allowed in fallbackPlan -> voices
@Vapi Support Bot
v
Try using only
provider
and
voiceId
in your fallback plan, as shown below:
Copy code
json
"fallbackPlan": {
  "voices": [
    {
      "provider": "openai",
      "voiceId": "shimmer"
    }
  ]
}
Remove any
model
or
instructions
fields from the fallback voice.
If the error persists, it may be a dashboard bug or an unsupported configuration not covered in the documentation. See: [Custom TTS integration docs](https://docs.vapi.ai/customization/custom-voices/custom-tts) Source: - [Custom TTS integration](https://docs.vapi.ai/customization/custom-voices/custom-tts)
k
Add a "models" array under "voice" to prevent the TypeError and ensure Vapi can load the custom voice configuration..
l
Hey @Kings_big💫 , Thanks for responding. I get an error, it doesn't expect "models" under "voice". Payload:
Copy code
{
  "voice": {
    "models": [
      ".."
    ],
    "server": {
      "url": "https://WEBHOOK_URL",
      "secret": "SECRET",
      "headers": {
        "Content-Type": "application/json",
        "X-API-Version": "v1"
      },
      "timeoutSeconds": 45
    },
    "provider": "custom-voice",
    "fallbackPlan": {
      "voices": [
        {
          "voiceId": "shimmer",
          "provider": "openai"
        }
      ]
    }
  }
}
Response:
Copy code
{
  "message": [
    "voice.property models should not exist"
  ],
  "error": "Bad Request",
  "statusCode": 400
}
Do you mean something else?
@Vapi Support Bot
v
Use only
provider
and
voiceId
in your fallback plan, as shown below:
Copy code
json
"fallbackPlan": {
  "voices": [
    {
      "provider": "openai",
      "voiceId": "shimmer"
    }
  ]
}
Remove any
model
,
instructions
, or
models
fields from your configuration.
If the error persists after this change, it may be a dashboard bug not covered in the documentation. Source: [Custom TTS integration documentation](https://docs.vapi.ai/customization/custom-voices/custom-tts) Source: - [Custom TTS integration documentation](https://docs.vapi.ai/customization/custom-voices/custom-tts)
k
Ooh got it, use "voiceId" with "provider": "custom-voice" instead to specify your model.. https://docs.vapi.ai/customization/custom-voices/custom-tts
l
Can you write me a request payload for example please? @Vapi Support Bot
v
Here’s an example request payload for a custom TTS integration with a fallback plan, following the official documentation:
Copy code
json
{
  "voice": {
    "provider": "custom-voice",
    "server": {
      "url": "https://YOUR_TTS_WEBHOOK_URL",
      "secret": "YOUR_SECRET",
      "headers": {
        "Content-Type": "application/json",
        "X-API-Version": "v1"
      },
      "timeoutSeconds": 45
    },
    "fallbackPlan": {
      "voices": [
        {
          "provider": "openai",
          "voiceId": "shimmer"
        }
      ]
    }
  }
}
Only use
provider
and
voiceId
in the fallback voices.
Do not include
models
,
model
, or
instructions
fields. [See the official docs for reference.](https://docs.vapi.ai/customization/custom-voices/custom-tts) Source: - [Custom TTS integration documentation](https://docs.vapi.ai/customization/custom-voices/custom-tts)
l
Can you write me an example of this payload please?
k
Set "provider": "custom-voice" with your "voiceId" and provide a "server" object with your TTS endpoint, secret, and headers, plus an optional "fallbackPlan" for backup voices..
y
Did it work for you? How?
k
checking if this is resolved/solved for you?
v
Hey @lior_cychi, could you please try again with this CURL request.
Copy code
curl -X POST https://api.vapi.ai/assistant \
     -H "Authorization: Bearer " \
     -H "Content-Type: application/json" \
     -d '{
  "voice": {
    "provider": "custom-voice",
    "server": {
      "timeoutSeconds": 0,
      "url": "",
      "headers": {},
      "backoffPlan": {
        "maxRetries": 0,
        "baseDelaySeconds": 0
      }
    },
    "fallbackPlan": {
      "voices": [
        {
          "provider": "azure"
        }
      ]
    }
  }
}'