Skip to navigation

HeyGen

Text-to-speech

View as MarkdownOpen in Claude

HeyGen Voice is HeyGen’s text-to-speech engine, with two voice models and 66 public English voices. Give an AI agent built with the SWML ai method a HeyGen voice by naming the heygen engine in its voice string.

Models

ModelDescription
heygen-voice-1-turboDefault. Lower latency: first audio in about 0.9 to 1.1 seconds in testing, whatever the text length
heygen-voice-1Higher latency, especially on short phrases

The model comes from the voice string’s :<model> suffix, otherwise from the heygen_model parameter, otherwise the default. Model IDs match exactly. Any other ID, including HeyGen’s free-tier heygen-voice-1-turbo-free, uses the default.

Voices

The voice is either a HeyGen voice ID, 32 lowercase hexadecimal characters, or one of HeyGen’s public voices named by the first word of its name, in any case. The public voices are all English:

adam, bram, brian, cecily, chloe, christopher, claire, connor, conor, corinne, craig, daniel, darren, elowen, emily, emma, eric, ethan, ewan, felicity, gareth, harrison, hugh, huw, iona, jack, jackson, jake, james, jason, jennifer, jessica, jocelyn, jonah, joshua, justin, kieran, liam, lucian, marielle, matthew, meredith, michael, michelle, nadine, neha, nicola, noelle, oliver, paul, rahul, richard, robert, rory, ryan, sabrina, sarah, sharon, simon, sophie, soren, tabitha, thomas, victoria, vincent, and weston.

Any other voice, or no voice, speaks as nadine.

Languages

A HeyGen voice speaks in the language of the agent’s languages entry, sent as its base language: en-US is sent as en. With no usable language code, HeyGen detects the language from the text, which can fail on text such as a number on its own.

Usage

A voice identifier string has three parts: the heygen engine code, a voice, and an optional model. The engine code must be exactly heygen.

Format: heygen.<voice>:<model>

  • voice (required): a public voice name or a HeyGen voice ID from Voices.
  • model (optional): one of the models above.

Examples:

heygen.claire
heygen.claire:heygen-voice-1-turbo
heygen.oliver:heygen-voice-1

Parameters

These settings tune HeyGen voices. The first three go in the agent’s params; the last goes in the voice’s own params, on a languages or multilingual.languages entry.

ParameterDefaultDescription
heygen_keyThe platform’s keyYour HeyGen API key. It needs HeyGen’s voices:write scope, and can contain only letters, digits, -, _, and .
heygen_modelheygen-voice-1-turboThe model for voice strings that don’t name one
heygen_stream_firsttrueSet to false to stop streaming each reply’s first sentence
expressiveness_boostHeyGen’s default, 1How expressive the voice is, from 0 to 1. HeyGen suggests 0.5 to keep a voice’s character

How HeyGen voices play

  • Each reply’s first sentence streams, so playback starts at its first audio while the rest is generated in the background.
  • HeyGen’s public voices take no speed control, so auto_speed has no effect.
  • A caller who interrupts stops the audio cleanly.
  • A HeyGen voice that fails gives way to the next voice the agent has. See Voice fallback.

Rate limits

HeyGen sets its own limits: 5,000 characters per request and, by default, 30 requests per minute per HeyGen workspace member. HeyGen raises the request limit for enterprise accounts. Each spoken sentence is one request, so a busy call, or several calls on one key, can reach the limit. A request over the limit is retried.


Give an AI agent a HeyGen voice via SWML

The languages list of the SWML ai method sets the voice an AI agent speaks in. This agent speaks with HeyGen’s Claire, with Cartesia’s Kurt as a backup voice, and uses your own HeyGen key. The Server SDKs build the document and serve it at /swml on port 3000, only to requests that carry the username signalwire and your password.

Replace these values in the samples:

ValueReplace with
<YOUR_BASIC_AUTH_PASSWORD>A password you choose for your SWML server. You include it in the server URL you give SignalWire: https://signalwire:<password>@<host>/swml
<YOUR_HEYGEN_KEY>Your HeyGen API key, with the voices:write scope
# Install: python -m pip install signalwire-sdk
# Save as heygen_ai_agent.py and run: python heygen_ai_agent.py
from signalwire import AgentBase
agent = AgentBase(
name="heygen-ai-agent",
route="/swml",
port=3000,
basic_auth=("signalwire", "<YOUR_BASIC_AUTH_PASSWORD>"),
)
agent.set_prompt_text("You are Ada, the dispatcher for Bayview Taxi. Greet the caller and help them book a ride.")
agent.set_param("heygen_key", "<YOUR_HEYGEN_KEY>")
agent.add_language(
"English",
"en-US",
["heygen.claire:heygen-voice-1-turbo", "cartesia.efa653e5-314d-46ca-9f90-70ac7d6ca71e"],
params={"expressiveness_boost": 0.5},
)
agent.serve()

To send calls from your phone number to the server, follow Answer a call via SWML. Call the number, and the agent greets you in Claire’s voice. If you hear Nadine instead, the voice name isn’t one of HeyGen’s public voices. If you hear Kurt, the HeyGen voice failed to open: check that the key has the voices:write scope and contains only letters, digits, -, _, and ..

Next steps