Skip to main content

PlayHT Integration with SmythOS

Want to add a voice to your automated workflows? Connect PlayHT to SmythOS and empower your agents to generate high-quality, AI-powered speech from any text input.

TL;DR

Securely link your PlayHT account to SmythOS using your User ID and Secret Key. Then, use the Text-to-Speech (TTS) components to automate the creation of audio files with fine-grained control over voice, emotion, quality, and more.

List of PlayHT Components

Quickly compare PlayHT components by what they do and their key I/O. Click any component name to jump directly to its detailed guide.

ComponentActionWhat it DoesInputsKey OutputsUse Case
PlayHT 2.0 - TTSGenerateInitiates a high-quality, emotional text-to-speech conversion job.required text, voice_ididCreating expressive voiceovers for videos.
PlayHT 1.0 - TTSGenerateInitiates a standard text-to-speech conversion job.required text, voice_ididGenerating simple audio notifications or alerts.
Get OutputFetchRetrieves the result (audio URL) of a completed TTS job.required idURLThe second step to get the final audio file.
INFO
Why Integrate PlayHT with Your Agent?

PlayHT is a leader in AI voice generation, offering a wide range of realistic voices and emotional tones. Integrating it with SmythOS allows you to build sophisticated, multi-sensory automations.

  • Automate Audio Content: Create agents that automatically convert blog posts, news articles, or reports into audio podcasts, enhancing content accessibility.
  • Personalized Audio Messages: Generate dynamic, personalized audio alerts or messages at scale. Imagine an agent that greets users by name in a welcome message.
  • Create Voiceovers on the Fly: Build a media pipeline where an agent writes a script with an LLM, then immediately generates a voiceover for a video or presentation using PlayHT.
  • Enhance Notifications: Move beyond simple text alerts. Configure your agents to generate spoken notifications for critical system events, providing a more immediate and attention-grabbing alert.

Prerequisites

Before you begin, please ensure you have the following:

  • An active SmythOS account. (Sign up here).
  • A PlayHT account.
  • Your PlayHT User ID and Secret Key.

Getting Started With PlayHT

The connection between SmythOS and PlayHT is configured using your User ID and a secure Secret Key.

Step 1: Get Your PlayHT Credentials

  1. Log in to your PlayHT Studio.
  2. On the API Access page, you will find your User ID and Secret Key.
  3. Copy both of these values.

Step 2: Store Your Credentials in SmythOS Vault

Your User ID and Secret Key are sensitive credentials. Use the SmythOS Vault to store them securely.

  1. In your SmythOS dashboard, navigate to the Vault.
  2. Create a new secret for your User ID and another for your Secret Key. Give them memorable names, like playht_user_id and playht_secret_key.
  3. For more details, see the Vault Documentation.

Step 3: Configure a PlayHT Component

  1. In your SmythOS agent graph, drag and drop any PlayHT component.
  2. Click the component to open its Settings panel.
  3. In the User ID and Secret Key fields, select the corresponding secrets you saved in the Vault.
  4. Your connection is now configured for that component.
Heads-up
You must add the User ID and Secret Key from the Vault to each PlayHT component you use. This ensures all your API calls are properly authenticated.

Which PlayHT Component Should I Use?

If you need to…Workflow StepsUse these ComponentsWhy these?
Generate high-quality, emotional speech1. Start Job
2. Fetch Result
PlayHT 2.0 - TTSGet OutputThe 2.0 TTS engine offers superior quality and emotional control, but requires a two-step, asynchronous process.
Generate standard speech quickly1. Start Job
2. Fetch Result
PlayHT 1.0 - TTSGet OutputThe 1.0 TTS engine is suitable for basic voice generation without the need for advanced emotional tones.
Retrieve a previously generated audio fileFetch ResultGet OutputThis is the essential second step to get the audio URL from any TTS job you've started.

Component Details

This section provides detailed information for each PlayHT component.

PlayHT 2.0 - TTS

Initiates a text-to-speech conversion job using PlayHT's advanced v2.0 engine, which supports emotional tones. This is an asynchronous operation.

INFO
This component requires a User ID and Secret Key for authentication, as detailed in the Getting Started section.

Component-Specific Settings

  • Output Format: Choose the audio format (mp3, wav, ogg, etc.).
  • Quality: Select the output quality, from draft to premium.
  • Emotion: Select a specific emotional tone for the voice (e.g., female_happy, male_angry).
  • Speed, Sample Rate, Voice Guidance, Style Guidance: Fine-tune the voice performance with these sliders.

Inputs

FieldTypeRequiredNotes
textstringYesThe text content to convert into speech.
voice_idstringYesThe ID of the voice to use. You can find voice IDs in your PlayHT Studio.

Outputs

FieldTypeDescription
idstringThe unique ID of the conversion job. This is crucial for the next step.
ResponseobjectThe raw JSON response from the PlayHT API confirming the job was started.
HeadersobjectThe HTTP headers from the API response.
Use Case

