Skip to main content

Provider-specific Swarmauri import package for PlayHT text-to-speech, voice management, async, and batch audio generation workflows.

Project description

Swarmauri Logo

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

Swarmauri PlayHT Voice Generation

swarmauri_llm_playht provides the provider-specific Swarmauri import package for PlayHTModel. Despite the older llm package name, the runtime is a PlayHT text-to-speech and voice-management adapter that synthesizes speech, enumerates available voices, and supports cloned-voice workflows through the PlayHT API.

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.
  • 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.

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.

Related Packages

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

Project details


Download files

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

Source Distribution

swarmauri_llm_playht-0.11.0.dev1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

swarmauri_llm_playht-0.11.0.dev1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_llm_playht-0.11.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_llm_playht-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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 swarmauri_llm_playht-0.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 3ca5f00781a03c246927c45ea281302ffe8870dbea9b842d3d1c28e5dde852fa
MD5 f430542377c56975cc475314ad0d5ef7
BLAKE2b-256 91c2a67693bc08d19e0d5ad4320803b690bd7d51e22ec44ab172ba862c8054d4

See more details on using hashes here.

File details

Details for the file swarmauri_llm_playht-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_llm_playht-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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 swarmauri_llm_playht-0.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 760e18a449eb9bd90b86f77b6d3467f99685a828ebba9da00a364dc302c82823
MD5 03d362f6381409b29539455d1ef1ecac
BLAKE2b-256 2e6b7c0ffd6d72973d061ff4716db2dc794e2c2d2c8eabcc0614136f148ca3a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page