Skip to content

feat(azure): add private_endpoint support to Azure TTS services#4549

Open
brunomartinez-lmi wants to merge 2 commits into
pipecat-ai:mainfrom
brunomartinez-lmi:feature/azure-tts-private-endpoint
Open

feat(azure): add private_endpoint support to Azure TTS services#4549
brunomartinez-lmi wants to merge 2 commits into
pipecat-ai:mainfrom
brunomartinez-lmi:feature/azure-tts-private-endpoint

Conversation

@brunomartinez-lmi
Copy link
Copy Markdown

@brunomartinez-lmi brunomartinez-lmi commented May 22, 2026

Summary

Add private_endpoint parameter to AzureTTSService and AzureHttpTTSService, enabling connection via Private Link or custom domain endpoints.

Motivation

AzureSTTService already supports a private_endpoint parameter (added in PR #3967 and refined in PR #3974), but the TTS services still require a region-based endpoint. Users deploying Azure Speech resources with custom domains or Private Link must currently subclass and monkey-patch the SpeechConfig after initialization.

This PR brings TTS to parity with STT by passing private_endpoint directly to Azure SDK's SpeechConfig(endpoint=...) constructor — the same pattern used in the STT service.

Changes

  • Added private_endpoint parameter to AzureBaseTTSService._init_azure_base()
  • Added private_endpoint parameter to AzureTTSService.__init__()
  • Added private_endpoint parameter to AzureHttpTTSService.__init__()
  • Updated start() methods to create SpeechConfig with endpoint= when private_endpoint is provided (matching the STT implementation pattern)
  • Made region optional (required only when private_endpoint is not provided)
  • Added validation: raises ValueError if neither region nor private_endpoint is given
  • Added warning when both are provided (region is ignored, matching STT behavior)

Usage

# Using private endpoint (Private Link or custom domain)
tts = AzureTTSService(
    api_key="...",
    private_endpoint="https://my-resource.cognitiveservices.azure.com/",
    settings=AzureTTSService.Settings(voice="en-US-SaraNeural"),
)

# Existing region-based usage continues to work unchanged
tts = AzureTTSService(
    api_key="...",
    region="eastus",
    settings=AzureTTSService.Settings(voice="en-US-SaraNeural"),
)

References

🤖 generated by copilot, pre-reviewed by me

brunomartinez-lmi and others added 2 commits May 22, 2026 15:13
…eHttpTTSService

AzureSTTService already supports a private_endpoint parameter for connecting
via Private Link or custom domain endpoints. This commit adds the same
capability to both AzureTTSService (WebSocket streaming) and
AzureHttpTTSService (HTTP), following the same pattern: when
private_endpoint is provided, it is passed directly to SpeechConfig as
the endpoint parameter instead of the region.

This removes the need for users to subclass and monkey-patch the
SpeechConfig after initialization.

Closes pipecat-ai#2373

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@brunomartinez-lmi brunomartinez-lmi force-pushed the feature/azure-tts-private-endpoint branch from 25e69c1 to 15b361d Compare May 22, 2026 19:45
@brunomartinez-lmi brunomartinez-lmi marked this pull request as ready for review May 25, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant