Gemini CLI: How To Get Started

pixegami · Intermediate ·🧠 Large Language Models ·11mo ago

Key Takeaways

The video demonstrates how to get started with Gemini CLI, a free and open-source AI agent from Google, and explores its features and example use cases.

Full Transcript

Welcome to this video where we're going to take a quick look at Gemini CLI. This is Google's newly releasleased AI agent. It is a generalpurpose AI agent that runs in your terminal and you can get it to code or work autonomously on your project for you doing things like fixing bugs, adding features, and even creating a pull request. And this does look like a direct competitor to Cloud Code, which I covered in last week's video. Uh but there's a couple of key differences. Gemini CLI has a free tier. It is open- source and of course it uses Google's own Gemini Pro model which has a 1 million token context window and that means that you can fit a lot more information and a lot more of your project code into its short-term memory. If you're not familiar with how tools like this work, uh then let me explain briefly. This is an AI agent that runs in your terminal and it's different from something like chat GPT or cursor which usually require you to be a little bit more hands-on and uh needs a bit more back and forth. Gemini CLI is more like a background process that you can occasionally supervise and guide. Here's an example. Here I have Gemini CLI open in my project directory which is just a simple React application and I'm asking it to analyze the project and implement a new feature documenting it along the way and then creating a pull request. It's going to try and do all of that for you and it will occasionally stop to ask for permission when it's trying to do something new. Once it gets going, you don't really have to do anything else. You could just leave the terminal open and watch as it does things like analyze the project, uh, create a new git branch for you and make the actual code changes. And sometimes this can run for several minutes because it's kind of strategizing, implementing, and then reviewing its work. Uh, trying to follow your overall instruction or plan that you gave it at the beginning. And after waiting for a few more minutes, this task is now done. Um, and I didn't really have to interact with it at all. The changes are documented in this file. Um, and it looks like it made a couple of database changes and also a couple of changes to the front end to implement our feature. And if I go to the GitHub page, I can also see that there is a new pull request here with all of these changes that I could just review and merge. So that is what a typical workflow could look like with Gemini CLI. Uh, now you could also connect this with external tools via something called MCP servers. Uh, and here I've connected it to GitHub, which is how it uh, created the pull request, but also Linear, which is a task tracking application. Uh, so you can get it to do things like updating your bug tickets or even closing them out as part of your workflow. Now, if you watched my previous video on cloud code, uh, then a lot of the stuff I'll be talking about today will sound very familiar to you, but I'll also highlight a couple of key differences along the way. In this video, I'm going to show you how to install and configure Gemini CLI and get it running on your machine. Then, we'll take a look at uh a couple examples of what you can do with it. Finally, I'll show you how to connect it to external tools like GitHub or Linear by using MCP. Now, keep in mind that this tool was only released a week ago as I'm making this video. Uh so, this is just an early first look. A lot of things could be added, fixed, or changed later down the line. But anyway, let's get started. To install Gemini CLI, you will need Node.js version 18 or higher. Then it's just this one command you can run to install it globally on your machine. Uh run this command and you'll be able to start Gemini CLI directly from your terminal. Once it's been installed, the typical workflow is that you'd navigate to your project directory, activate your virtual environment if you're using that, and then run this Gemini command. You should see a window like this pop up. Uh if you're not authenticated with Google or if you don't have an API key configured, then Gemini CLI might walk you through the authentication step, but you don't actually need an API key or a payment plan at this stage uh because you have access to the free tier. And once that's all set up, uh and you see this window, you could just use it by typing your command in here. And it can be whatever you want. You could say something like analyze this project and let it do its job. Or you can give it more specific instructions as well like analyze these files and then you can refer to specific files in your directory uh by using the at symbol uh and it will give you kind of an autocomplete where you can choose specific files that you want to talk about. And if you type slash uh you can also see some useful commands pop up. So these are things usually to do with configuration or uh doing things like clearing the chat history. That's pretty much it. There's nothing else too complicated you need to learn to get started with this. Um, once you see the screen, you're pretty much good to go. Now, with these AI agents, it's also pretty common to have a configuration file uh, which is essentially going to be a system prompt for your agent. The official Gemini documentation calls this the context file. You can put the instructions in here uh, that you want the agent to follow throughout the entire session. This file is named gemini.md. It's a markdown file and you can put this into the root directory of the project that you're working from. It's going to look there by default. But if you didn't want to create a different set of instructions for each project and you had a set of instructions that you wanted to apply globally, then you can create a context file at this home directory location instead. Uh there's also a hierarchical preference to these files. So if you have context files in both the global uh or they call it the user directory and one in your project directory then Gemini will try to use both but the instructions in the local scope will have a stronger influence and in the context file itself you could really just put whatever you want in natural language. For example here you could see some simple guidance on coding styles. What I recommend doing for this is to start off with an empty file and not to overthink it at the beginning. Then as you use Gemini CLI uh and run into behaviors that you wanted to change, that's when you can update the context file with the new guidance for that behavior. So now that we've set it up and know how to configure it, let me show you what a typical example workflow looks like in a little bit more detail. Let's start by going into a project and then running the Gemini command. Uh, and this is the same React app you saw earlier, which is basically just a simple to-do list application. Now, I actually haven't touched this project for a while. So, I can start by asking Gemini to summarize it for me and then writing uh those results into a file. Now, when it needs to do something new for the first time, it will ask me for permission. Um, so I can choose to allow it once or always allow similar types of actions. When that is done, I could see that it's created this project summary file for me. Now, what if I wanted to see its contents quickly? Um, I can use this exclamation mark symbol to turn this prompt into a shell mode. And what this will let me do is type a bash command that will bypass Gemini CLI and just run in my terminal. So I can run that command directly and I can see the contents of uh this project summary file just to check that it's done its job properly. Okay, so I think that looks pretty good and I'm going to use the contents of this file for my next task. I'm going to combine it with another capability that Gemini CLI has out of the box which is web search with Google. I'm going to ask it to read my project summary and then search the web for ideas and uh brainstorm 10 new features we can add to the app. And here you could see it's finished executing its task. First reading our project summary and then using Google search to research uh ideas for the app. If I like one of these ideas, I could just ask it to implement that. Now, if a feature is large or complex, uh you might need to guide it and help it debug a little bit. Uh and it can take a bit longer to complete. Uh but here's the result of that feature, which was to implement dark mode. And if I go to my app, I could see that uh dark mode has been implemented for this app. And there's a button I can use to toggle between light and dark modes. And once you're done with your session, you can press Ctrl + C to exit Gemini CLI. Uh, and it'll print out this really nice summary of the session, showing you the number of tokens used, uh, as well as the total duration of the session. So, this was a very simple workflow that I just showed you. And as you get more comfortable with what it can do, you might find a way to configure Gemini and your own project uh, to be able to do longer, more complex workflows autonomously without having to intervene as much. uh and these models are only going to get better and cheaper over time. So uh if you focus on making a workflow really good that works and is productive uh you basically get benefits for free as uh the model improves in the future. Now the final thing that I want to show you in this video is how to get Gemini to use external tools. This is pretty much done the same way as cloud code uh which is by using something called MCP or model context protocol. It's like a universal API uh for language models to use. Uh the instructions for how to set this up are actually a little bit hidden away inside the official Gemini CLI readme on its GitHub. And I also do expect that this experience will be uh easier to use quite soon uh because this is a very important part of using AI agents. But basically what you have to do is just open a configuration file and then configure your MCP servers via a JSON structure that looks like this. Now this is not the same as your context file that we saw in the earlier chapter. This is just a JSON setting file and it lives in this uh Gemini directory in your home directory. So this setting will apply globally to all of your sessions, but you could also choose to configure this at the project level. And then you simply configure the MCP server like this. Uh this is my configuration for linear, which is a popular task management application. Each MCP server is basically just a command uh in your shell environment that you want Gemini to run when it starts up along with the arguments you want to pass to that command. You can also pass in things like environment variables as part of the configuration. And there's more examples of different MCP server configurations inside the official uh Gemini CLI documentation on Google Cloud. And since this is a generic shell command, you can pretty much wire it up with anything, whether that's a local or remote MCP server. You just need to find the right command uh the right arguments and the right MCP endpoint for the tool that you want to connect it to. In my Gemini CLI, I've connected both GitHub and linear and I can see them uh by typing /mcp. This will list all of the MCP servers I have configured along with all the tools that are available on the server. So tools are basically like functions or operations. Now once an MCP server is configured, you don't have to do anything special to use it. Uh Gemini CLI should be able to figure that out just from your command. For example, let's ask it to list all of our issues uh from our linear application. And once that's done, I could see that Gemini CLI has found the issues from my linear app uh and is able to read them into here. Uh and just to show you, this is what it looks like in the app. So, it's pretty much seen all of these and pull them in here. And if I have a task that I want it to work on, for example, here a task to create a quick capture component, uh I could basically just tell it, okay, work on this task for this project. And after a while, it should be done. And then when I go back to my project, I can test uh the new feature it's added, which is this uh shortcut to open up a quick capture component if I want to quickly add a new task. Now, let's quickly review the cost of using this. Currently, at the time of release, uh Gemini does come with a pretty generous free tier, uh which gives you free access to Gemini 2.5 Pro, uh which is currently one of the best LLM models on the market right now. The free tier lets you use up to 60 requests per minute or up to 1,000 requests per day. Uh there's also optimization techniques you could use with your prompts and your projects uh that make that limit go further. But if you do hit that limit, uh you can of course just hook it up with an API key as well if you need it to go further. As for the LLM models themselves, you do get Gemini Pro by default, but I think that there's a mechanism that will uh downgrade to Gemini Flash after a while if you use it a lot. Uh I find that Flash is still a pretty good model though. Uh, but most reviews I've seen have said that it wasn't quite enough. So, this is something you might just have to try and uh see if it works for you. And one other unique thing about the Gemini models is that their context window is very big. It's currently 1 million tokens, which is five times larger than the window for the claude models. This means that a single invocation of a model can fit more of your text and your code. That doesn't automatically mean that you will get better outputs from this, though. It's really going to depend on how you can leverage that extra space. Uh you might not even need it at all. Now, as I mentioned before, this tool is still very new, so I'm probably going to spend the next couple of weeks learning it myself and vibe coding with it uh to see some of its more advanced features and see how far I can push them. Let me know your thoughts and experiences with Gemini CLI in the comments. Uh otherwise, I hope you found this useful and I'll see you in the next one.

