Skip to main content

Start AI Assistant (BETA)

POST 
/calls/:call_control_id/actions/ai_assistant_start

BETA - Start an AI assistant on the call.

Request

Path Parameters

    call_control_id stringrequired

    Unique identifier and token for controlling the call

Body

required

AI Assistant request

    assistant

    object

    AI Assistant configuration

    id string

    The identifier of the AI assistant to use

    openai_api_key_ref string

    Reference to the OpenAI API key. Required only when using OpenAI models

    AI Assistant configuration

    voice VoiceConfig (string)

    Default value: Telnyx.LibriTTS.0

    The voice to be used by the voice assistant. Currently we support ElevenLabs, Telnyx and AWS voices only, for ElevenLabs voices you can pass the voice as ElevenLabs.<model_id>.<voice_id>, for Telnyx voices you can pass the voice as Telnyx.<model_id>.<voice_id>, for AWS Polly voices you can pass the voice as AWS.Polly.<voice_id>

    voice_settings

    object

    The settings associated with the voice selected

    oneOf

    The settings associated with the voice selected

    greeting string

    Text that will be played when the assistant starts, if none then nothing will be played when the assistant starts. The greeting can be text for any voice or SSML for AWS.Polly.<voice_id> voices. There is a 3,000 character limit.

    interruption_settings

    object

    Settings for handling user interruptions during assistant speech

    enable boolean

    Default value: true

    When true, allows users to interrupt the assistant while speaking

    Settings for handling user interruptions during assistant speech

    transcription

    object

    The settings associated with speech to text for the voice assistant. This is only relevant if the assistant uses a text-to-text language model. Any assistant using a model with native audio support (e.g. fixie-ai/ultravox-v0_4) will ignore this field.

    model string

    Default value: distil-whisper/distil-large-v2

    The speech to text model to be used by the voice assistant. distil-whisper/distil-large-v2 is lower latency but English-only. openai/whisper-large-v3-turbo is multi-lingual but slightly higher latency.

    client_state string

    Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.

    command_id string

    Use this field to avoid duplicate commands. Telnyx will ignore any command with the same command_id for the same call_control_id.

Responses

200: Successful response upon making a call control command.

default: Unexpected error

Request samples


curl -L 'https://api.telnyx.com/v2/calls/:call_control_id/actions/ai_assistant_start' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"assistant": {
"id": "string",
"openai_api_key_ref": "string"
},
"voice": "Telnyx.LibriTTS.0",
"voice_settings": {
"api_key_ref": "my_elevenlabs_api_key"
},
"greeting": "Hello, can you tell me your age and where you live?",
"interruption_settings": {
"enable": true
},
"transcription": {
"model": "distil-whisper/distil-large-v2"
},
"client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
"command_id": "891510ac-f3e4-11e8-af5b-de00688a4901"
}'

Response samples


{
"data": {
"result": "ok"
}
}