How to Deploy a Voice AI Web App: ElevenLabs + WordPress on Bluehost
Introduction If you’ve been tinkering with voice AI lately, you probably already know how powerful a realistic text‑to‑speech (TTS) engine can be. Whether you’re building a chatbot, creating audio‑enabled content, or e
Introduction
If you’ve been tinkering with voice AI lately, you probably already know how powerful a realistic text‑to‑speech (TTS) engine can be. Whether you’re building a chatbot, creating audio‑enabled content, or experimenting with voice cloning, the key is to get the voice model into a web‑app that’s fast, reliable, and easy to host. In this post, I’ll walk you through a practical workflow that combines ElevenLabs—the industry‑leading TTS platform—with WordPress on Bluehost for a quick, affordable deployment. By the end, you’ll have a fully functional voice AI web app running on a WordPress site that you can share with friends, clients, or your own audience.
TL;DR
- Sign up for ElevenLabs (use the affiliate link for a free tier).
- Create a simple Node.js/JavaScript front‑end that calls the ElevenLabs API.
- Host the site on a WordPress installation on Bluehost (also via the affiliate link).
- Embed the audio player in a WordPress post/page and you’re done.
Let’s dive in.
1. Get Your ElevenLabs API Key
ElevenLabs offers an intuitive REST API that turns plain text into high‑quality speech. The first step is to create an account and grab your API key.
- Click the affiliate link: https://try.elevenlabs.io/kr07zfuqn1bp
- Sign up and verify your email.
- In the dashboard, find your API key under Settings → API Key.
Tip: The free tier gives you a generous quota for experimentation. If you need more requests or higher‑quality voices, you can upgrade later without changing any code.
2. Build a Tiny Voice App
Below is a minimal example that uses vanilla JavaScript to call ElevenLabs and stream the resulting audio. Feel free to adapt it to any front‑end framework (React, Vue, etc.) or server‑side language.
2.1 HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ElevenLabs Voice Demo</title>
</head>
<body>
<h1>Speak with ElevenLabs</h1>
<textarea id="text" rows="5" cols="60" placeholder="Type something..."></textarea><br>
<button id="speak">Speak</button>
<audio id="audio" controls></audio>
<script src="app.js"></script>
</body>
</html>
2.2 JavaScript (app.js)
const apiKey = 'YOUR_ELEVENLABS_API_KEY';
const voiceId = 'EXAMPLE_VOICE_ID'; // Pick a voice from your dashboard
document.getElementById('speak').addEventListener('click', async () => {
const text = document.getElementById('text').value.trim();
if (!text) return alert('Please enter some text.');
const response = await fetch('https://api.elevenlabs.io/v1/text-to-speech/' + voiceId, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'xi-api-key': apiKey
},
body: JSON.stringify({
text,
voice_settings: { stability: 0.75, similarity_boost: 0.75 }
})
});
if (!response.ok) throw new Error('API error');
const blob = await response.blob();
const audioUrl = URL.createObjectURL(blob);
document.getElementById('audio').src = audioUrl;
});
What’s happening?
- The user types text.
- On button click, we POST the text to ElevenLabs’ endpoint.
- The API streams back an MP3 blob, which we convert to a URL and set as the
<audio>source.
You can host this folder (index.html + app.js) on any static hosting solution, but for this tutorial we’ll push it into a WordPress site on Bluehost.
3. Set Up WordPress on Bluehost
Bluehost is a popular choice for beginners and power users alike. It offers a one‑click WordPress installation, free SSL, and affordable plans that are perfect for hosting a voice‑AI demo. Here’s the quick win:
- Sign up at https://bluehost.sjv.io/5k0d52
- Choose a plan (the “Basic” tier is more than enough for a demo).
- During setup, select Install WordPress automatically.
- Once installed, log in to your WordPress dashboard.
3.1 Create a Page for Your App
- In the admin panel, go to Pages → Add New.
- Title it “Voice Demo” (or anything you like).
- Switch to the Text editor (HTML view) and paste the HTML from the previous section.
- Add the JavaScript code as an inline
<script>block or host it in a separate file under your theme’sjsfolder.
Pro tip: If you prefer to keep the script separate, upload
app.jstowp-content/themes/your-theme/js/and enqueue it viafunctions.php:
function enqueue_voice_app() {
wp_enqueue_script('voice-app', get_stylesheet_directory_uri() . '/js/app.js', [], null, true);
}
add_action('wp_enqueue_scripts', 'enqueue_voice_app');
3.2 Secure Your API Key
Never expose your ElevenLabs API key in the front end. Instead, use a simple server‑side proxy.
// In functions.php or a custom plugin
add_action('wp_ajax_nopriv_tts_proxy', 'tts_proxy');
add_action('wp_ajax_tts_proxy', 'tts_proxy');
function tts_proxy() {
$text = sanitize_text_field($_POST['text']);
$apiKey = 'YOUR_ELEVENLABS_API_KEY';
$voiceId = 'EXAMPLE_VOICE_ID';
$response = wp_remote_post("https://api.elevenlabs.io/v1/text-to-speech/{$voiceId}", [
'headers' => [
'Content-Type' => 'application/json',
'xi-api-key' => $apiKey,
],
'body' => wp_json_encode(['text' => $text]),
]);
if (is_wp_error($response)) {
wp_send_json_error($response->get_error_message());
} else {
header('Content-Type: audio/mpeg');
echo wp_remote_retrieve_body($response);
exit;
}
}
Then, modify the JavaScript to POST to /wp-admin/admin-ajax.php?action=tts_proxy instead of the ElevenLabs endpoint. This keeps your key hidden.
4. Deploying and Scaling
Once the page is live, you can:
-
Add more voices by updating the
voiceIdin your script or backend proxy. - Add a voice‑cloning feature by allowing users to upload a sample audio file and calling ElevenLabs’ voice cloning endpoint.
- Integrate with WooCommerce if you’re selling custom voices.
- Use WP‑CLI to automate updates or backups.
Bluehost’s managed WordPress hosting makes scaling painless: upgrade your plan, enable caching plugins, and you’re good to go.
5. Troubleshooting Checklist
| Issue | Fix |
|---|---|
| Audio doesn’t play | Check browser console for CORS errors. Ensure the API key is correct. |
| API request fails | Verify that your ElevenLabs account is active and you’re within quota. |
| Page loads slowly | Enable a caching plugin (e.g., WP‑Super‑Cache) and serve static assets from a CDN. |
| API key exposed | Use the server‑side proxy method described above. |
6. Final Thoughts
You now have a fully functional voice AI web app powered by ElevenLabs and running on a WordPress site hosted by Bluehost. The setup is lightweight, secure, and scalable—ideal for prototypes, demos, or even a small commercial product.
Ready to take it to production?
- Sign up for ElevenLabs via https://try.elevenlabs.io/kr07zfuqn1bp to unlock premium voices and higher request limits.
- Deploy your WordPress site on Bluehost using https://bluehost.sjv.io/5k0d52 for an easy, affordable hosting solution that’s ready for traffic.
Happy coding, and may your voices always sound crystal clear!
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.