Original Description

Gemini CLI is a free and open source AI agent from Google. It is a general purpose AI agent that runs from your terminal, and can autonomously work on your project for you. It is extremely powerful, it can connect to external tools via MCP, and it is free to use. But it is also new, so let's take a quick first look at how to use Gemini CLI, and some example use cases. 🔗 Gemini CLI: https://github.com/google-gemini/gemini-cli 🎥 Claude Code: https://youtu.be/9cM-0Jy0lJ0 📚 Chapters 00:00 What is Gemini CLI? 03:36 Setting Up Gemini CLI 05:05 Configuring GEMINI.md 06:27 Example Use Cases 09:32 Connecting External Tools 12:47 Pricing and Models #pixegami #ai
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from pixegami · pixegami · 0 of 60

← Previous Next →
1 How to Build an AWS Lambda Function in Python in Just 7 Minutes!
How to Build an AWS Lambda Function in Python in Just 7 Minutes!
pixegami
2 AWS CDK Tutorial: Deploy a Python Lambda Function using AWS
AWS CDK Tutorial: Deploy a Python Lambda Function using AWS
pixegami
3 I used GPT-3 to Write Poetry • Is AI the Future of Creative Writing?
I used GPT-3 to Write Poetry • Is AI the Future of Creative Writing?
pixegami
4 Create NFT Generative Art with Python! (Full Tutorial)
Create NFT Generative Art with Python! (Full Tutorial)
pixegami
5 Build an AI-driven SaaS Application: FULLSTACK Tutorial with Python, React, and AWS
Build an AI-driven SaaS Application: FULLSTACK Tutorial with Python, React, and AWS
pixegami
6 NextJS and TailwindCSS: How to Build a Portfolio Site from Scratch
NextJS and TailwindCSS: How to Build a Portfolio Site from Scratch
pixegami
7 Python Web Scraping Tutorial • Step by Step Beginner's Guide
Python Web Scraping Tutorial • Step by Step Beginner's Guide
pixegami
8 Build Wordle in Python • Word Game Python Project for Beginners
Build Wordle in Python • Word Game Python Project for Beginners
pixegami
9 How to create 1000+ unique NFT-style images (like Cryptopunk) | Python Tutorial
How to create 1000+ unique NFT-style images (like Cryptopunk) | Python Tutorial
pixegami
10 Top 10 Python Modules 2022
Top 10 Python Modules 2022
pixegami
11 How to Send SMS Text Messages with Python & Twilio - Quick and Simple!
How to Send SMS Text Messages with Python & Twilio - Quick and Simple!
pixegami
12 How To Write Unit Tests in Python • Pytest Tutorial
How To Write Unit Tests in Python • Pytest Tutorial
pixegami
13 How to Style Your React Landing Page with Tailwind CSS
How to Style Your React Landing Page with Tailwind CSS
pixegami
14 FastAPI Python Tutorial - Learn How to Build a REST API
FastAPI Python Tutorial - Learn How to Build a REST API
pixegami
15 How to Deploy FastAPI on AWS EC2: Quick and Easy Steps!
How to Deploy FastAPI on AWS EC2: Quick and Easy Steps!
pixegami
16 PyScript • How to run Python in a browser
PyScript • How to run Python in a browser
pixegami
17 My Custom Ubuntu Linux Terminal with Themes and Plug-ins 💻
My Custom Ubuntu Linux Terminal with Themes and Plug-ins 💻
pixegami
18 Deploy FastAPI on AWS Lambda ⚡ Serverless hosting!
Deploy FastAPI on AWS Lambda ⚡ Serverless hosting!
pixegami
19 NextJS Firebase Auth Tutorial • How to Authenticate Users for Your App
NextJS Firebase Auth Tutorial • How to Authenticate Users for Your App
pixegami
20 AWS Lambda Python functions with a database (DynamoDB)
AWS Lambda Python functions with a database (DynamoDB)
pixegami
21 How To Build a CRUD (TO-DO) App on AWS using FastAPI and Python
How To Build a CRUD (TO-DO) App on AWS using FastAPI and Python
pixegami
22 How to Make a Discord Bot with Python
How to Make a Discord Bot with Python
pixegami
23 How To Use GitHub Copilot (with Python Examples)
How To Use GitHub Copilot (with Python Examples)
pixegami
24 PyTest • REST API Integration Testing with Python
PyTest • REST API Integration Testing with Python
pixegami
25 Python Beginner Project: Build a Caesar Cipher Encryption App
Python Beginner Project: Build a Caesar Cipher Encryption App
pixegami
26 Decorators in Python: How to Write Your Own Custom Decorators
Decorators in Python: How to Write Your Own Custom Decorators
pixegami
27 NextJS 13 Tutorial: Create a Static Blog from Markdown Files
NextJS 13 Tutorial: Create a Static Blog from Markdown Files
pixegami
28 Exploring ChatGPT for Coding and Business ✨ 8 Real Examples!
Exploring ChatGPT for Coding and Business ✨ 8 Real Examples!
pixegami
29 How I Would Learn Python (if I had to start over) • A Roadmap for 2023
How I Would Learn Python (if I had to start over) • A Roadmap for 2023
pixegami
30 Build an AI Pokemon Generator with Python and Midjourney
Build an AI Pokemon Generator with Python and Midjourney
pixegami
31 Why You Should Learn Python in 2023 (as your first programming language)
Why You Should Learn Python in 2023 (as your first programming language)
pixegami
32 ChatGPI API in Python ✨ How to Build a Custom AI Chat App
ChatGPI API in Python ✨ How to Build a Custom AI Chat App
pixegami
33 Learn Python • #1 Installation and Setup • Get Started With Python!
Learn Python • #1 Installation and Setup • Get Started With Python!
pixegami
34 Learn Python • #2 Variables and Data Types • Python's Building Blocks
Learn Python • #2 Variables and Data Types • Python's Building Blocks
pixegami
35 Learn Python • #3 Operators • Add, Subtract and More...
Learn Python • #3 Operators • Add, Subtract and More...
pixegami
36 Learn Python • #4 Conditions • If / Else Statements
Learn Python • #4 Conditions • If / Else Statements
pixegami
37 Learn Python • #5 Lists • Storing Collections of Data
Learn Python • #5 Lists • Storing Collections of Data
pixegami
38 Learn Python • #6 Loops • How to Repeat Code Execution
Learn Python • #6 Loops • How to Repeat Code Execution
pixegami
39 Learn Python • #7 Dictionaries • The Most Useful Data Structure?
Learn Python • #7 Dictionaries • The Most Useful Data Structure?
pixegami
40 Learn Python • #8 Tuples and Sets • More Ways To Store Data!
Learn Python • #8 Tuples and Sets • More Ways To Store Data!
pixegami
41 Learn Python • #9 Functions • Python's Most Important Concept?
Learn Python • #9 Functions • Python's Most Important Concept?
pixegami
42 Learn Python • #10 User Input • 4 Ways To Get Input From Your User
Learn Python • #10 User Input • 4 Ways To Get Input From Your User
pixegami
43 Learn Python • #11 Classes • Create and Use Classes in Python
Learn Python • #11 Classes • Create and Use Classes in Python
pixegami
44 Learn Python • #12 Final Project • Build an Expense Tracking App!
Learn Python • #12 Final Project • Build an Expense Tracking App!
pixegami
45 Stripe & Firebase Tutorial • Add Payments To Your NextJS App
Stripe & Firebase Tutorial • Add Payments To Your NextJS App
pixegami
46 How To Use GitHub Actions • Automate Your AWS Deployments
How To Use GitHub Actions • Automate Your AWS Deployments
pixegami
47 How to Run a Python Docker Image on AWS Lambda
How to Run a Python Docker Image on AWS Lambda
pixegami
48 My MacOS Terminal Setup for HIGH Productivity
My MacOS Terminal Setup for HIGH Productivity
pixegami
49 Host a Python Discord Bot on AWS Lambda (Free and Easy)
Host a Python Discord Bot on AWS Lambda (Free and Easy)
pixegami
50 Python FastAPI Tutorial: Build a REST API in 15 Minutes
Python FastAPI Tutorial: Build a REST API in 15 Minutes
pixegami
51 Pydantic Tutorial • Solving Python's Biggest Problem
Pydantic Tutorial • Solving Python's Biggest Problem
pixegami
52 How to Get Started with AWS • Crash Course
How to Get Started with AWS • Crash Course
pixegami
53 Python Requests Tutorial: HTTP Requests and Web Scraping
Python Requests Tutorial: HTTP Requests and Web Scraping
pixegami
54 Amazon Bedrock Tutorial: Generative AI on AWS
Amazon Bedrock Tutorial: Generative AI on AWS
pixegami
55 How to Publish a Python Package to PyPI (pip)
How to Publish a Python Package to PyPI (pip)
pixegami
56 Langchain: The BEST Library For Building AI Apps In Python?
Langchain: The BEST Library For Building AI Apps In Python?
pixegami
57 RAG + Langchain Python Project: Easy AI/Chat For Your Docs
RAG + Langchain Python Project: Easy AI/Chat For Your Docs
pixegami
58 Python Dataclasses: Here's 7 Ways It Will Improve Your Code
Python Dataclasses: Here's 7 Ways It Will Improve Your Code
pixegami
59 Build a Custom AI RPG Game with OpenAI GPTs
Build a Custom AI RPG Game with OpenAI GPTs
pixegami
60 Create a Custom AI Assistant + API in 10 Mins
Create a Custom AI Assistant + API in 10 Mins
pixegami

This video teaches how to get started with Gemini CLI, a powerful AI agent that can autonomously work on projects, and explores its features and example use cases. Gemini CLI is a free and open-source tool that can connect to external tools via MCP. By following this video, viewers can learn how to set up and use Gemini CLI, and discover its potential applications.

Key Takeaways
  1. Install Gemini CLI
  2. Configure GEMINI.md
  3. Explore example use cases
  4. Connect external tools via MCP
  5. Set up autonomous project work
💡 Gemini CLI is a highly customizable and extensible AI agent that can be used for a wide range of applications, from automating tasks to integrating with external tools.

Related AI Lessons

Chapters (6)

What is Gemini CLI?
3:36 Setting Up Gemini CLI
5:05 Configuring GEMINI.md
6:27 Example Use Cases
9:32 Connecting External Tools
12:47 Pricing and Models
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →