{"slug": "how-to-host-an-ai-podcast-platform-on-bluehost", "title": "How to Host an AI Podcast Platform on Bluehost", "summary": "A developer published a step-by-step guide for building a Flask web service that converts markdown podcast scripts into finished MP3 episodes using the ElevenLabs text-to-speech API and FFmpeg for audio concatenation, hosted on Bluehost. The service accepts a JSON payload with a script URL and intro/outro music URLs, then returns a downloadable episode ready for publishing.", "body_md": "Podcasting is exploding, but producing high‑quality audio still takes a lot of time and equipment. With modern text‑to‑speech (TTS) and voice‑cloning services you can turn a markdown script into a fully‑produced episode in minutes. In this guide we’ll walk through:\n\nBy the end you’ll have a tiny web service that accepts a podcast script (or a URL to a markdown file) and returns a downloadable MP3 ready for publishing.\n\n| Item | Reason | \n|---|---|\n| **ElevenLabs API key** – sign up at[https://try.elevenlabs.io/kr07zfuqn1bp](https://try.elevenlabs.io/kr07zfuqn1bp) | Gives you access to state‑of‑the‑art TTS and voice cloning. | \n| **Python 3.9+** | Core language for the demo. | \n| **Flask** (or FastAPI) | Minimal web framework to expose a REST endpoint. | \n| **FFmpeg** | Concatenates audio segments and normalises volume. | \n| **Bluehost account** – get one at[https://bluehost.sjv.io/5k0d52](https://bluehost.sjv.io/5k0d52) | Provides the cheap, easy‑to‑use hosting environment for our app. | \n| **Git** (optional) | For version control and quick deployment. | \n\nElevenLabs offers a straightforward REST API. Below is a minimal Python wrapper that sends a text payload and streams back an MP3 file.\n\n``` python\nimport os\nimport requests\n\nELEVEN_API_KEY = os.getenv(\"ELEVEN_API_KEY\")\nBASE_URL = \"https://api.elevenlabs.io/v1\"\n\ndef generate_speech(text: str, voice_id: str = \"default\") -> bytes:\n    \"\"\"\n    Calls ElevenLabs TTS and returns raw MP3 bytes.\n    \"\"\"\n    endpoint = f\"{BASE_URL}/text-to-speech/{voice_id}\"\n    headers = {\n        \"xi-api-key\": ELEVEN_API_KEY,\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"audio/mpeg\"\n    }\n    payload = {\n        \"text\": text,\n        \"model_id\": \"eleven_monolingual_v1\",\n        \"voice_settings\": {\"stability\": 0.75, \"similarity_boost\": 0.85}\n    }\n\n    response = requests.post(endpoint, json=payload, headers=headers)\n    response.raise_for_status()\n    return response.content\n```\n\n**Tip:** If you want a custom cloned voice, create it in the ElevenLabs dashboard and replace `voice_id` with the ID you receive.\n\nYou can test the function locally:\n\n``` python\nexport ELEVEN_API_KEY=your_key_here\npython - <<'PY'\nfrom __main__ import generate_speech\naudio = generate_speech(\"Hello, this is a test of ElevenLabs text‑to‑speech.\")\nopen(\"test.mp3\", \"wb\").write(audio)\nprint(\"Saved test.mp3\")\nPY\n```\n\nPlay `test.mp3` to hear the result. The quality is comparable to a human narrator, and the API is priced per character, making it cheap for short‑form podcasts.\n\nOur Flask app will accept a JSON payload like:\n\n```\n{\n  \"title\": \"AI Podcast 101\",\n  \"script_url\": \"https://example.com/episode1.md\",\n  \"intro_music_url\": \"https://example.com/intro.mp3\",\n  \"outro_music_url\": \"https://example.com/outro.mp3\"\n}\n```\n\nThe flow:\n\n`markdown2`).\n`generate_speech` for the main body.\n\n``` python\n# app.py\nimport os, subprocess, tempfile, requests, markdown2\nfrom flask import Flask, request, send_file, jsonify\n\napp = Flask(__name__)\n\nELEVEN_API_KEY = os.getenv(\"ELEVEN_API_KEY\")\nif not ELEVEN_API_KEY:\n    raise RuntimeError(\"Set ELEVEN_API_KEY env var\")\n\n# Re‑use the generate_speech function from earlier\nfrom __main__ import generate_speech  # assume same file for brevity\n\ndef download(url: str) -> bytes:\n    r = requests.get(url)\n    r.raise_for_status()\n    return r.content\n\ndef concat_audios(parts: list[bytes]) -> bytes:\n    \"\"\"\n    Takes a list of raw MP3 bytes, writes them to temp files,\n    and returns a single concatenated MP3 using ffmpeg.\n    \"\"\"\n    with tempfile.TemporaryDirectory() as td:\n        paths = []\n        for i, data in enumerate(parts):\n            p = os.path.join(td, f\"part{i}.mp3\")\n            open(p, \"wb\").write(data)\n            paths.append(p)\n\n        list_file = os.path.join(td, \"list.txt\")\n        open(list_file, \"w\").write(\"\\n\".join([f\"file '{p}'\" for p in paths]))\n\n        out_path = os.path.join(td, \"out.mp3\")\n        cmd = [\n            \"ffmpeg\", \"-y\", \"-f\", \"concat\", \"-safe\", \"0\",\n            \"-i\", list_file, \"-c\", \"copy\", out_path\n        ]\n        subprocess.run(cmd, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n        return open(out_path, \"rb\").read()\n\n@app.route(\"/generate\", methods=[\"POST\"])\ndef generate():\n    data = request.json\n    script_md = download(data[\"script_url\"]).decode()\n    script_text = markdown2.markdown(script_md, strip=True)  # strip HTML tags\n\n    # 1️⃣ Intro\n    intro = download(data[\"intro_music_url\"])\n    # 2️⃣ Main narration\n    narration = generate_speech(script_text)\n    # 3️⃣ Outro\n    outro = download(data[\"outro_music_url\"])\n\n    final_mp3 = concat_audios([intro, narration, outro])\n\n    return send_file(\n        io.BytesIO(final_mp3),\n        mimetype=\"audio/mpeg\",\n        as_attachment=True,\n        download_name=f\"{data['title']}.mp3\"\n    )\n\nif __name__ == \"__main__\":\n    app.run(host=\"0.0.0.0\", port=5000)\n```\n\n**Dependencies**\n\n```\npip install flask requests markdown2\n# ffmpeg must be installed on the system (apt-get install ffmpeg or brew install ffmpeg)\n```\n\nRun locally with `python app.py` and POST a JSON payload to `http://localhost:5000/generate`. You’ll receive a ready‑to‑publish MP3.\n\n`requirements.txt`, and maps a URL to a WSGI entry point.\nAll of this can be done without touching a VPS console, making Bluehost the easy, affordable way to spin up a voice‑AI service.\n\n`~/my-podcast`.\n`app.py`.\n`flask_app.wsgi` (Bluehost will generate it).\n\n```\n   Flask\n   requests\n   markdown2\npip install -r requirements.txt\n```\n\n`ffmpeg` via the package manager. If not, you can compile a static binary and place it in your app folder; the Flask code calls \n\n```\n   echo \"export ELEVEN_API_KEY=your_key_here\" >> ~/.bashrc\n   source ~/.bashrc\n```\n\n`https://yourdomain.com/generate`.\n\n```\ncurl -X POST https://yourdomain.com/generate \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n        \"title\": \"AI Podcast 101\",\n        \"script_url\": \"https://raw.githubusercontent.com/yourrepo/episode1.md\",\n        \"intro_music_url\": \"https://example.com/intro.mp3\",\n        \"outro_music_url\": \"https://example.com/outro.mp3\"\n      }' \\\n  --output episode1.mp3\n```\n\nIf the download succeeds, you’ve just built a fully‑hosted AI podcast generator with a few lines of code!\n\n`/voices` endpoint to upload a few minutes of your own voice and generate a custom `voice_id`.\nAll of these extensions sit on the same Flask base; you only need to add a few more routes or background workers.\n\nYou now have a practical, production‑ready pipeline:\n\nGive it a spin, tweak the voice settings, and start publishing AI‑generated episodes without ever stepping into a recording studio.\n\n**Ready to build?** Grab your ElevenLabs API key and a Bluehost account today, and watch your podcast ideas come to life in seconds. Happy coding!", "url": "https://wpnews.pro/news/how-to-host-an-ai-podcast-platform-on-bluehost", "canonical_source": "https://dev.to/voice_developer/how-to-host-an-ai-podcast-platform-on-bluehost-48ha", "published_at": "2026-10-07 23:27:03+00:00", "updated_at": "2026-10-07 23:46:48.124370+00:00", "lang": "en", "topics": ["ai-tools", "generative-ai", "developer-tools"], "entities": ["ElevenLabs", "Bluehost", "Flask", "FFmpeg", "Python"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/how-to-host-an-ai-podcast-platform-on-bluehost", "markdown": "https://wpnews.pro/news/how-to-host-an-ai-podcast-platform-on-bluehost.md", "text": "https://wpnews.pro/news/how-to-host-an-ai-podcast-platform-on-bluehost.txt", "jsonld": "https://wpnews.pro/news/how-to-host-an-ai-podcast-platform-on-bluehost.jsonld"}}