Skip to content

Add Telnyx voice provider#1461

Draft
whoiskatrin wants to merge 8 commits intomainfrom
feat/telnyx-voice-provider
Draft

Add Telnyx voice provider#1461
whoiskatrin wants to merge 8 commits intomainfrom
feat/telnyx-voice-provider

Conversation

@whoiskatrin
Copy link
Copy Markdown
Contributor

Summary

Adds first-class Telnyx support for the Cloudflare voice pipeline, addressing #1367.

This PR introduces a new @cloudflare/voice-telnyx provider package under voice-providers/telnyx and a small examples/telnyx-voice-agent starter app.

What changed

@cloudflare/voice-telnyx

  • Adds a Telnyx provider package following the existing voice-providers/* conventions.
  • Supports subpath imports so users can import only what they need:
    • @cloudflare/voice-telnyx
    • @cloudflare/voice-telnyx/stt
    • @cloudflare/voice-telnyx/tts
    • @cloudflare/voice-telnyx/telephony
  • Ports Telnyx STT support implementing Transcriber / TranscriberSession:
    • Workers fetch-upgrade WebSocket connection
    • 16 kHz mono PCM16 streaming
    • WAV header emission for Telnyx's streaming API
    • interim and final transcript callbacks
  • Ports Telnyx TTS support implementing TTSProvider and StreamingTTSProvider:
    • REST backend by default
    • Workers-only WebSocket streaming backend
  • Adds Telnyx telephony helpers:
    • TelnyxCallBridge
    • TelnyxPhoneTransport
    • TelnyxPhoneClient
    • TelnyxJWTEndpoint
    • createTelnyxVoiceConfig
  • Keeps STT/TTS subpaths independent from telephony imports.
  • Adds README docs covering environment variables, subpath imports, browser voice usage, and PSTN/telephony setup.

Example app

  • Adds examples/telnyx-voice-agent, a compact starter using:
    • Telnyx STT
    • Telnyx TTS
    • Workers AI for the LLM
    • useVoiceAgent for browser microphone/audio UX
  • Includes .env.example with:
    • TELNYX_API_KEY
    • optional TELNYX_CREDENTIAL_CONNECTION_ID for telephony experiments
  • Documents that the default example focuses on STT/TTS, while telephony is available through the provider package.

Attribution / dependency metadata

  • Adds @telnyx/webrtc for telephony support.
  • Updates NOTICE to document that parts of this provider are adapted from Telnyx's @telnyx/voice-cloudflare package, whose npm metadata declares MIT licensing.

Validation

Passed:

npm run build -w @cloudflare/voice-telnyx
npm run build -w @cloudflare/agents-telnyx-voice-agent

Also ran:

npm run typecheck

That currently fails on existing packages/ai-chat type errors unrelated to this PR, including missing exports from agents/chat and AgentConnection.path type mismatches in packages/ai-chat/src/react-tests/use-agent-chat.test.tsx.

Notes for reviewers

  • Phone playback via TelnyxPhoneTransport expects server audio as 16 kHz mono PCM16. The README calls out using withVoice(Agent, { audioFormat: "pcm16" }) and client preferredFormat: "pcm16" for PSTN routing.
  • The initial example intentionally stays focused on browser STT/TTS to keep the starter small and easy to verify. Telephony APIs are included and documented for users who want to extend it.

Refs #1367

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: 994f090

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 9 additional findings in Devin Review.

Open in Devin Review

Comment thread voice-providers/telnyx/src/transport/phone-transport.ts Outdated
whoiskatrin and others added 2 commits May 4, 2026 22:09
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 4, 2026

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1461

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1461

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1461

hono-agents

npm i https://pkg.pr.new/hono-agents@1461

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1461

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1461

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1461

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1461

commit: 994f090

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