// Stay in touch?
Products
Encore CloudEncore Cloud
Encore.tsEncore.ts
Encore.goEncore.go
PricingPricing
Book a DemoBook a Demo
Use Cases
AI-Powered DevelopmentAI-Powered Development
Event-Driven SystemsEvent-Driven Systems
Distributed SystemsDistributed Systems
Case StudiesCase Studies
ShowcaseShowcase
Resources
DocsDocs
InstallInstall
Example AppsExample Apps
Demo videoDemo video
ArticlesArticles
ResourcesResources
GitHub ReleasesGitHub Releases
Systems Operational
Company
About UsAbout Us
Swag ShopSwag Shop
ContactContact
JobsJobs
PressPress
TermsTerms
Privacy PolicyPrivacy Policy
Data Processing AgreementData Processing Agreement
Enterprise SLAEnterprise SLA
Encore
© 2026 EncoreAll rights reserved
© 2026 Encore All Rights Reserved
GitHubDiscordYouTube

See all Templates

ElevenLabs Voice AI

Add text-to-speech to your app with ElevenLabs' generative voice AI

Tags

AI

Use Case

Bits

Author

Encore

Repo

Open on GitHub

Run this template in 60 seconds by installing Encore:

macOS
Windows
Linux
Brew
$ brew install encoredev/tap/encore

ElevenLabs Generative AI Text-to-Speech

This is an Encore package for generating text-to-speech audio using ElevenLabs generative voice AI.

Installation

  1. Copy over the elevenlabs package directory to your Encore application.
  2. Sync your project dependencies by running go mod tidy.

ElevenLabs API Key

You will need an API key from ElevenLabs to use this package. You can get one by signing up for a free account at https://elevenlabs.io/.

Once you have the API key, set it as an Encore secret using the name ElevenLabsAPIKey:

$ encore secret set --type dev,prod,local,pr ElevenLabsAPIKey Enter secret value: ***** Successfully updated development secret ElevenLabsAPIKey.

Endpoints

The elevenlabs package contains the following endpoints:

elevenlabs.ServeAudio

ServeAudio generates audio from text and serves it as mpeg to the client.

Frontend example usage

// Making request to locally running backend... const client = new Client(Local); // or to a specific deployed environment const client = new Client(Environment("staging")); const resp = await client.elevenlabs.ServeAudio("POST", JSON.stringify({text})); const url = window.URL.createObjectURL(await resp.blob()); //where value is the blob const audio = new Audio(); audio.src = url; await audio.play();

elevenlabs.StreamAudio

StreamAudio generates audio from text and streams it as mpeg to the client.

Frontend example usage

<audio controls> <source src="http://localhost:4000/speech/stream" type="audio/mpeg"/> Your browser does not support the audio element. </audio>

elevenlabs.DownloadAudio

DownloadAudio generates audio from text and saves the audio file as mp3 to disk.

Learn More

  • Encore Documentation
  • ElevenLabs Documentation