Transcription
Hi everyone, welcome back to the AI language. So today I'm going to look at Gemini's command line interface. This is an opensource AI agent that's interfaced with your terminal. So you can actually write commands to the Gemini CLI agent through your terminal. And this, as the name suggests, works with the Gemini model, specifically the Gemini 2.5 Pro model on the back end.
As an individual developer, all you need is a Google account and they give you a pretty good free limit which we are going to look at later on. And once you have this, you can work with files in your system, code that is present in your system or generally with it as an AI agent through your command line interface. Uh the command line interface would entail working with it on something like PowerShell or command prompt on a Windows machine or a terminal on a Linux or a MacBook.
All right. So now let's talk about the limits that are available as of now. So it's available free of charge with 60 model requests per minute which is pretty high. And Gemini CLA claims that this is the industry's largest usage allowance at 60 models requ 60 model requests per minute and 1,000 model requests per day. And it's open source. So open source basically means that you can actually go to GitHub and you can have the source code for this Gemini CLA application and uh if you want that you can actually search for Gemini CLI GitHub and you land on this page Google Gemini Gemini CLI and this is an open source AI agent. So this means that actually you can take this code and extend it according to what's allowed in this Apache 2.0 license.
So we're going to go back to look at the application that Google has built which is a Gemini CLI opensource application that's available and let's work with that. So I'm going to look at what Gemini CLI is and what are the free limits available with it for us to use as individual developers, how you can set this up on your own computer and what are the typical use cases that you might use it for. So you can search for Gemini CLI and it'll take you to this blog which basically announces the launch of CLI and introduces it and there are some benefits that they're pointing out over here. So this is opensource and it has some free uses limits for individual developers with you know no cost. It works with Gemini 2.5 Pro and Gemini models are known for their large context window. And with all this and Google's backing, it might become a very good competitor to coding agents that we have seen before and also as a generic agent that works directly from your computer, from your command line. So you don't have to open a browser or VS code or anything else to work with it. So in short, Gemini CLI is an agent with a lightweight interface that works directly out of your terminal and it can help you work with code, local files and also as a generic agent.
All right. So some of the advantages of this is that you have Google search built in. So you can ground your prompts with Google search and it can fetch web pages and provide real-time external context to the model. There's a built-in support for model context protocol. So you can extend the Gemini CLI's capabilities using that. You can also customize prompts and instructions to tailor Gemini for specific needs and workflow. And you can automate tasks and integrate with existing workflows by invoking the Gemini CLI non-interactively within your scripts as well. And as it shows over here, you know, you can extend it with other tools to actually make images or videos apart from working with your code and your system files or as a generic agent.
So here's the note about it being open and extensible by Google's blog. Gemini CLA is fully open source Apache 2.0. So you can inspect the code to understand how it works, verify its security implications and uh you can contribute to this project by reporting bugs or suggesting features etc. And it's extensible based on uh existing standards like MCP and system prompts via gemini.md and settings for both personal and team configuration as well. So it looks like a pretty well-rounded product in this sense on being open and extensible.
And now one more point is about Gemini code assist which is Google's AI coding assistant which works inside Visual Studio Code. So Gemini code assist now shares the same technology with Gemini CLI and you can work with this in VS code as well using agent mode and once you do that it'll actually work on writing your test cases. It might be helpful in fixing bugs or creating other code files.
All right. And then you can actually get started by clicking on the try it now button over here. And you come to Gemini CLI. And if you go down, you can actually see the quick start over here. So the prerequisites are that you need NodeJS version 18 or higher installed. So what we can do is we can go to the terminal and type node- version. So I already have version 22.5 installed and uh if you don't have this installed you can actually go on this particular link over here and you get instructions for how to install it over here. So you also have a Mac OS installer over here and you can actually change your OS by clicking Windows or anything else and you get PowerShell commands for Windows to install it. This is how you can install NodeJS for Gemini CLI.
All right and then we can run the CLI. So we execute the following command in the terminal and just to clarify this is going to run the command line interface. To install it we need to use the npm install command. So I'm going to directly install it and because we want to use it more than once. Let's go back to our terminal and paste it over here and press enter. So if you have run this before using npx you'll directly get this screen with Gemini over here. Before installing this I already ran this once using npx. So I already did the setup steps during that process which are retained for the installation over here it seems. So I'm going to show you the run that I did with npx just to show you the setup steps involved. And let's go to over here and type npx and we have the GitHub Google Gemini CLI link over here. So I'm going to allow it to proceed. It's going to ask permissions for a certain number of files over here. And I think this is probably because of the integration it wants to help you with all these files. So just think of what you would want it to work with and click on allow or don't allow based on that.
All right. So after you are done with the permissions, you'll get this page to select a theme. So I'm going to use the default dark theme. You can actually choose different themes from here. So now it asks us to select the authentication method. So you have the option to login with your Google account and that's going to give you the free limits that we saw earlier which is 60 requests per minute and 1,000 per day. And uh the other option is using your Gemini API key. So we have already used the Gemini API key a lot of times from um Google's AI studio and that's helpful for invoking the Gemini model through command line interface and so on. So I'm actually going to stick with the Gemini API key because that's what I have been using and I'll see what the free limit with this is as I go along. This will also help us extend the usage beyond the free limit if we need to by setting up billing on the Google cloud platform and associating that API key or using an API key associated with that billing account. So I'm going to use that. You might go ahead with uh login with Google if you wish to. Let's press enter.
So to set our environment variable, what we'll do is we'll open a new terminal window. And you might or might not have av file over here. So we'll create that now. So we'll write nano and then env. And make sure that you are in your home folder over here and press enter. And over here we'll add our gemini_appi_key and press equal to. And just paste your key over here. To get the key just go to your browser and go to a studio.google.com. Click on get API key and you can click on create API key on the top over here if you not already created it. If you have created it, you'll see your keys over here. So I can just click this and then copy the key. And now go back to your terminal and paste the key over here. Make sure that you don't push this key to any GitHub repo or it's not visible to other people because it's a private key that is linked to your account.
All right. So I've added it now and let's press enter and see if this works. All right. So now it's detected that uh there's a type your message or add the rate of path to file and it says that you are using Gemini 2.5 Pro 100% context left and there's one error and you can press Ctrl + O to check that. So let's check that. All right. So there's some kind of scan directory SIS call with a path to the trash directory which is leading to some kind of error. So I can press Ctrl S for more details. All right. So it's not getting the folder structure for the trash directory for the npm npx directory and so on. So I just press escape. All right. So let's maximize this once uh to see this entirely. So you have the Gemini logo over here and there are some tips for getting started. So you ask questions, edit files or run commands. And uh it says be specific for the best results and create gemini.md files to customize your interaction with Gemini and /help for more information. Now you can actually quit this by pressing Ctrl C once and then it'll ask you to press it again and you can press that twice in succession to quit it. You get a summary like this which is cumulative stats. And if you installed it using npm install, you can just simply type Gemini again to start it. Now since we have used the Gemini key o it automatically detects the env file in the home folder and asks us to write a message over here.
All right. So now let's test out some use cases for this. How does it work and how it can help us. So first I'm going to make a directory for Gemini CLI. So I'm going to say yes always allow MKDIR. All right. So it has created that directory for me and I stopped it from initializing a npm project because this is an agent. It probably for some reason thinks that I want a npm project over here based on the mkdr command that I gave it. So I'm just going to go to a plain old terminal to make the directories that I want. So let's change to the Gemini CLI directory that it made. Now the first use case that I'm going towards is to actually set up a new project. So let me try to make a landing page uh with login information like let's say phone and OTP based authentication and sign in with Google and let me ask Gemini CLI to make it for me. So I'm going to create a directory for that. So let me call that version one login page and then let's change to that directory and then I'm just going to simply start Gemini over here.
All right. So I have Gemini started over here. I can close the older window. Let's press Ctrl C twice to exit this and let's close this down. All right. Now, let me ask it to create a project for me with a simple landing page uh which is a login page with Google sign in and phone OTP based o. I'm going to ask for can you build a login page with Google signin and phone OTP o in this directory and tell me how to run it. Let's press enter. All right. So let me go up. Uh it's given me some plan and of course I will build a login page with Google sign in phonep O. Here's my plan. There's a text stack with HTML CSS and JS and then there's a proposed structure and then authentication flow and phone. Does this plan sound good to you? So I'm going to say yes. I'll say yes. Please go ahead. All right. So it it's asking permission for write file writing to package.json. So I'm going to just say yes allow always and press enter because we do expect the agent to do a lot of file IO operations. So I'm just going to allow it for always. So I can see that it is written approximately 13 lines to package.json and also to server.js JS approximately around 112 or 13 lines over here 122 lines over here and now it's saying it it's implementing the authentication logic and then I'll create the index html file for the front end. So let's wait for this to complete.
Okay. So it says I've created all the necessary files. Now we'll install the dependencies. This command will install express and body parser as defined in package.json. So I I'm going to always allow npm. All right. So it says dependencies are installed and now you can start the application. How to run the application? Start the server. So this npm start and then open your browser and navigate to this particular web page. Okay. And there's a Google signin setup that it has done, but it will not work out of the box, of course, because uh we need to set up everything on Google's back end as well. So, we're just going to ahead uh we're just going to go ahead and test it for now. So, let me type npm start. I think this is going to go to the backend uh agent API and then it says shell npm starting the NodeJS server and then launching the application. So, I'm going to just go to the browser and I have visited localhost 3000 and I see that there is a login option with sign in with Google and a 10digit phone number. So, let me just try something over here. Let's click on send OTP. And now you have a button to verify your OTP over here. And if you click on sign in with Google, I get this page which is access blocked authorization error. the oath client was not found. So this is because we have not set up anything on the back end for Google which is uh completely reasonable. So we can close this and uh what we can see with this is that it gives us a much more functional application than uh you know standalone website builders because it has linked the actions on the back end. It has linked the dependencies, installed them for us, set up the files etc. which is much more than what you would do on an online tool and then copy paste or you know pull those uh files out from there to set it up locally.
The second application that I'm going to try out is for it to explain an existing project to me. So let's press Ctrl C twice to exit this. Let's change to our A2S samples directory. Let's start Gemini over here and let's try to ask it to explain this project to us. So can you explain? So I'll say can you explain the project to me its architecture and purpose? All right, just trying to read the readme.md file and trying to understand what this is about. And then it gives me this response. So this is a collection of sample implementations for Google's agent to agent protocol and its purpose is to demonstrate how to build and orchestrate AI agents that can communicate with each other using a standardized framework. And there are multiple versions over here. And it gives me an an information about one or twoline information about each of these versions. And in essence, it serves as a learning resource and a set of reference implementations for building sophisticated interoperable AI agents. So that's pretty good. That works well.
All right. So now let's try to do some image operations with this. So let's go back to the Gemini CLI directory that we made and let's make a directory called version 2 images and let's change to this directory and let's bring up Gemini over here and let's see if it can create an image for us. So create an image and save it in this directory. The image should represent an old desktop computer from the early 1990s or maybe the late 1980s. Let's press enter. All right. So we can see that the image generation does not happen natively on the Gemini CLI and you need some external tools like image gen or VO for that for videos and uh some backend setup including cloud storage etc. So we're going to skip this for now and move ahead with the other aspects.
For now, let's also check Gemini code assist because this is integrated within Visual Studio Code and might be uh more userfriendly to use compared to what we see in uh the Gemini CLI. So, let's uh go to code assist.google and click on use in Visual Studio Code. So, there's a plug-in for this which is Gemini code assist. So, let me copy this and actually directly search for it in code. All right. So, I've opened one of my A2A samples project in VS Code. Let's go to extensions and search for our code assist extension. Let's press enter. Okay. So, it already gives me Gemini code assist over here. Let me select this. And this is the google.com extension. It already has close to a million downloads. Let's click on install. I'm going to select trust publisher and install over here. So once this is installed, you'll get a get started with Gemini code assist over here. So the way to work with this is to use command plus I to transform your code and execute your own commands and then you can select commands in your code and get them treated as prompts in the editor and you press control + enter to generate that code or you can click the Gemini logo over here in the activity bar to use Gemini code assist chat and ask questions about and improve your code and you can add files, folders and tools to your chat context. And then you can add custom rules to enhance chat responses.
All right. So to begin testing this, I'm going to click on the Google Gemini button over here. And it's going to start the Google Gemini code assist over here. Let me click on sign in. And I'm going to open this external website. All right. So once you sign in, you're going to see a chat like this. And uh it shows a context item over here which is uh the current file. So you have you have the current file over here. So what I can do is I can select this line over here and press command I and then I can say explain this and then I can press send over here. So it's actually going to now explain what this line means over here. So it explains what send message request is. It explains what params equal to this does. This initializes the params attributes of the send message request and um then it explains message send params. Actually, I can zoom out to show you how all this is structured. So, with this chat over here, you're actually able to work with a file at a time or you know a few lines of code over here.
And how you can extend this is with agent mode. So, agent mode is not enabled by default. So, there should be a toggle over here for agent mode. And uh to do that, I actually searched for it online. You can search for Gemini code assist enable agent mode and go to this particular link from Google which is use agentic chat as a pair programmer and over here it gives some information about how agent mode works the agent mode memory etc how you can check the memory and and so on and uh over here there's a before you begin section so what we need to do is that we need to first set up Gemini code assist in our ID so I have already done that using my own Gmail account and then we need to set up Gemini code assist channel to the insiders build. So what I'll do is I'll uh follow these steps over here. So I'll go to the command pallet, open the user settings JSON and then paste this over here. So let me copy this. All right. So we press command shiftp for the command panel and then we just search for user settings JSON over here. Then we just paste this particular setting Gemini code assist.update update channel as insiders and we can just close this over here. All right. And what we can do now is that we can actually close this particular window for VS code. Exit it completely by hitting quit and then we can you can reopen VS code from here. All right. And let's click on the Gemini code assist over here. It's starting up. And now you can see that we can open uh the code assist by using the code assist icon over here. And you can see the agent mode toggle is now on. So you can actually turn it on or turn it off and so on. Right? And uh the agent mode can actually help you work with entire projects.
Now since this is an existing project, I'll just shift to a new folder. So I'll click a new click on open new window. So I'm going to open a new folder for the Gemini CLA that I made when working with the CLI and let's click on open. So now I have two folders over here. So now I have the version one login page that I had created earlier. Now let me try Gemini's code assist over here and let me ask it to make a version two. So let's say this. So I've asked it to create a version two of the login page with Google signin and phone OTP based authentication. Generate requirements for typical login page before making it. Create a new folder version two with an appropriate name and put all the code inside it. So let's click send over here. All right. And now you can see that it's working on it. Let me actually zoom out a bit to see the working over here very clearly. All right. So it asks me to confirm whether I can run this. So let's click on run. It has created the directory version 2 login page Google OTP. And uh then it's allowing me to accept a file, right? So I'm going to accept it. And it's asking me to create a index.html file. And while working on a production codebase, you would actually want to look at the changes it's doing before just accepting that. For now, I'm just accepting it more or less blindly because uh it's a new code that it's writing and I just want it to give me some code to begin with. All right. So it says that the basic structure of the new login page is ready. I've created the necessary files and installed the dependencies. But there are some things that are missing. So you'll need to replace the placeholder values for Twilio and Google credentials server.js. So these are of course some settings that one has to do because it depends upon uh Google O for login and uh there's some incomplete logics. The actual logic for handling email password login and OTP verification is not completed. So that's completely fine. All right.
Right. So let me go to version two login page Google OTP. Let me click on index.html and click on show in browser. And you can see that it has designed a pretty good page over here with different buttons but does not look very well. Of course we could actually you know do many more iterations on this and make it look better than what it looks like now. So still a lot of things to look at on Gemini CLI, Gemini code assist and Gemini code assist agent mode. But we have looked at these three elements today. So, how to set up Gemini CLI, how to set up Gemini code assist in Visual Studio Code, and also how to turn on agent mode on Gemini Google Code Assist. And as you can see, the Gemini CLI and the Gemini code assist agent mode both use a similar agent. As per Google, they use the same agent technology from the back end and they can work with many number of files and you know make different files and folders for you and set up full projects. Whereas the code assist is without the agent mode is more or less just a simple code assist something like what we have seen with copilot that it can actually read context limited to a few files or one file at a time and one or two lines and then work with that based on the command I logic that we saw. There are of course other features that we have not looked at but this was supposed to be a basic introduction on how to set up these three things and get started with it. I hope you enjoyed the video and I'll see you the next time.