Skip to main content

Typecast.ai Tool

This tool allows Agents to use Typecast.ai text-to-speech to create audio files from text with emotion control. To see more and get started, visit https://typecast.ai/

Usage

This tool has a more extensive example usage documented in a Jupyter notebook here

from llama_index.tools.typecast import TypecastToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

speech_tool = TypecastToolSpec(api_key="your-key")

agent = FunctionAgent(
    tools=speech_tool.to_tool_list(),
    llm=OpenAI(model="gpt-4o-mini"),
)
print(
    await agent.run(
        'Create speech from the text "Hello world!" with a happy emotion and output the file to "speech.wav"'
    )
)

text_to_speech: Convert text to speech with emotion, pitch, tempo control, and reproducible results get_voices: List all available Typecast voices get_voice: Get details of a specific voice by ID

This tool is designed to be used as a Tool in an Agent.

Features

  • Multiple Voice Models: Support for various AI voice models (ssfm-v21, ssfm-v30)
  • Multi-language Support: 27+ languages including English, Korean, Spanish, Japanese, Chinese, and more
  • Emotion Control: Adjust emotional expression (happy, sad, angry, normal, whisper, etc.) with intensity control
  • Audio Customization: Control volume, pitch, tempo, and output format (WAV/MP3)
  • Reproducible Results: Use seed parameter for consistent audio generation
  • Voice Discovery: List and search available voices by model, gender, age, or use case (V2 API)

Advanced Usage

Using Seed for Reproducible Results

from llama_index.tools.typecast import TypecastToolSpec

speech_tool = TypecastToolSpec(api_key="your-key")

# Generate the same audio multiple times with the same seed
result = speech_tool.text_to_speech(
    text="Hello world!",
    voice_id="tc_62a8975e695ad26f7fb514d1",
    output_path="speech.wav",
    seed=42,  # Same seed = same audio
)

Getting Voice Details (V2 API)

# Get specific voice information
voice = speech_tool.get_voice("tc_62a8975e695ad26f7fb514d1")
print(f"Voice: {voice['voice_name']}")
print(f"Gender: {voice['gender']}, Age: {voice['age']}")
print(f"Use cases: {voice['use_cases']}")

# Models now include emotions per model version
for model in voice["models"]:
    print(f"Model {model['version']}: emotions = {model['emotions']}")

Filtering Voices (V2 API)

# Filter by model, gender, age, and use case
voices = speech_tool.get_voices(
    model="ssfm-v30", gender="female", age="young_adult", use_case="Audiobook"
)

for voice in voices:
    print(f"{voice['voice_name']} ({voice['voice_id']})")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_tools_typecast-0.2.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_tools_typecast-0.2.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_typecast-0.2.0.tar.gz.

File metadata

  • Download URL: llama_index_tools_typecast-0.2.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_tools_typecast-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ecfe25f67d156300640614295baaf706965befcb4cab85ce5484d03303370e8c
MD5 4dc4e79acb4c2e12c01dae6c656c41d3
BLAKE2b-256 24380bdaec37797cdc1a31fff841efda398ead3b52f0c1a60e95a528614dd394

See more details on using hashes here.

File details

Details for the file llama_index_tools_typecast-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_tools_typecast-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_tools_typecast-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b2621b8991d1dc62cd36d8a9a44ca4f8da95d7359ee6385abb78559a523158b
MD5 3220d09f44de8bbc0dc4f23a15790c2c
BLAKE2b-256 6ee2f17209aeb3012ae902766faa7499630d0db6fa86700ea2ed4b98ab471f3a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page