Skip to main content

Deprecated: Play.ht service discontinued. This package is retained for import compatibility. Construction fails locally with migration instructions. Use swarmauri_standard.tts.OpenaiTTS.OpenaiTTS; install with uv add swarmauri_standard or pip install swarmauri_standard. See the migration guide. The examples below describe the retired service and must not be used for new integrations.

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_llm_playht Discord

Swarmauri PlayHT Legacy Compatibility

swarmauri_llm_playht preserves the historic PlayHTModel import while the provider now lives in the standalone swarmauri_tts_playht package. The model is a TTSBase component and is no longer registered as an LLM.

New applications should install and import swarmauri_tts_playht directly.

The adapter targets PlayHT's API under https://api.play.ht/api/v2, supports the repo-tracked model families Play3.0-mini, PlayHT2.0-turbo, PlayHT1.0, and PlayHT2.0, and writes generated audio to a local output file.

Why Use This Package?

  • Keep PlayHT-specific imports explicit in Swarmauri applications.
  • Generate audio from text through a Swarmauri component instead of hand-writing PlayHT HTTP requests.
  • Reuse one adapter for synthesis, cloned-voice discovery, and cloned-voice lifecycle operations.
  • Bridge older llms usage to PlayHT’s speech-generation surface while newer TTS package paths continue to evolve.

FAQ

What does swarmauri_llm_playht install?

It installs PlayHTModel under swarmauri.llms.

Is this actually a chat LLM package?

No. The runtime is a PlayHT text-to-speech adapter with voice-management helpers. The package name reflects the older export surface, but the behavior is speech generation rather than text chat.

Which PlayHT model families are supported?

The current allowlist includes Play3.0-mini, PlayHT2.0-turbo, PlayHT1.0, and PlayHT2.0.

What credentials are required?

You need a PlayHT API key and user ID. The runtime expects both api_key and user_id.

Does it support streaming?

No. stream and astream are explicitly unimplemented for PlayHTModel.

Can it manage cloned voices?

Yes. The adapter includes methods to get cloned voices, clone a voice from a file or URL, and delete a cloned voice.

Features

  • PlayHTModel for text-to-speech synthesis against the PlayHT API.
  • Sync and async speech generation methods that save audio to a local file path.
  • Batch and async batch synthesis workflows.
  • Prebuilt voice discovery and validation for the selected voice engine.
  • Cloned voice management helpers for create, list, and delete operations.
  • A swarmauri-playht CLI for positional, piped, file-based, and interactive prompts through the stateless TextToSpeechAgent.
  • Compatibility with Python 3.10, 3.11, 3.12, 3.13, and 3.14.

Installation

uv add swarmauri_llm_playht
pip install swarmauri_llm_playht

Usage

Set PLAYHT_API_KEY and PLAYHT_USER_ID in your environment before creating the model.

Command Line

Set the credentials in your environment, then pass the text to synthesize:

export PLAYHT_API_KEY="your-api-key"
export PLAYHT_USER_ID="your-user-id"
swarmauri-playht "Welcome to Swarmauri." --output welcome.mp3

Run the command without text for an interactive prompt:

swarmauri-playht --output greeting.mp3

The CLI also accepts piped input or a UTF-8 prompt file:

echo "Turn this text into speech." | swarmauri-playht -o piped.mp3
swarmauri-playht --prompt-file script.txt --voice Adolfo -o narration.mp3
swarmauri-playht "Generate through the agent." \
  --voice-model PlayHT2.0-turbo -o agent.mp3

Use swarmauri-playht --help to see model, voice, timeout, and credential options. Every command uses a fresh TextToSpeechAgent execution with no conversation, memory, or system context. Environment variables are preferred over credential flags so secrets do not remain in shell history.

Text To Speech

import os

from swarmauri_llm_playht import PlayHTModel

tts = PlayHTModel(
    api_key=os.environ["PLAYHT_API_KEY"],
    user_id=os.environ["PLAYHT_USER_ID"],
    name="Play3.0-mini",
    voice="Adolfo",
)

audio_path = tts.predict(
    "Swarmauri turns provider APIs into composable components.",
    audio_path="playht_output.mp3",
)

print(audio_path)

Async Speech Generation

import asyncio
import os

from swarmauri_llm_playht import PlayHTModel


async def main() -> None:
    tts = PlayHTModel(
        api_key=os.environ["PLAYHT_API_KEY"],
        user_id=os.environ["PLAYHT_USER_ID"],
        name="PlayHT2.0-turbo",
        voice="Adolfo",
    )
    output = await tts.apredict("Generate a short spoken greeting.", "greeting.mp3")
    print(output)


# asyncio.run(main())

Voice Management

import os

from swarmauri_llm_playht import PlayHTModel

tts = PlayHTModel(
    api_key=os.environ["PLAYHT_API_KEY"],
    user_id=os.environ["PLAYHT_USER_ID"],
    name="PlayHT2.0",
    voice="Adolfo",
)

voices = tts.get_cloned_voices()
print(voices)

Examples

  • Use PlayHTModel when an agent or application needs provider-hosted speech output saved to a local file.
  • Use batch methods when one workflow needs multiple spoken outputs in one pass.
  • Use cloned voice methods when the application manages a catalog of custom voices in PlayHT.

Foundational Swarmauri Packages

More Documentation

Best Practices

  • Keep PLAYHT_API_KEY and PLAYHT_USER_ID in environment variables or a secret manager.
  • Validate the selected voice against the chosen PlayHT voice engine before running batch jobs.
  • Use explicit output paths so generated audio assets are easy to manage.
  • Prefer newer Swarmauri TTS-native imports when available for new projects, since this package preserves an older compatibility surface.

License

Apache-2.0

Metadata

Release files for swarmauri_llm_playht 0.11.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 swarmauri_llm_playht 0.11.0
File Size Uploaded Provenance Actions
swarmauri_llm_playht-0.11.0.tar.gz 8.7 kB Without provenance Details for swarmauri_llm_playht-0.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for swarmauri_llm_playht 0.11.0
File Interpreter ABI Platform Actions
swarmauri_llm_playht-0.11.0-py3-none-any.whl Python 3 none any Details for swarmauri_llm_playht-0.11.0-py3-none-any.whl

Total release size: 18.1 kB

Release files / swarmauri_llm_playht-0.11.0.tar.gz

Download URL swarmauri_llm_playht-0.11.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3a9387867170c631d6c3f7a7fe071520923cd3b975d1c1421a2f690f9f73b27d
BLAKE2b-256 checksum
How to use checksums
de06a4a6568d7e967fcd613adf2b7dd70916f9b6ccde7646befae8b5c0915eb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / swarmauri_llm_playht-0.11.0-py3-none-any.whl

Download URL swarmauri_llm_playht-0.11.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d1660fd6ed750c4ef0a3b1d7efb6d575cbdf67516332a99bea7d6efdf901f9b
BLAKE2b-256 checksum
How to use checksums
c15da8098975440df3ab13d406f69f8a14ee2527da9f198d23b9118852ede811
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for swarmauri_llm_playht 0.11.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.

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