Integration guide

Twilio Text to Speech: AI Voice Integration Fish Audio

Connect Twilio calls to expressive AI speech: plan media streaming, latency, interruption handling, codecs, fallbacks and per-minute speech costs.

2026/10/27

Twilio text to speech becomes an AI voice integration when Twilio carries the phone call and Fish Audio generates the spoken reply. Twilio owns numbers, call control and media transport; Fish Audio owns expressive streaming speech. A backend service sits between them.

The integration succeeds or fails on barge-in, media handling and latency, not on a generic voice demo.

A cream telephone handset whose cord becomes a coral AI speech waveform

What does Twilio handle versus Fish Audio?

Twilio receives the call, routes media and applies call-control actions. Fish Audio turns approved text into audio through the Fish Audio API.

Your application still needs to:

  • Verify the caller and enforce consent or recording rules.
  • Stream or upload audio to speech to text.
  • Decide the response and call approved tools.
  • Send short text units to Fish Audio.
  • Play returned audio back into the call.
  • Handle interruptions, hang-ups and fallbacks.

Start with Twilio’s current Media Streams documentation and verify whether ConversationRelay fits the level of playback control you need. Do not hard-code a tutorial’s message shape without checking the live contract.

How does the call flow work?

A practical flow is:

  1. Twilio accepts the inbound or outbound call.
  2. The call is connected to your media endpoint or the supported ConversationRelay flow.
  3. Your backend transcribes the caller with the speech to text workflow.
  4. The agent retrieves an answer and creates a short reply.
  5. Fish Audio streams speech through the real-time TTS path.
  6. Twilio plays the audio to the caller.
  7. A new caller turn cancels the old generation and playback.

Keep provider credentials on the server. Neither Twilio nor Fish Audio keys belong in the browser or call client.

How should media and codecs be handled?

Telephone audio is not a studio file. Confirm the sample rate, channel layout and encoding required by the Twilio media path, then test conversion on the production server.

Do not assume a WAV file generated in the workspace can be inserted unchanged into every media flow. Build a fixed audio fixture with speech, silence and an interruption, and verify it through the actual phone path.

The same applies to playback timing: measure the complete path from caller audio to the first audible reply. A provider’s API latency is only one component.

How do you handle interruptions?

Twilio can report new caller media while the old reply is still playing. Your backend must stop or discard the outdated playback and cancel unnecessary generation.

Keep the current turn identifier with every request. When a new turn arrives, old chunks from the previous turn must not appear later in the call.

The AI voice agent guide covers the full latency budget and interruption drills.

What should be tested before launch?

  • Inbound and outbound calls on the real Twilio number.
  • Mobile, landline and poor-network audio.
  • Names, dates, order numbers and account IDs.
  • Caller barge-in in the first, middle and last sentence.
  • Backend timeout and Fish Audio retry behavior.
  • Human transfer with conversation context.
  • Hang-up during generation.

Use a p95 target, not only an average. A small slow tail creates the calls people remember.

How much does the speech cost?

Fish Audio API access comes with the $99 Studio pack and 15,000 credits, about 15 million generated characters before retries. At roughly 150 words per minute, one minute of speech is approximately 900 characters, or one credit.

Twilio usage is separate. Check the current Twilio price for the number, call and media product you select. The TTS API pricing guide covers Fish Audio character planning.

What should the integration log?

Log a call-level request ID, the active turn ID, Twilio status, Fish Audio request status, time to first audio and total generated characters. Keep customer speech and transcript content under the same retention rules as your support platform.

Do not log provider keys or full media payloads. When a call fails, the operator needs enough information to distinguish telephony, authentication, credit and speech-generation failures without reconstructing the customer’s private conversation from raw logs.

Create dashboards for average and p95 latency, generation failure rate, fallback rate and hang-up timing. A spike in caller hang-ups during the first second of playback often points to media setup rather than model quality.

Key takeaways

  • Twilio owns telephony and media; Fish Audio owns generated speech.
  • A backend bridge is required; treat this as an integration, not a native add-on.
  • Test the actual phone path, not only a browser player.
  • Cancel old speech and generation when the caller interrupts.
  • Budget Fish Audio credits by generated characters and Twilio usage separately.

Frequently asked questions

Can Twilio use Fish Audio for text to speech?

Twilio handles the phone call and media transport while Fish Audio generates speech through its API. Your backend bridges the two and should follow the current contracts from both providers.

Does Fish Audio provide a one-click Twilio add-on?

No. This guide describes a backend integration. Do not claim a native Fish Audio add-on unless the current Twilio Marketplace listing confirms it.

What Twilio product should I use?

Choose between Twilio Media Streams and the current ConversationRelay capabilities based on your need to control barge-in, playback and dialogue logic. Verify the current Twilio documentation before implementation.

How do I reduce delay on a phone call?

Stream text in short units, warm the backend connection, start audio before the full reply exists, cancel old audio on interruption and keep the model plus retrieval steps inside a clear latency budget.

How is the speech billed?

Fish Audio API access starts with the $99 Studio pack and consumes credits by generated characters. Twilio telephony and media usage are billed separately under your Twilio account.

Twilio Text to Speech: AI Voice Integration | Fish Audio