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']})")

Metadata

Release files for llama-index-tools-typecast 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-tools-typecast 0.2.0
File Size Uploaded Provenance
llama_index_tools_typecast-0.2.0.tar.gz 5.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-tools-typecast 0.2.0
File Interpreter ABI Platform
llama_index_tools_typecast-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / llama_index_tools_typecast-0.2.0.tar.gz

Download URL llama_index_tools_typecast-0.2.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ecfe25f67d156300640614295baaf706965befcb4cab85ce5484d03303370e8c
BLAKE2b-256 checksum
How to use checksums
24380bdaec37797cdc1a31fff841efda398ead3b52f0c1a60e95a528614dd394
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / llama_index_tools_typecast-0.2.0-py3-none-any.whl

Download URL llama_index_tools_typecast-0.2.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b2621b8991d1dc62cd36d8a9a44ca4f8da95d7359ee6385abb78559a523158b
BLAKE2b-256 checksum
How to use checksums
6ee2f17209aeb3012ae902766faa7499630d0db6fa86700ea2ed4b98ab471f3a
Upload date
Uploaded using Trusted Publishing?
What is 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}

Security for llama-index-tools-typecast 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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