Getting API Keys

Gemini API Key Setup (Google Generative AI)

To use Gemini Pro models (by Google) via LangChain or the direct API, you need to get a Gemini API key from Google’s MakerSuite platform. Here’s how to do that:

Step-by-Step Guide to Get Gemini API Key

Step 1: Visit MakerSuite

LangChain-API-Keys

Step 2: Log in with Google Account

  Use your Google account to sign in.
•  If you don’t have one, create a new account.

LangChain-Login-with-google

Step 3: Generate a New API Key

  Click on “Create API key”.
•  Copy the generated key. (Keep it private.)

LangChain-Create-Api-kye
Generated key shown in a dialog box like:

Step 4: Store API Key Securely Using .env

Create a .env file in your project directory:
LangChain-store-
LangChain-Store-API-Keys

Step 5: Load API Key in Python

Install python-dotenv (if not already):
Python Code to Load API Key:
LangChain-Python-code

Alternative models (Hugging Face, LLaMA)

Not limited to Gemini — you can also use other open models.

Hugging Face Transformers:

LangChain-Hugging

Example code:

LLaMA (Meta AI):

  Available on Hugging Face.
  Large models need GPU setup and advanced configuration.

You may need:

Why This Setup is Important

It helps you:

✅ Avoid version conflicts
✅ Store and use API keys securely
✅ Focus on coding — not debugging setup errors
✅ Work with LangChain, Gemini, Hugging Face, etc.

You’re Now Ready to Code!

By completing this setup:

🟢 You’re in a clean virtual environment
🟢 Core libraries are installed
🟢 Gemini API key is ready
🟢 You can build AI projects using LangChain + DRF

Course Video in English