Skip to content

About

Copy-paste LangChain init code for 4 free LLM APIs — no more digging through provider docs.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

⚡ Free API Keys Models

🚀 The fastest way to start building with free-tier LLM APIs using LangChain

Typing SVG



📓 Notebook • ⚡ Providers • 🚀 Quick Start • 🔑 API Keys • 🗺️ Roadmap


🧠 What Is This?

Free API Keys Models is a practical reference repository centered around one notebook:

models.ipynb

It contains the minimal initialization code for four LLM providers offering usable free API tiers, covering both chat models and embedding models where available.

No:

  • ❌ SDK hunting
  • ❌ complicated boilerplate
  • ❌ half-finished quickstarts
  • ❌ unnecessary abstractions
  • ❌ marketing filler

Just:

Provider
   ↓
Import
   ↓
Model class
   ↓
Model name
   ↓
API key
   ↓
model.invoke(...)

The goal is simple:

Pick a provider → copy the initialization → add your API key → start building.


✨ Why This Repository?

When experimenting with LLM applications, changing providers shouldn't mean rewriting your entire application.

This repository demonstrates how different providers can expose a consistent LangChain model interface:

┌──────────────────────────────────────────┐
│             Your AI Application          │
├──────────────────────────────────────────┤
│       Chains • Agents • RAG • Tools      │
├──────────────────────────────────────────┤
│              LangChain API               │
├──────────────────────────────────────────┤
│                                          │
│   Google   OpenRouter   Groq   Qwen      │
│                                          │
└──────────────────────────────────────────┘

Change the provider.

Your downstream LangChain code can remain essentially the same.


🧭 How It Works

flowchart LR
    A["📓 Open models.ipynb"] --> B["🔍 Choose Provider"]
    B --> C["📋 Copy Initialization"]
    C --> D["🔑 Add API Key"]
    D --> E["⚡ Create Model"]
    E --> F["🚀 model.invoke(...)"]
    F --> G["🤖 Build Chains / Agents / RAG"]

    style A fill:#111827,color:#fff
    style B fill:#1e293b,color:#fff
    style C fill:#334155,color:#fff
    style D fill:#7c3aed,color:#fff
    style E fill:#0369a1,color:#fff
    style F fill:#059669,color:#fff
    style G fill:#16a34a,color:#fff
Loading

The workflow

📓 Open notebook
      ↓
🔍 Pick provider
      ↓
📋 Copy code
      ↓
🔐 Configure .env
      ↓
⚡ Invoke model
      ↓
🤖 Build your application

⚡ Providers Covered

Provider Type Model Package / Client Connection
🔵 Google Chat gemini-3.8-flash langchain-google-genai Native
🔵 Google Embedding gemini-embedding-2 google-genai Native
🔀 OpenRouter Chat nvidia/nemotron-3-super-120b-a12b:free langchain-openai OpenAI-compatible
🔀 OpenRouter Embedding nvidia/nemotron-3-embed-1b:free requests REST API
⚡ Groq Chat openai/gpt-oss-120b langchain-groq Native
🌐 Qwen Chat qwen3.7-flash langchain-openai OpenAI-compatible

🔵 Google (Gemini)

Chat model
└── gemini-3.8-flash          (langchain-google-genai)

Embedding model
└── gemini-embedding-2        (google-genai)

Authentication
└── GOOGLE_API_KEY

Native Gemini integration for chat through LangChain, plus embeddings through the official Google GenAI client.


🔀 OpenRouter

Chat model
└── nvidia/nemotron-3-super-120b-a12b:free   (langchain-openai)

Embedding model
└── nvidia/nemotron-3-embed-1b:free          (requests)

Base URL
└── https://openrouter.ai/api/v1

Authentication
└── OPENROUTER_API_KEY

Highlight
└── 🔀 Access to free-tagged models

⚡ Groq

Model
└── openai/gpt-oss-120b

Package
└── langchain-groq

Authentication
└── GROQ_API_KEY

Highlight
└── ⚡ Extremely fast inference

🌐 Qwen — Alibaba DashScope Intl

Model
└── qwen3.7-flash

Package
└── langchain-openai

Protocol
└── OpenAI-compatible API

Base URL
└── https://dashscope-intl.aliyuncs.com/compatible-mode/v1

Authentication
└── QWEN_API_KEY

🛠️ Tech Stack



🚀 Quick Start

1️⃣ Clone the Repository

git clone https://github.com/SalikAhmad702/Free-API-Keys-Models.git

cd Free-API-Keys-Models

2️⃣ Create a Virtual Environment

Windows

python -m venv venv

venv\Scripts\activate

macOS / Linux

python -m venv venv

source venv/bin/activate

3️⃣ Install Dependencies

Using pip

pip install -r requirements.txt

Using uv ⚡

uv pip install -r requirements.txt

Install Individual Providers

If you only need one provider:

# Google (chat + embeddings)
uv pip install langchain-google-genai google-genai

# OpenRouter and Qwen (OpenAI-compatible) + embeddings via REST
uv pip install langchain-openai requests

# Groq
uv pip install langchain-groq

# Env loading
uv pip install python-dotenv

Each provider section inside the notebook also contains its corresponding uv pip install command.


🔐 Environment Configuration

Create your environment file:

cp .env.example .env