An agent generates a voiceover for an animated character. It passes the character's line of dialogue to this component and selects the female_surprised emotion. The agent then saves the output id.

{
"component": "playht.playht20Tts",
"text": "Wow, I can't believe SmythOS can automate this!",
"voice_id": "s3_voice_id_example"
}
Asynchronous Job

This component only starts the audio generation job. It does not return the final audio file. You must use the output id with the "Get Output" component to retrieve the result.

Get Output

Retrieves the result of a TTS conversion job that has been initiated by either the v1.0 or v2.0 TTS component.

INFO
This component requires a User ID and Secret Key for authentication, as detailed in the Getting Started section.

Inputs

FieldTypeRequiredNotes
idstringYesThe unique ID of the conversion job, obtained from the output of a TTS component.

Outputs

FieldTypeDescription
URLstringThe direct URL to the generated audio file once processing is complete.
ResponseobjectThe raw JSON response from the API, which includes the status of the job and the URL.
HeadersobjectThe HTTP headers from the API response.
Use Case

After starting a TTS job and getting an id, an agent uses this component in a loop with a short delay, checking the status in the Response until the URL is available, then downloads the file.

{
"component": "playht.getOutput",
"id": "tts-job-id-from-previous-step"
}
Processing Time

Audio generation is not instantaneous. You may need to call this component a few seconds after the TTS job is started. Check the Response for the job status ("transcoded": true) before using the URL.

PlayHT 1.0 - TTS

Initiates a text-to-speech conversion job using PlayHT's standard v1.0 engine.

INFO
This component requires a User ID and Secret Key for authentication, as detailed in the Getting Started section.

Component-Specific Settings

  • Output Format: Choose the audio format (mp3, wav, etc.).
  • Quality: Select the output quality, from draft to premium.
  • Speed: Control the playback speed of the audio.
  • Sample Rate: Specify the sample rate for the audio file.

Inputs

FieldTypeRequiredNotes
textstringYesThe text content to convert into speech.
voice_idstringYesThe ID of the voice to use.

Outputs

FieldTypeDescription
idstringThe unique ID of the conversion job, to be used with the "Get Output" component.
ResponseobjectThe raw JSON response from the PlayHT API.
HeadersobjectThe HTTP headers from the API response.
Use Case

An agent generates a simple, neutral-tone audio notification, like "Your report has finished generating."

{
"component": "playht.playht10Tts",
"text": "System alert. Server utilization has reached 90 percent.",
"voice_id": "s3_voice_id_example"
}
Legacy Option

This component uses the older v1.0 engine and does not support the advanced emotional controls of the v2.0 component.

Best Practices & Advanced Tips

  • Secure Your Credentials: Always store your User ID and Secret Key in the SmythOS Vault.
  • Master the Asynchronous Flow: The key to using this integration effectively is the two-step process. First, call a TTS component to get a job id. Second, use the Get Output component (potentially in a loop with a delay) to fetch the final audio URL.
  • Experiment with Voices and Settings: PlayHT offers a huge variety of voices. Spend time in the PlayHT Studio to find the ones that best fit your brand. Tweak the speed, quality, and emotion settings to get the perfect performance.
  • Manage Your Quota: Text-to-speech conversion consumes characters from your PlayHT plan. Be mindful of the length of the text you are converting, especially in high-volume automated workflows.

Troubleshooting Common Issues

  • Error: 401 Unauthorized

    • Cause: The User ID or Secret Key is incorrect or missing.
    • Solution: Verify that your credentials in the SmythOS Vault are correct and match those on your PlayHT API Access page.
  • "Get Output" returns a "Pending" status

    • Cause: The audio generation job is not yet complete.
    • Solution: This is normal. Add a delay (e.g., 5-10 seconds) in your agent between the TTS component and the Get Output component. For long texts, you may need a longer delay or a looping mechanism.
  • Error: 402 Payment Required

    • Cause: You have exceeded your character quota for the month or have an issue with your PlayHT subscription.
    • Solution: Check your account status and usage in your PlayHT dashboard.
  • Poor Audio Quality or Incorrect Emotion

    • Cause: The selected settings may not be optimal for the voice or text.
    • Solution: Try a different Quality setting in the component. Adjust the Style Guidance and Voice Guidance sliders in the v2.0 component to fine-tune the performance.

What's Next?

You are now ready to build powerful voice-enabled applications with the SmythOS PlayHT Integration!

Consider these ideas:

  • Build an Agent That...

    • Takes the text from a scraped web article (ScrapingBee), converts it to audio with PlayHT, and saves the MP3 file to OneDrive.
    • Generates a personalized daily news briefing by getting headlines from NewsAPI and reading them aloud.
    • Creates dynamic voice responses for a chatbot, using an LLM like OpenRouter to generate the text and PlayHT to generate the audio.
  • Explore Other Integrations:

    • Connect your agent to a telephony service to make automated calls using the generated speech.
    • Use PlayHT to create audio versions of your marketing emails, and send them out as part of a campaign.