Set Up a Private AI Chatbot in 30 Minutes

By sanjeev

Sanjeev kumar

August 27, 2025

Published

LibreChatAIGoogle Gemini

Set Up a Private AI Chatbot in 30 Minutes

Remember that first blog about running your own private AI? I got a lot of messages asking "but don't I need to pay for API keys?"

No, you don't.

Today we're setting up LibreChat with Google's Gemini. It's free. No credit card needed. In 30 minutes, you'll have your own ChatGPT alternative running on your computer.

run_private_ai_hero_image.png

Why Google Gemini?

Simple reasons:

  • 2 million tokens free per month (that's about 1.5 million words)

  • No credit card required

  • It's actually good - competitive with GPT-5 for most tasks, plus it's much faster and cheaper

  • Works with images and documents

  • Available in most countries

What You Need

what_you_need_for_setup_librechat.png

Check you have these:

Installing Prerequisites

Docker Desktop:

Git (optional, for easier download):

  • Windows: Download from git-scm.com

  • Mac: Run xcode-select --install in terminal

  • Linux: Run sudo apt install git (Ubuntu/Debian) or sudo yum install git (RedHat/CentOS)

Text Editor (if you don't have one):

  • Windows: Notepad works, or download Notepad++

  • Mac: TextEdit works, or download VS Code

  • Linux: nano, vim, or download VS Code

Don't have Docker? Just download and install it like any other app. Make sure it's running before continuing.

Step 1: Get Your Gemini API Key

get_gemini_api_key.png

This takes 5 minutes:

  1. Go to aistudio.google.com

  2. Sign in with Google

  3. Click "Get API Key" on the left

  4. Click "Create API Key"

  5. Choose "Create API key in new project"

  6. Copy the key (looks like: AIzaSyD...)

Save this key. We need it soon.

Step 2: Download LibreChat

Open terminal (Command Prompt on Windows, Terminal on Mac/Linux):

git clone https://github.com/danny-avila/LibreChat.git
cd LibreChat

No git? Download the ZIP from github.com/danny-avila/LibreChat and extract it.

Step 3: Configure It

  1. Copy the example config:

cp .env.example .env
  1. Open .env in any text editor

  2. Find and update these lines:

# Enable Google and Uncomment these lines.
GOOGLE_MODELS=gemini-2.5-flash
GOOGLE_TITLE_MODEL=gemini-2.0-flash-lite-001

# Add your key
GOOGLE_KEY=your_key_here
  1. Change these security settings (generate random strings):

    Option A - Use a command:

    On Mac/Linux:

    openssl rand -hex 32
    

    On Windows (PowerShell):

    -join ((1..32) | ForEach {(65..90) + (97..122) + (48..57) | Get-Random | % {[char]$_}})
    

    Option B - Use a website:

    Go to randomkeygen.com and copy any string from "CodeIgniter Encryption Keys" section.

    Then update your .env:

    CREDS_KEY=paste_your_first_random_string_here
    JWT_SECRET=paste_your_second_random_string_here
    
  2. Save the file

Step 4: Start It

Run this command:

docker compose up -d

Wait 2-3 minutes. You'll see:

✔ Container LibreChat-mongodb  Started
✔ Container LibreChat-api       Started

Step 5: Use It

  1. Open browser, go to: http://localhost:3080

  2. Click "Sign up"

  3. Create account (email doesn't need to be real for local use)

  4. Log in

  5. Select "gemini-2.5-flash" from the model dropdown

  6. Type: "Hello, are you working?"

If you get a response, you're done. You have your own private AI.

Lock It Down

Do these security steps:

  1. In .env, disable new signups:

    ALLOW_REGISTRATION=false
    
  2. Restart LibreChat:

    docker compose restart
    

If Something Goes Wrong

Docker won't connect

  • Check Docker Desktop is running

Port 3080 in use

  • Change port in .env to 3081 or another number

API key invalid

  • Check you copied the whole key

  • Remove any spaces before/after

No models showing

  • Make sure GOOGLE_MODELS=gemini-2.5-flash is set and uncommented.

  • Restart with docker compose restart

What Now?

You have a private AI that:

  • Stores conversations locally

  • Works with files and images

  • Costs nothing

  • Runs on your computer

Try uploading an image and asking about it. Or paste a long document for summarizing.

Check Your Usage

Go to aistudio.google.com and click "API Keys" to see how many tokens you've used. At 2 million per month, you probably won't hit the limit.

Useful Commands

Stop LibreChat:

docker compose down

Start it again:

docker compose up -d

See logs if something's wrong:

docker compose logs

Next Steps

Now that LibreChat works, you can:

  • Add more AI providers later

  • Install local models with Ollama (next blog)

  • Set up team access

  • Customize it

But for now, you have a working private AI that costs nothing.

Get Help


Next: Running AI completely offline with Ollama. No internet, no API keys, just local models.

Share This Article

Share this post

Help others discover this content by sharing it with your network