Voice to Voice ChatGPT on Your Phone (Easy)

This YouTube tutorial (part 3 of a mini-series) by IGOR (Sensei Igor) demonstrates how to build a voice chatbot that runs inside Telegram on a phone. The video provides a beginner-friendly, step-by-step walkthrough: download the four code files from GitHub, install dependencies via requirements.txt (gTTS, moviepy, numpy, elevenlabs, OpenAI, python-telegram-bot), paste OpenAI and Telegram Bot API keys, and run the script. Two implementations are shown: a free version using Google Text-to-Speech (low-cost, lower quality) and a higher-quality version using the 11 Labs API (free trial, paid thereafter). The host demos both Google TTS and 11 Labs voices, shows where to add the 11 Labs API key and choose voices, and briefly mentions hosting, customization, and the creator's AI Advantage Agency services.
Chapters
I'm very excited about this one because today we'll be making a chatbot on your phone that you can talk into. And it actually talks back. That is Sensei Igor for you.
Apologies, Sensei Igor. I will make sure to address you correctly in the future.
And the best part is this is actually very easy to build, even for beginners. I'll be holding your hand for the entire process, step by step, as we first build a version that is completely free. And in the second version, we'll use the 11 Labs API, giving you a chatbot voice that sounds like a real human.
Greetings, my beloved master. As requested, I will gladly provide you with an essay about penguins.
But look, everything covered in this video is extremely beginner friendly, which means it's not all it could be, right? If you happen to need a custom chatbot or you want to make your company more efficient by implementing AI. Well, here for the first time, I'm announcing the AI Advantage Agency. Me and my team are already helping businesses implement AI, build chatbots, and so much more. So check it out under the following link. And now back to the video. And again, all of this has been prepared to be extremely beginner friendly. But what this is is part three of my mini series that I released on my YouTube for free. So if you're completely new to this, you have to watch those two videos because we'll be building upon that knowledge and the steps we did in those two tutorials. They too are extremely beginner friendly and they cover most of what we need here. Because first of all, we need an IDE, which you set up in the first episode. Secondly, you need your OpenAI API key which I showed you how to get in the first episode. That couldn't be any simpler. And thirdly, we'll need the Telegram bot, to which I introduced to in the second episod. Because again, this easy to build chatbot will be based within Telegram. You'll be speaking to it. Why do you call me Master? It will be speaking back to you.
I apologize if using the term master.
And all inside of an app that all of us can get on our phones. The only thing that is new here is the code for today's video. As per usual, you can download that from the description below or copy that from my GitHub if you're more advanced. And these are the four files in there. So the first one is the old code from the second video that we'll be building up on. Secondly, we'll be building a free version of this chatbot with the Google Text Display speech integration, which is completely free and gives the chatbot the ability to talk back to you. And thirdly, we'll be using 11Labs API because their voices actually sound like real humans. There is a free trial, but if you want to keep using it, that will cost some money. So first things first, as in previous tutorials, I will just grab this folder and drag it onto Visual Studio code. Alright, and here are the files we need. But as the very first step, we want to install all these requirements because that will make sure we have all the packages we need moving forward and we don't need to install them one by one while moving through this. A very brief overview here would be that this is the Google Text to Speech, which allows us to transform text into speech for free. Moviepie allows us to work with audio files inside of our little scripts here so that the chatbot can understand the voice notes we record. Numpy is a library that is required for the 11 labs library to work. And the 11 labs library is the one that will give us those realistic human like voices that we're looking for here. And then these two are kind of obvious. OpenAI allows us to interact with ChatGPT and Python. Telegram Bot allows us to code a Telegram bot from within here that works easily on any phone. All right, enough talking, let's start doing following. Go to terminal, new terminal. And inside of here you need to run one command to install all of this at once on Mac, that is pip free install R requirements txt as that is the file. And by hitting enter, I will install all of these packages onto my computer. Looking good. If you're Windows, you can run the same command just without the free. So it's PIP install r requirements txt. And with that we're all set up, which makes us ready to dive into the code which will make the magic happen. And as you can see, I did include the old code that we're building on top of here for learning purposes, as I find this extremely useful. Then you can switch back and forth and see what's changed with the new chatbot. But again, even this old code was super simple. You bring in all the packages that make all this happen, then you link your accounts with the API keys. This part includes ChatGPT and here we integrate it into Telegram. This function makes the voice input into the Telegram bot happen. And last but not least, this bottom part launches the Telegram bot and keeps it running while we keep the script running. And by opening up the 01 GTTS, which stands for Google Text to Speech. We are ready to take this a step further and allow the bot to talk back to us. And as you might have already noticed, there is no new API key, and that is because this service is completely free. You can use it as often as you want. It's not very high quality, but it will speak to you and it costs no money, so it's perfect to experiment with. So first things first. I'll copy paste my OpenAI API key into here. Now we're linked to ChatGPT. Secondly, we'll paste our Telegram API token that we got from the botfather, just like I showed you in the last video. And guess what? That is kind of it. We're ready to go. And this would already work because I provided you with the code here. I'll just briefly point out that this is where most of the magic happens, where it takes the text response, saves it as an MP3, and then sends it back to the Telegram bot, taking the ChatGPT answer and presenting it to you through the voice that Google Text to Speech creates here and then down here. It's the same thing. All we need to do now is press play like so, and the script is running and all of a sudden our bot inside of Telegram should be able to respond with voice messages. Let's test it out. So what we're going to do here is just press start. So once we start this brand new bot, we can record a voice message into it. Write me an essay about penguins, as per usual. And there we go. It shows us I've received the voice message. Please wait. And it also shows my input. Write me an essay about penguins. Now all we have to do is wait for a few seconds. There we go, a full ChatGPT answer. And as you can see up here we have the voice reply. So if I hit play on this.
Penguins. These flightless birds belong to the family Sphenocidae and live in the Southern hemisphere sphere, mainly in Antarctica, though they can also be found in South Africa.
Okay, so now we're about to look at the most exciting part of this entire tutorial, because here we're going to be getting a realistic voice. Greetings, my beloved master, from a site called 11 Labs. And using that with our script. So the phone is going to talk back in a realistic human like sounding voice. Okay? And all this is made possible by this company called 11 Labs, which has these voices that are incredibly realistic. Just check this out for a second. So I'll just fill this out and here you can pick the voice. So we'll Just pick the default one and say generate.
Hey there, how are you doing, Igor? This is a little too good to be real.
Do you hear that? Let's listen to that again.
Hey there, how are you doing, Igor? This is a little too good to be real.
And as I said, you can change this to Arnold. Let's just try that out. Say generate.
Hey there, how are you doing, Igor? This is a little too good to be real.
Okay, so we're going to be using this for our app. How do we do that? Well, as you might have guessed, we need an API key which you can simply get by going up here profile and then you can copy your API key which we'll be using in the script 0211 Labs chatbot. So just open that up and we'll be inserting the 11 Labs API key right here. And that is essentially it. Guys, look, we actually made this happen. This would already work, but let me spend a few seconds explaining what's going on here. Roughly, just like before, we have a little bit of code that extends this and makes 11 labs work in here. So as you can see in both the text message and the voice message function, we have a few new lines down here that make 11 labs work. It links it to the API key and you actually get to pick the voice in here too. And that is hidden up here. So you can see the voice equals user, get voices by name. And here you can pick it. So on the website you will be able to test it and go through all the various voices. And once you find one that you like, you can copy the exact name that you see here and update your little script by changing this out to, let's say, Arnold. And there you go. That's really it. If you want to understand this more in depth, you can go over to their API reference to get a developer documentation. So also that link I'll include below. But here you can go in and look into the entire implementation. I won't be going for every single line in here. Plus we've been copying over the stuff from before that has already been explained. So with all that being said and this thing being set up, we can go ahead and test this. So as you can see, we have the same role as before, where the helpful assistant is going to be calling us master every time. And let's just try it out. I'll hit play up here. And because we inside all the packages at the beginning, including 11 labs, remember when we ran the requirements, we installed elevenlabs lib. Now we're going to put it to work by saying, terminal, new terminal. And then let's hit play. And it should be running. So now all I need to do is pull up my phone, open up telegram, go into my voice bots, and now I can record a voice message and I should get one back. So let's try this out. Write me an essay about penguins. So now we should see a transcription. Write me an essay about penguins. And now, as per usual, we need to wait for a little bit while GPT processes this and 11 labs generates the voice. But in a few seconds here, we should get an answer. And there you go. As you can see, we got the GPT reply here. And above we have the voice message that we can now play.
Greetings, my beloved master. As requested, I will gladly provide you with an essay about penguins.
Isn't that just incredible? And that's really how simple it is. All you got to do is keep this running on your computer, because this script makes it work. Yes, you could alternatively host it, but that goes way beyond the scope of this tutorial. I'll include a link in the description that shows you that too, but this is essentially it. You can adjust the name, you can adjust the system message, and at the very least, you have the ultimate party trick in your pocket. Chatgpt that you can talk to. It speaks back in any voice you pick. And as previously mentioned, you could go even further with this. You can teach it on specific data or give it a very specific role, so it can help any business function even smoother. Additionally, you can automate away a bunch of processes. And now we offer all those services through the AI Advantage Agency. You can find more details on all that under this link. And again, if you haven't seen the first two episodes that explain the step by step to a complete beginner, then check out this playlist with all the videos in this series on how to build your very own chatbot by yourself without any coding knowledge, with required. Why do you call me Master?
I apologize if using the term Master has caused any confusion or discomfort. Master is just one of many possible terms we can use and is often used as a sign of respect and formality.
From here on out, call me Sensei.
Understood, Sensei. From now on, I will refer to you as Sensei.
That is Sensei Igor for you.
Apologies, Sensei Igor. I will make sure to address you correctly in the future. How may I be of service?
It works.










