Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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 LangChain initialization code for five LLM providers offering usable free API tiers.

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               │
├──────────────────────────────────────────┤
│                                          │
│  Mistral   Groq   OpenRouter   Qwen      │
│                       │          │       │
│                   Ollama Cloud           │
│                                          │
└──────────────────────────────────────────┘

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 Model LangChain Package Connection
🌬️ Mistral AI mistral-medium-latest langchain-mistralai Native
Groq llama-3.3-70b-versatile langchain-groq Native
🔀 OpenRouter google/gemma-4-31b-it:free langchain-openrouter Native
🌐 Qwen qwen-turbo langchain-openai OpenAI-compatible
🦙 Ollama Cloud gpt-oss:20b langchain-openai OpenAI-compatible

🌬️ Mistral AI

Model
└── mistral-medium-latest

Package
└── langchain-mistralai

Authentication
└── Native API key

A straightforward LangChain integration using Mistral's native package.


⚡ Groq

Model
└── llama-3.3-70b-versatile

Package
└── langchain-groq

Authentication
└── Native API key

Highlight
└── ⚡ Extremely fast inference

🔀 OpenRouter

Model
└── google/gemma-4-31b-it:free

Package
└── langchain-openrouter

Authentication
└── Native API key

Highlight
└── 🔀 Access to free-tagged models

🌐 Qwen — Alibaba DashScope Intl

Model
└── qwen-turbo

Package
└── langchain-openai

Protocol
└── OpenAI-compatible API

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

🦙 Ollama Cloud

Model
└── gpt-oss:20b

Package
└── langchain-openai

Protocol
└── OpenAI-compatible API

🛠️ 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:

uv pip install langchain-mistralai
uv pip install langchain-groq
uv pip install langchain-openrouter
uv pip install langchain-openai

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.

MISTRAL_API_KEY=your_key_here
GROQ_API_KEY=your_key_here
OPENROUTER_API_KEY=your_key_here
QWEN_API_KEY=your_key_here
OLLAMA_API_KEY=your_key_here

⚠️ 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
       │
       ├── 🌬️ Mistral
       ├── ⚡ Groq
       ├── 🔀 OpenRouter
       ├── 🌐 Qwen
       └── 🦙 Ollama Cloud

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


🧩 The Core Pattern

Every provider follows the same fundamental idea.

Example — Groq

from langchain_groq import ChatGroq

model = ChatGroq(
    model="llama-3.3-70b-versatile"
)

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

Qwen and Ollama Cloud use an OpenAI-compatible interface.

For example:

from langchain_openai import ChatOpenAI
import os

model = ChatOpenAI(
    model="qwen-turbo",
    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.


🔄 Provider Swapping

Think of the model as a replaceable component:

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

This makes experimentation much easier when testing different providers.


🔑 Where to Get Free API Keys

Provider Console
🌬️ Mistral AI console.mistral.ai
⚡ Groq console.groq.com/keys
🔀 OpenRouter openrouter.ai/keys
🌐 Qwen — DashScope Intl dashscope-intl.console.aliyun.com
🦙 Ollama Cloud ollama.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

  • 🌬️ Mistral AI
  • ⚡ Groq
  • 🔀 OpenRouter
  • 🌐 Qwen
  • 🦙 Ollama Cloud

Planned

  • 🔵 Google Gemini free tier
  • 🌊 Streaming response examples
  • ⚡ Latency benchmark
  • 🧠 Quality benchmark
  • 📊 Compare all five providers automatically

Future Vision

Free API Reference
       │
       ├── Providers
       ├── Models
       ├── 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 5 free LLM APIs — no more digging through provider docs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages