pipecat icon indicating copy to clipboard operation
pipecat copied to clipboard

Add Typecast HTTP TTS service and foundational example

Open sangwonl opened this issue 2 months ago • 5 comments

Summary

  • Add an HTTP-based TypecastTTSService aligned with the official Typecast Text-to-Speech REST API
  • Expose the integration via pipecat.services.typecast, include a typecast optional dependency, and document new env vars for credentials
  • Add a foundational interruptible example that pairs Deepgram STT, OpenAI LLM, and Typecast TTS

What's New

Typecast TTS Service

  • Implements src/pipecat/services/typecast/tts.py using a shared aiohttp client; handles ISO 639-3 language mapping plus prompt/output controls (emotion, intensity, pitch, tempo, format) as documented by Typecast
  • Streams WAV audio through the shared _stream_audio_frames_from_iterator helper, integrates start_ttfb_metrics/start_tts_usage_metrics, and enforces the audio_format="wav" contract for raw PCM playback
  • Re-exports the service from src/pipecat/services/typecast/__init__.py so pipecat.services.typecast mirrors other provider namespaces

Foundational Example

  • Adds examples/foundational/07z-interruptible-typecast-http.py, matching other HTTP samples with configurable transports, Deepgram STT, OpenAI LLM, and optional TYPECAST_VOICE_ID overrides
  • Manages all HTTP work inside a single aiohttp.ClientSession, highlighting how to reuse the service within an interruptible pipeline

Configuration & Packaging

  • Registers a typecast optional dependency group inside pyproject.toml for targeted installs
  • Updates env.example with TYPECAST_API_KEY/TYPECAST_VOICE_ID so users know which secrets are required before running the sample or service

Usage Example

async with aiohttp.ClientSession() as session:
    tts = TypecastTTSService(
        api_key=os.environ["TYPECAST_API_KEY"],
        aiohttp_session=session,
        params=TypecastTTSService.InputParams(
            prompt_options=PromptOptions(emotion_preset="happy", emotion_intensity=1.2),
        ),
    )

sangwonl avatar Nov 02 '25 07:11 sangwonl

We have a community integrations program: https://github.com/pipecat-ai/pipecat/blob/main/COMMUNITY_INTEGRATIONS.md

Do you work for the company that builds Typecast? If so, adding the community integration could be a great solution to adding support to Pipecat. Please let me know if you have any questions.

markbackman avatar Nov 03 '25 14:11 markbackman

@sangwonl just making sure you saw my note above about adding Typecast to the Community Integrations program. Please check it out and let me know if you have any questions.

markbackman avatar Nov 10 '25 14:11 markbackman

Hello, @markbackman. Sorry for the late reply. When you say to add it as a community integration, do you mean simply getting it listed on the page? I was wondering — is there any way it could be added as an official Pipecat service instead?

Thanks :)

sangwonl avatar Nov 10 '25 22:11 sangwonl

Sorry for the late reply. When you say to add it as a community integration, do you mean simply getting it listed on the page?

Yes, that's the right page.

is there any way it could be added as an official Pipecat service instead?

Integrations take a lot of our time to maintain, so we're being really picky about new integrations for a bit. Starting as a community integration is a good path to get visibility and can still provide a path for a first-party integration that we help maintain, as the community demands inclusion into Pipecat. Does that make sense?

markbackman avatar Nov 11 '25 00:11 markbackman

Thank you for the detailed explanation. That sounds like a reasonable approach. I’ll go ahead and try it as a community integration.

In that case, should I leave this PR open so it could be used later if there’s community demand for the 1st-party inclusion you mentioned, or would you prefer that I close it?

sangwonl avatar Nov 11 '25 01:11 sangwonl

I'll close this out now since you're listed as a community integration. We can always reference this in the future if we want to port this to first party. Thanks again!

markbackman avatar Dec 06 '25 04:12 markbackman