LlamaIndex માટે મફત LLM
LlamaIndex પાસે OpenAI-compatible APIs માટે બે classes છે: chat માટે OpenAILike અને embeddings માટે OpenAILikeEmbedding. આ માર્ગદર્શિકા બંનેને FreeLLMAPI તરફ દિશા આપે છે, જે એક key પાછળ 45 મફત પ્રદાતા ટિયર એકત્રિત કરે છે. તમે retrieval-augmented generation (RAG) index બનાવો છો, તેને query કરો છો અને agent ઉમેરો છો. કોડ rate limits સંભાળે છે.
કોડ, મૉડેલ નામ અને લાઇવ કૅટલૉગ લેબલ અંગ્રેજીમાં બતાવવામાં આવે છે.
packages ઇન્સ્ટોલ કરો
FreeLLMAPI ઇન્સ્ટોલ કરો અને ડેશબોર્ડના Keys પેજ પર બે કે વધુ પ્રદાતાઓની મફત keys ઉમેરો. unified key કૉપી કરો. પછી LlamaIndex packages ઇન્સ્ટોલ કરો.
ઇન્સ્ટોલ
curl -fsSL https://freellmapi.co/install.sh | bash
pip install -U llama-index-core \
llama-index-llms-openai-like \
llama-index-embeddings-openai-like
export FREELLMAPI_BASE_URL=http://localhost:3001/v1
export FREELLMAPI_API_KEY=<unified-key>સાદો OpenAI class, જે llama-index-llms-openai માંથી આવે છે, એવા મોડેલ નામ સાથે વાપરશો નહીં, જે OpenAI જાણતું નથી. તે class મોડેલ નામ અને context size ને OpenAI મોડેલની યાદી સામે તપાસે છે. OpenAILike આવું કરતું નથી, તેથી આ મૂલ્યો તમે જાતે સેટ કરો છો.
LLM અને embedding મોડેલ ગોઠવો
settings.py
import os
from llama_index.core import Settings
from llama_index.llms.openai_like import OpenAILike
from llama_index.embeddings.openai_like import OpenAILikeEmbedding
BASE = os.environ["FREELLMAPI_BASE_URL"]
KEY = os.environ["FREELLMAPI_API_KEY"]
Settings.llm = OpenAILike(
model="auto",
api_base=BASE,
api_key=KEY,
is_chat_model=True, # use /v1/chat/completions
is_function_calling_model=True, # needed for FunctionAgent
context_window=32000, # the smallest window in your chain
max_retries=5,
timeout=90,
)
Settings.embed_model = OpenAILikeEmbedding(
model_name="bge-m3", # one family, 1024 dimensions
api_base=BASE,
api_key=KEY,
embed_batch_size=16,
max_retries=10,
)- is_chat_model=True: તે વગર LlamaIndex વિનંતી જૂના completions endpoint પર મોકલે છે.
- context_window: LlamaIndex આ મૂલ્ય વાપરીને નક્કી કરે છે કે prompt માં કેટલા મેળવેલા chunks બેસે.
autoસાથે રાઉટર જુદા મોડેલ પસંદ કરી શકે છે. તમારી chain માં સૌથી નાની context window વાપરો. - is_function_calling_model=True: ફક્ત ત્યારે સેટ કરો જ્યારે તમારી chain માં tool-calling મોડેલ હોય.
- embed_batch_size: દરેક batch એક વિનંતી છે. મોટા batch દર મિનિટે ઓછી વિનંતી વાપરે છે.
RAG prompt માં ઘણા મેળવેલા chunks હોય છે, તેથી chat મોડેલને તેમના માટે જગ્યા જોઈએ. RAG માટે લાંબા context વાળા મોડેલ સાથે fallback chain profile બનાવો. પછી model="auto:<profile>" સેટ કરો અને context_window ને તે profile ની સૌથી નાની window પર વધારો. આજે આ મફત મોડેલોની context window સૌથી મોટી છે:
| મૉડેલ | મફત ઉપલબ્ધ | સંદર્ભ | મફત મર્યાદા (શ્રેષ્ઠ ઑફર) | સાધનો | વિઝન |
|---|---|---|---|---|---|
| OpenAI: GPT-6 Luna | ElectronHub | 1.1M | $0.25/week shared free credits | ના | ના |
| Gemini 3.8 Flash | APINex, Google AI Studio | 1M | 5 વિનંતી/મિનિટ 10M weighted tokens/day shared across APINex free routes; 3x token multiplier; 5 requests/minute/account | હા | હા |
| Gemini 3.7 Flash | Google AI Studio | 1M | 10 વિનંતી/મિનિટ 20 વિનંતી/દિવસ 250,000 ટોકન/મિનિટ ~3M | હા | હા |
| DeepSeek V4 Flash | AMD Radeon Cloud, BazaarLink, ElectronHub | 1M | 10 વિનંતી/મિનિટ 50 વિનંતી/દિવસ Shared rate limit | હા | ના |
| DeepSeek V4 Flash 0731 | ElectronHub, Router9 | 1M | 10,000 credits/month (~$1), shared; account-anniversary reset | ના | ના |
| Gemini 3.6 Flash | Google AI Studio | 1M | 10 વિનંતી/મિનિટ 20 વિનંતી/દિવસ 250,000 ટોકન/મિનિટ ~3M | હા | હા |
| GLM-5.2 | ModelScope, Router9 | 1M | 100 વિનંતી/દિવસ Daily login: 200 credits + 50 for linked Alibaba Cloud; 24h expiry; shared; noncommercial experience | ના | ના |
| Gemini 3.5 Flash | Google AI Studio | 1M | 10 વિનંતી/મિનિટ 20 વિનંતી/દિવસ 250,000 ટોકન/મિનિટ ~3M | હા | હા |
મેળ ખાતા 115 મફત મૉડેલમાંથી 8 બતાવ્યા. બધા મૉડેલ જુઓ.
FreeLLMAPI કૅટલૉગનો લાઇવ ડેટા (સંસ્કરણ 2026.11.19, તપાસ્યું 2026-11-19). મફત મર્યાદાઓ વારંવાર બદલાય છે. કૅટલૉગ દરરોજ તપાસવામાં આવે છે.
એક વપરાશકર્તાને એક મોડેલ પર રાખવા X-Session-Id header મોકલો. OpenAILike default_headers સ્વીકારે છે, ઉદાહરણ તરીકે default_headers={"X-Session-Id": "user-42"}. FreeLLMAPI session ને 30 મિનિટ સુધી એક જ મોડેલ પર રાખે છે. આથી એક chat માં જવાબ એક જ શૈલીમાં મળે છે.
RAG index બનાવો અને query કરો
script ફોલ્ડરમાંથી ફાઇલ વાંચે છે, embeddings બનાવે છે, index સાચવે છે અને સવાલનો જવાબ આપે છે. index બનાવવા એક વાર ચલાવો. પછીના રન સાચવેલો index લોડ કરે છે અને ફાઇલને ફરી embed કરતા નથી.
rag.py
import os
import settings # noqa: F401 (sets Settings.llm and Settings.embed_model)
from llama_index.core import (
SimpleDirectoryReader,
StorageContext,
VectorStoreIndex,
load_index_from_storage,
)
PERSIST = "./storage"
def load_index() -> VectorStoreIndex:
if os.path.isdir(PERSIST):
return load_index_from_storage(StorageContext.from_defaults(persist_dir=PERSIST))
docs = SimpleDirectoryReader("./docs").load_data()
index = VectorStoreIndex.from_documents(docs, show_progress=True)
index.storage_context.persist(persist_dir=PERSIST)
return index
if __name__ == "__main__":
query_engine = load_index().as_query_engine(similarity_top_k=4, streaming=True)
response = query_engine.query("How do I rotate the API keys?")
response.print_response_stream()
for node in response.source_nodes:
print("\nSource:", node.metadata.get("file_name"), round(node.score or 0, 3))./storage કાઢી નાખો અને index ફરી બનાવો.આજની catalog માં આ embedding મોડેલ મફત છે. dimensions કૉલમ દરેક family નું vector કદ બતાવે છે.
| મૉડેલ | પ્રદાતા | પરિમાણો | મહત્તમ ઇનપુટ | મફત મર્યાદા |
|---|---|---|---|---|
Gemini Embeddinggemini-embedding-001 | Google AI Studio | 3072 | 2048 | 100 rpm · 1K req/day |
Nemotron Embed VL 1Bnvidia/llama-nemotron-embed-vl-1b-v2 | NVIDIA NIM | 2048 | 8192 | ~40 rpm |
Nemotron 3 Embed 1B (OR free)nvidia/nemotron-3-embed-1b:free | OpenRouter | 2048 | 32768 | 20 rpm · shared free daily cap |
SEA-LION E5 Embedding 600Maisingapore/SEA-LION-E5-Embedding-600M | SEA-LION | 1024 | 8192 | free · 10 rpm |
SEA-LION ModernBERT Embedding 300Maisingapore/SEA-LION-ModernBERT-Embedding-300M | SEA-LION | 1024 | 8192 | free · 10 rpm |
SEA-LION ModernBERT Embedding 600Maisingapore/SEA-LION-ModernBERT-Embedding-600M | SEA-LION | 1024 | 8192 | free · 10 rpm |
BGE-M3@cf/baai/bge-m3 | Cloudflare Workers AI | 1024 | 8192 | 10K neurons/day (shared) |
EmbeddingGemma 300M@cf/google/embeddinggemma-300m | Cloudflare Workers AI | 768 | 2048 | 10K neurons/day (shared) |
Qwen3 Embedding 0.6B@cf/qwen/qwen3-embedding-0.6b | Cloudflare Workers AI | 1024 | 8192 | 10K neurons/day (shared) |
Cohere Embed v4embed-v4.0 | Cohere | 1536 | 128000 | 1K calls/mo (shared w/ chat) |
Gemini Embedding 2gemini-embedding-2 | Google AI Studio | 3072 | 8192 | free-tier rate limited |
Nemotron 3 Embed 1Bnvidia/nemotron-3-embed-1b | NVIDIA NIM | 2048 | 4096 | ~40 rpm |
PLaMo Embedding 1B (CF)@cf/pfnet/plamo-embedding-1b | Cloudflare Workers AI | 2048 | 4096 | 10K neurons/day (shared) |
BGE Small EN v1.5 (CF)@cf/baai/bge-small-en-v1.5 | Cloudflare Workers AI | 384 | 512 | 10K neurons/day (shared) |
BGE Base EN v1.5 (CF)@cf/baai/bge-base-en-v1.5 | Cloudflare Workers AI | 768 | 512 | 10K neurons/day (shared) |
BGE Large EN v1.5 (CF)@cf/baai/bge-large-en-v1.5 | Cloudflare Workers AI | 1024 | 512 | 10K neurons/day (shared) |
Mistral Embedmistral-embed | Mistral | 1024 | 8192 | free mode · monthly cap (shared) |
Codestral Embedcodestral-embed | Mistral | 1536 | 8192 | free mode · monthly cap (shared) |
Llama Text Embed v2 (Pinecone)llama-text-embed-v2 | Pinecone | 1024 | 2048 | 5M tokens/mo per model |
Multilingual E5 Large (Pinecone)multilingual-e5-large | Pinecone | 1024 | 507 | 5M tokens/mo per model |
Nemotron 3 Embed 1B (Speka)nvidia/nemotron-3-embed-1b | Speka | 2048 | 8192 | $1/month shared across Speka models |
OpenAI: Text Embedding 3 Small (ElectronHub)text-embedding-3-small | ElectronHub | 1536 | 8192 | $0.25/week shared free credits |
OpenAI: Text Embedding 3 Large (ElectronHub)text-embedding-3-large | ElectronHub | 3072 | 8192 | $0.25/week shared free credits |
Nemotron 3 Embed 8B (Inferbase)nvidia-nemotron-3-embed-8b | Inferbase | 4096 | 8192 | 5,000 requests/month; 100 requests and $0.50 usage/day shared |
Qwen 3 Embedding 0.6B (Inferbase)qwen3-embedding-0-6b | Inferbase | 1024 | 8192 | 5,000 requests/month; 100 requests and $0.50 usage/day shared |
Qwen 3 Embedding 4B (Inferbase)qwen3-embedding-4b | Inferbase | 2560 | 8192 | 5,000 requests/month; 100 requests and $0.50 usage/day shared |
Qwen 3 Embedding 8B (Inferbase)qwen3-embedding-8b | Inferbase | 4096 | 8192 | 5,000 requests/month; 100 requests and $0.50 usage/day shared |
LFM2.5 Embedding 350M (LLMTR)liquid/lfm-2.5-embedding-350m-free | LLMTR | 1024 | 512 | Ongoing zero-price route; provider terms apply |
BGE-M3 (SEA-LION)BAAI/bge-m3 | SEA-LION | 1024 | 8192 | free · 10 rpm |
Cohere Embed English v3embed-english-v3.0 | Cohere | 1024 | 512 | 1K calls/mo (shared w/ chat) |
Qwen3 Embedding 8B (OVH)Qwen3-Embedding-8B | OVH AI Endpoints | 4096 | 32768 | free · anonymous 2 req/min per IP |
BGE-M3 (OVH)bge-m3 | OVH AI Endpoints | 1024 | 8192 | free · anonymous 2 req/min per IP |
BGE Multilingual Gemma2 (OVH)bge-multilingual-gemma2 | OVH AI Endpoints | 3584 | 8192 | free · anonymous 2 req/min per IP |
Mistral: Codestral Embed (ElectronHub)codestral-embed | ElectronHub | 1536 | 8192 | $0.25/week shared free credits |
Mistral: Mistral Embed (ElectronHub)mistral-embed | ElectronHub | 1024 | 8192 | $0.25/week shared free credits |
Google: Gemini Embedding 2 (ElectronHub)gemini-embedding-2 | ElectronHub | 3072 | 8192 | $0.25/week shared free credits |
Google: Gemini Embedding 001 (ElectronHub)gemini-embedding-001 | ElectronHub | 3072 | 2048 | $0.25/week shared free credits |
OpenAI: Text Embedding Ada 002 (ElectronHub)text-embedding-ada-002 | ElectronHub | 1536 | 8192 | $0.25/week shared free credits |
Cohere Embed English Light v3embed-english-light-v3.0 | Cohere | 384 | 512 | 1K calls/mo (shared w/ chat) |
Cohere Embed Multilingual v3embed-multilingual-v3.0 | Cohere | 1024 | 512 | 1K calls/mo (shared w/ chat) |
Cohere Embed Multilingual Light v3embed-multilingual-light-v3.0 | Cohere | 384 | 512 | 1K calls/mo (shared w/ chat) |
FreeLLMAPI કૅટલૉગનો લાઇવ ડેટા (સંસ્કરણ 2026.11.19, તપાસ્યું 2026-11-19). મફત મર્યાદાઓ વારંવાર બદલાય છે. કૅટલૉગ દરરોજ તપાસવામાં આવે છે.
FunctionAgent સાથે agent ઉમેરો
FunctionAgent tool calling વાપરે છે. તમે તેને query engine એક tool તરીકે આપી શકો છો અને તમારા પોતાના Python functions ઉમેરી શકો છો.
agent.py
import asyncio
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.core.tools import QueryEngineTool
from llama_index.core import Settings
from rag import load_index
docs_tool = QueryEngineTool.from_defaults(
query_engine=load_index().as_query_engine(similarity_top_k=4),
name="project_docs",
description="Answers questions about the project documentation.",
)
def open_tickets(team: str) -> int:
"""Return the number of open tickets for a team."""
return {"billing": 4, "platform": 11}.get(team, 0)
agent = FunctionAgent(
tools=[docs_tool, open_tickets],
llm=Settings.llm,
system_prompt="Use the tools. Cite the document name in each answer.",
)
async def main():
result = await agent.run("How many platform tickets are open, and how do we rotate keys?")
print(result)
asyncio.run(main())agent કામ માટે tool calling વાળા મોડેલ પસંદ કરો. ફક્ત આ મોડેલ સાથે fallback chain profile બનાવો, અને મોડેલ નામ તરીકે auto:<profile> વાપરો.
| મૉડેલ | મફત ઉપલબ્ધ | સંદર્ભ | મફત મર્યાદા (શ્રેષ્ઠ ઑફર) | સાધનો | વિઝન |
|---|---|---|---|---|---|
| GLM 5.3 | UnoRouter | 1M | 1 વિનંતી/મિનિટ 1 req/min per model | હા | ના |
| GLM 5.3 Flash | NVIDIA NIM, UnoRouter | 1M | 40 વિનંતી/મિનિટ 40 RPM | હા | હા |
| Gemini 3.8 Flash | Google AI Studio | 1M | Recurring provider quota | હા | હા |
| Qwen3.8 Flash Next | AMD Radeon Cloud | 262K | Recurring daily account allowance | હા | ના |
| Qwen3.8 Flash | ElectronHub | 1M | $0.25/week shared recurring credit | હા | હા |
| Gemini 3.7 Flash | Google AI Studio | 1M | 10 વિનંતી/મિનિટ 20 વિનંતી/દિવસ 250,000 ટોકન/મિનિટ ~3M | હા | હા |
| GPT-5.6 Luna | ElectronHub | 1M | $0.25/week shared recurring credit | હા | હા |
| Dots3 Note Preview | Kilo Gateway, OpenRouter | 512K | 20 વિનંતી/મિનિટ 50 વિનંતી/દિવસ 50 req/day account-wide (1,000 after a $10 purchase) | હા | હા |
| DeepSeek V4 Flash | AMD Radeon Cloud, BazaarLink, ElectronHub | 1M | 10 વિનંતી/મિનિટ 50 વિનંતી/દિવસ Shared rate limit | હા | ના |
| Qwen3.8 27B | ElectronHub, Groq, OVH AI Endpoints | 262K | 30 વિનંતી/મિનિટ 250 વિનંતી/દિવસ 70,000 ટોકન/મિનિટ ~6M | હા | હા |
મેળ ખાતા 109 મફત મૉડેલમાંથી 10 બતાવ્યા. બધા મૉડેલ જુઓ.
FreeLLMAPI કૅટલૉગનો લાઇવ ડેટા (સંસ્કરણ 2026.11.19, તપાસ્યું 2026-11-19). મફત મર્યાદાઓ વારંવાર બદલાય છે. કૅટલૉગ દરરોજ તપાસવામાં આવે છે.
ingestion ને મફત મર્યાદામાં રાખો
Ingestion ટૂંકા સમયમાં ઘણી embedding વિનંતી મોકલે છે. મફત embedding ટિયર પર મર્યાદા ઓછી હોય છે. ઉદાહરણ તરીકે, કેટલાક દર મિનિટે 10 વિનંતી આપે છે અને બીજા દર મહિને calls ગણે છે. શરૂ કરતા પહેલાં પ્રથમ ingestion નું આયોજન કરો.
- મોટા chunks વાપરો. ઓછા chunks એટલે ઓછા vectors અને ઓછી વિનંતી. લગભગ 1,024 tokens નું chunk size સારી શરૂઆત છે.
- Batches વાપરો.
embed_batch_sizeને 16 કે તેથી વધુ પર સેટ કરો. પછી એક વિનંતી ઘણા chunks લઈ જાય છે. - Index સાચવો. પહેલા રન પછી index સાચવો. એ જ ફાઇલ ફરી embed કરશો નહીં.
- Retries ચાલુ રાખો.
OpenAILikeEmbeddingડિફોલ્ટ રીતે 10 વાર સુધી retry કરે છે. લાંબા ingestion jobs માટે આ મૂલ્ય રાખો. - ભાગોમાં ingest કરો. હજારો ફાઇલ માટે એક સમયે એક ફોલ્ડર ingest કરો.
Queries ingestion કરતાં સસ્તી છે. દરેક query એક embedding વિનંતી અને એક chat વિનંતી વાપરે છે. 1,024 tokens ના ચાર chunks વાળી chat વિનંતી લગભગ 5,000 tokens મોકલે છે. ઓછી tokens-per-minute મર્યાદાવાળા મફત ટિયર આને નકારી શકે છે. પછી FreeLLMAPI આગલા પ્રદાતાને અજમાવે છે.
સમસ્યાનિવારણ
| સમસ્યા | કારણ | ઉકેલ |
|---|---|---|
Unknown model 'auto' | તમે OpenAI class વાપરી | OpenAILike વાપરો |
વિનંતી /v1/completions પર જાય છે | is_chat_model સેટ નથી | is_chat_model=True સેટ કરો |
| agent tools કૉલ કરતો નથી | is_function_calling_model બંધ છે, અથવા મોડેલમાં tool calling નથી | તેને True પર સેટ કરો અને tools profile વાપરો |
| ingestion દરમિયાન error 429 | બધા પ્રદાતાઓ પર embedding family તેની મર્યાદા પર છે | મોટા batch વાપરો, Retry-After ની રાહ જુઓ અને ફરી ચલાવો |
| embedding મોડેલ બદલ્યા પછી ખોટા જવાબ | એક index માં બે family ના vectors | સાચવેલો index કાઢી નાખો અને ફરી બનાવો |
| Context length error | context_window જવાબ આપનાર મોડેલ કરતાં મોટી છે | નાની કિંમત સેટ કરો, અથવા લાંબા context નો profile વાપરો |
કયા પ્રદાતાએ વિનંતીનો જવાબ આપ્યો તે જોવા FreeLLMAPI ડેશબોર્ડ વાપરો. Analytics પેજ દરેક પ્રદાતા અને મોડેલ માટે વિનંતી, latency અને errors બતાવે છે. દરેક response માં X-Routed-Via header પણ હોય છે. જો રાઉટરે પ્રદાતા બદલ્યો હોય, તો X-Fallback-Trail header દરેક નિષ્ફળ પ્રયાસ અને કારણ દર્શાવે છે.
વારંવાર પૂછાતા પ્રશ્નો
શું મફત LLM સાથે LlamaIndex વાપરી શકાય?
હા. api_base ને OpenAI-compatible URL પર સેટ કરીને OpenAILike વાપરો. FreeLLMAPI ઘણા મફત પ્રદાતા ટિયર માટે એક URL આપે છે. દરેક ટિયરની પોતાની મર્યાદા હોય છે.
LlamaIndex માં OpenAI અને OpenAILike વચ્ચે શો તફાવત છે?
OpenAI class મોડેલ નામને OpenAI મોડેલ સામે તપાસે છે. OpenAILike કોઈપણ મોડેલ નામ સ્વીકારે છે. context window અને chat તથા function-calling flags તમે જાતે સેટ કરો છો.
LlamaIndex માટે શ્રેષ્ઠ મફત embedding મોડેલ કયું છે?
તમારા ingestion માટે પૂરતી મફત વિનંતી ધરાવતી family પસંદ કરો અને આખા index માટે તે જ રાખો. bge-m3 family ઘણા પ્રદાતાઓ પર મફત છે, તેથી failover તેમની વચ્ચે જઈ શકે છે.
શું FunctionAgent મફત મોડેલ સાથે કામ કરે છે?
હા, જો મોડેલ tool calling ને સપોર્ટ કરે અને તમે is_function_calling_model=True સેટ કરો. ફક્ત tool-calling મોડેલ ધરાવતી fallback chain profile વાપરો.
LlamaIndex index બનાવતી વખતે rate limits કેવી રીતે ટાળું?
મોટા chunks વાપરો, embed_batch_size ને 16 કે તેથી વધુ પર સેટ કરો, index સાચવો અને મોટા ફોલ્ડર ભાગોમાં ingest કરો.
સંબંધિત માર્ગદર્શિકાઓ
- RAG માટે મફત LLM API
- મફત embeddings API
- LangChain માટે મફત LLM API
- Python માં મફત LLM API
- 1 million token context સાથે મફત LLM API
સ્રોતો
- LlamaIndex: llama-index-llms-openai-like README (તપાસ્યું 20 November 2026)
- LlamaIndex: llama-index-embeddings-openai-like source (તપાસ્યું 20 November 2026)
- LlamaIndex: FunctionAgent (agent workflow) source (તપાસ્યું 20 November 2026)
- FreeLLMAPI docs: REST API (embeddings families, routing strategies) (તપાસ્યું 20 November 2026)