Then add the API keys for the providers you want to use.

GOOGLE_API_KEY=""
OPENROUTER_API_KEY=""
GROQ_API_KEY=""
QWEN_API_KEY=""

⚠️ Never commit your real .env file to GitHub.

Only configure the providers you actually plan to use.


📓 Launch the Notebook

jupyter notebook models.ipynb

Then:

📓 models.ipynb
       │
       ├── 🔵 Google (Chat + Embedding)
       ├── 🔀 OpenRouter (Chat + Embedding)
       ├── ⚡ Groq
       └── 🌐 Qwen

Choose a provider and run its self-contained code cell.


🧩 The Core Pattern

Every provider follows the same fundamental idea.

Example — Groq

from dotenv import load_dotenv
from langchain_groq import ChatGroq

load_dotenv()

model = ChatGroq(
    model="openai/gpt-oss-120b"
)

response = model.invoke(
    "Explain RAG in one sentence."
)

print(response.content)

The important part is the consistent interface:

model.invoke(...)

That means your application can continue using the same LangChain abstractions for:

                    ┌──────────────┐
                    │    Model     │
                    └──────┬───────┘
                           │
          ┌────────────────┼────────────────┐
          ↓                ↓                ↓
       Chains            Agents            RAG
          │                │                │
          └────────────────┼────────────────┘
                           ↓
                    AI Application

🌐 OpenAI-Compatible Providers

OpenRouter and Qwen use an OpenAI-compatible interface through ChatOpenAI.

from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
import os

load_dotenv()

model = ChatOpenAI(
    model="nvidia/nemotron-3-super-120b-a12b:free",
    base_url="https://openrouter.ai/api/v1",
    api_key=os.getenv("OPENROUTER_API_KEY"),
)
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
import os

load_dotenv()

model = ChatOpenAI(
    model="qwen3.7-flash",
    api_key=os.getenv("QWEN_API_KEY"),
    base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

The provider changes.

The rest of your LangChain architecture doesn't need to.


🧬 Embedding Models

The notebook also includes working embedding examples:

🔵 Google      → gemini-embedding-2                  (google-genai)
🔀 OpenRouter  → nvidia/nemotron-3-embed-1b:free     (REST via requests)

Each example prints the embedding dimensions and the first five values, so you can confirm your key and model are working before wiring them into a RAG pipeline.


🔄 Provider Swapping

Think of the model as a replaceable component:

                    YOUR APPLICATION
                           │
                           ▼
                  ┌─────────────────┐
                  │    LangChain    │
                  └────────┬────────┘
                           │
                    model.invoke()
                           │
        ┌──────────┬───────┴───┬──────────┐
        │          │           │          │
        ▼          ▼           ▼          ▼
     Google    OpenRouter     Groq       Qwen
        │          │           │          │
        └──────────┴───────┬───┴──────────┘
                           │
                    Same application

This makes experimentation much easier when testing different providers.


🔑 Where to Get Free API Keys

Provider Console
🔵 Google (AI Studio) aistudio.google.com/apikey
🔀 OpenRouter openrouter.ai/keys
⚡ Groq console.groq.com/keys
🌐 Qwen — DashScope Intl dashscope-intl.console.aliyun.com

Note: Free-tier availability, quotas, model access, and rate limits can change. Check each provider's current console before relying on a model in production.


📁 Repository Structure

Free-API-Keys-Models/
│
├── 📓 models.ipynb
│   └── Provider initialization examples
│
├── 🔐 .env.example
│   └── API key template
│
├── 📦 requirements.txt
│   └── Dependencies for all providers
│
└── 📖 README.md
    └── Project documentation

Notebook philosophy

One provider
     ↓
One markdown heading
     ↓
One self-contained code cell
     ↓
Copy → Paste → Run

🗺️ Roadmap

Current

  • 🔵 Google Gemini (chat + embeddings)
  • 🔀 OpenRouter (chat + embeddings)
  • ⚡ Groq
  • 🌐 Qwen

Planned

  • 🌊 Streaming response examples
  • ⚡ Latency benchmark
  • 🧠 Quality benchmark
  • 📊 Compare all four providers automatically

Future Vision

Free API Reference
       │
       ├── Providers
       ├── Models
       ├── Embeddings
       ├── Streaming
       ├── Structured Output
       ├── Tool Calling
       ├── RAG
       ├── Agents
       └── Benchmarks

🤝 Contributing

Found another provider with a real free tier?

Add it using the same philosophy:

1 Provider
1 Markdown section
1 Self-contained code cell
1 Clear model name

Create a branch

git checkout -b add/provider-name

Commit your changes

git commit -m "feat: add <provider> setup"

Push

git push origin add/provider-name

Then open a Pull Request.


⭐ Support the Project

If this repository saved you time searching through provider documentation:

⭐ Star the repository

🔁 Share it with another AI/ML developer

🛠️ Contribute another free-tier provider


👤 Author

Salik Ahmad

AI/ML Engineer

Typing SVG

Building agentic AI systems, RAG pipelines, and LLM-powered tools — one free API key at a time.


🚀 Build more. Pay less. Experiment faster.




© 2026 Salik Ahmad · AI/ML Engineer

About

Copy-paste LangChain init code for 4 free LLM APIs — no more digging through provider docs.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages