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.
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.
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
📓 Open notebook
↓
🔍 Pick provider
↓
📋 Copy code
↓
🔐 Configure .env
↓
⚡ Invoke model
↓
🤖 Build your application
| 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 |
Model
└── mistral-medium-latest
Package
└── langchain-mistralai
Authentication
└── Native API key
A straightforward LangChain integration using Mistral's native package.
Model
└── llama-3.3-70b-versatile
Package
└── langchain-groq
Authentication
└── Native API key
Highlight
└── ⚡ Extremely fast inference
Model
└── google/gemma-4-31b-it:free
Package
└── langchain-openrouter
Authentication
└── Native API key
Highlight
└── 🔀 Access to free-tagged models
Model
└── qwen-turbo
Package
└── langchain-openai
Protocol
└── OpenAI-compatible API
Base URL
└── https://dashscope-intl.aliyuncs.com/compatible-mode/v1
Model
└── gpt-oss:20b
Package
└── langchain-openai
Protocol
└── OpenAI-compatible API
git clone https://github.com/SalikAhmad702/Free-API-Keys-Models.git
cd Free-API-Keys-Modelspython -m venv venv
venv\Scripts\activatepython -m venv venv
source venv/bin/activatepip install -r requirements.txtuv pip install -r requirements.txtIf you only need one provider:
uv pip install langchain-mistralai
uv pip install langchain-groq
uv pip install langchain-openrouter
uv pip install langchain-openaiEach provider section inside the notebook also contains its corresponding uv pip install command.
Create your environment file:
cp .env.example .envThen 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.envfile to GitHub.
Only configure the providers you actually plan to use.
jupyter notebook models.ipynbThen:
📓 models.ipynb
│
├── 🌬️ Mistral
├── ⚡ Groq
├── 🔀 OpenRouter
├── 🌐 Qwen
└── 🦙 Ollama Cloud
Choose a provider and run its self-contained code cell.
Every provider follows the same fundamental idea.
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
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.
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.
| 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.
Free-API-Keys-Models/
│
├── 📓 models.ipynb
│ └── Provider initialization examples
│
├── 🔐 .env.example
│ └── API key template
│
├── 📦 requirements.txt
│ └── Dependencies for all providers
│
└── 📖 README.md
└── Project documentation
One provider
↓
One markdown heading
↓
One self-contained code cell
↓
Copy → Paste → Run
- 🌬️ Mistral AI
- ⚡ Groq
- 🔀 OpenRouter
- 🌐 Qwen
- 🦙 Ollama Cloud
- 🔵 Google Gemini free tier
- 🌊 Streaming response examples
- ⚡ Latency benchmark
- 🧠 Quality benchmark
- 📊 Compare all five providers automatically
Free API Reference
│
├── Providers
├── Models
├── Streaming
├── Structured Output
├── Tool Calling
├── RAG
├── Agents
└── Benchmarks
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
git checkout -b add/provider-namegit commit -m "feat: add <provider> setup"git push origin add/provider-nameThen open a Pull Request.
If this repository saved you time searching through provider documentation: