હોમ / માર્ગદર્શિકાઓ / LlamaIndex માટે મફત LLM

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 સૌથી મોટી છે:

સૌથી મોટી context window વાળા મફત મોડેલ
મૉડેલમફત ઉપલબ્ધસંદર્ભમફત મર્યાદા (શ્રેષ્ઠ ઑફર)સાધનોવિઝન
OpenAI: GPT-6 LunaElectronHub1.1M$0.25/week shared free creditsનાના
Gemini 3.8 FlashAPINex, Google AI Studio1M5 વિનંતી/મિનિટ
10M weighted tokens/day shared across APINex free routes; 3x token multiplier; 5 requests/minute/account
હાહા
Gemini 3.7 FlashGoogle AI Studio1M10 વિનંતી/મિનિટ
20 વિનંતી/દિવસ
250,000 ટોકન/મિનિટ
~3M
હાહા
DeepSeek V4 FlashAMD Radeon Cloud, BazaarLink, ElectronHub1M10 વિનંતી/મિનિટ
50 વિનંતી/દિવસ
Shared rate limit
હાના
DeepSeek V4 Flash 0731ElectronHub, Router91M10,000 credits/month (~$1), shared; account-anniversary resetનાના
Gemini 3.6 FlashGoogle AI Studio1M10 વિનંતી/મિનિટ
20 વિનંતી/દિવસ
250,000 ટોકન/મિનિટ
~3M
હાહા
GLM-5.2ModelScope, Router91M100 વિનંતી/દિવસ
Daily login: 200 credits + 50 for linked Alibaba Cloud; 24h expiry; shared; noncommercial experience
નાના
Gemini 3.5 FlashGoogle AI Studio1M10 વિનંતી/મિનિટ
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))
મહત્વપૂર્ણ: આખા index માટે એક embedding family રાખો. FreeLLMAPI failover દરમિયાન ક્યારેય embedding મોડેલ બદલતું નથી. તે ફક્ત એ જ family આપતા પ્રદાતાઓ વચ્ચે જાય છે. જો તમે family બદલો, તો ./storage કાઢી નાખો અને index ફરી બનાવો.

આજની catalog માં આ embedding મોડેલ મફત છે. dimensions કૉલમ દરેક family નું vector કદ બતાવે છે.

મૉડેલપ્રદાતાપરિમાણોમહત્તમ ઇનપુટમફત મર્યાદા
Gemini Embedding
gemini-embedding-001
Google AI Studio30722048100 rpm · 1K req/day
Nemotron Embed VL 1B
nvidia/llama-nemotron-embed-vl-1b-v2
NVIDIA NIM20488192~40 rpm
Nemotron 3 Embed 1B (OR free)
nvidia/nemotron-3-embed-1b:free
OpenRouter20483276820 rpm · shared free daily cap
SEA-LION E5 Embedding 600M
aisingapore/SEA-LION-E5-Embedding-600M
SEA-LION10248192free · 10 rpm
SEA-LION ModernBERT Embedding 300M
aisingapore/SEA-LION-ModernBERT-Embedding-300M
SEA-LION10248192free · 10 rpm
SEA-LION ModernBERT Embedding 600M
aisingapore/SEA-LION-ModernBERT-Embedding-600M
SEA-LION10248192free · 10 rpm
BGE-M3
@cf/baai/bge-m3
Cloudflare Workers AI1024819210K neurons/day (shared)
EmbeddingGemma 300M
@cf/google/embeddinggemma-300m
Cloudflare Workers AI768204810K neurons/day (shared)
Qwen3 Embedding 0.6B
@cf/qwen/qwen3-embedding-0.6b
Cloudflare Workers AI1024819210K neurons/day (shared)
Cohere Embed v4
embed-v4.0
Cohere15361280001K calls/mo (shared w/ chat)
Gemini Embedding 2
gemini-embedding-2
Google AI Studio30728192free-tier rate limited
Nemotron 3 Embed 1B
nvidia/nemotron-3-embed-1b
NVIDIA NIM20484096~40 rpm
PLaMo Embedding 1B (CF)
@cf/pfnet/plamo-embedding-1b
Cloudflare Workers AI2048409610K neurons/day (shared)
BGE Small EN v1.5 (CF)
@cf/baai/bge-small-en-v1.5
Cloudflare Workers AI38451210K neurons/day (shared)
BGE Base EN v1.5 (CF)
@cf/baai/bge-base-en-v1.5
Cloudflare Workers AI76851210K neurons/day (shared)
BGE Large EN v1.5 (CF)
@cf/baai/bge-large-en-v1.5
Cloudflare Workers AI102451210K neurons/day (shared)
Mistral Embed
mistral-embed
Mistral10248192free mode · monthly cap (shared)
Codestral Embed
codestral-embed
Mistral15368192free mode · monthly cap (shared)
Llama Text Embed v2 (Pinecone)
llama-text-embed-v2
Pinecone102420485M tokens/mo per model
Multilingual E5 Large (Pinecone)
multilingual-e5-large
Pinecone10245075M tokens/mo per model
Nemotron 3 Embed 1B (Speka)
nvidia/nemotron-3-embed-1b
Speka20488192$1/month shared across Speka models
OpenAI: Text Embedding 3 Small (ElectronHub)
text-embedding-3-small
ElectronHub15368192$0.25/week shared free credits
OpenAI: Text Embedding 3 Large (ElectronHub)
text-embedding-3-large
ElectronHub30728192$0.25/week shared free credits
Nemotron 3 Embed 8B (Inferbase)
nvidia-nemotron-3-embed-8b
Inferbase409681925,000 requests/month; 100 requests and $0.50 usage/day shared
Qwen 3 Embedding 0.6B (Inferbase)
qwen3-embedding-0-6b
Inferbase102481925,000 requests/month; 100 requests and $0.50 usage/day shared
Qwen 3 Embedding 4B (Inferbase)
qwen3-embedding-4b
Inferbase256081925,000 requests/month; 100 requests and $0.50 usage/day shared
Qwen 3 Embedding 8B (Inferbase)
qwen3-embedding-8b
Inferbase409681925,000 requests/month; 100 requests and $0.50 usage/day shared
LFM2.5 Embedding 350M (LLMTR)
liquid/lfm-2.5-embedding-350m-free
LLMTR1024512Ongoing zero-price route; provider terms apply
BGE-M3 (SEA-LION)
BAAI/bge-m3
SEA-LION10248192free · 10 rpm
Cohere Embed English v3
embed-english-v3.0
Cohere10245121K calls/mo (shared w/ chat)
Qwen3 Embedding 8B (OVH)
Qwen3-Embedding-8B
OVH AI Endpoints409632768free · anonymous 2 req/min per IP
BGE-M3 (OVH)
bge-m3
OVH AI Endpoints10248192free · anonymous 2 req/min per IP
BGE Multilingual Gemma2 (OVH)
bge-multilingual-gemma2
OVH AI Endpoints35848192free · anonymous 2 req/min per IP
Mistral: Codestral Embed (ElectronHub)
codestral-embed
ElectronHub15368192$0.25/week shared free credits
Mistral: Mistral Embed (ElectronHub)
mistral-embed
ElectronHub10248192$0.25/week shared free credits
Google: Gemini Embedding 2 (ElectronHub)
gemini-embedding-2
ElectronHub30728192$0.25/week shared free credits
Google: Gemini Embedding 001 (ElectronHub)
gemini-embedding-001
ElectronHub30722048$0.25/week shared free credits
OpenAI: Text Embedding Ada 002 (ElectronHub)
text-embedding-ada-002
ElectronHub15368192$0.25/week shared free credits
Cohere Embed English Light v3
embed-english-light-v3.0
Cohere3845121K calls/mo (shared w/ chat)
Cohere Embed Multilingual v3
embed-multilingual-v3.0
Cohere10245121K calls/mo (shared w/ chat)
Cohere Embed Multilingual Light v3
embed-multilingual-light-v3.0
Cohere3845121K 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> વાપરો.

tool calling અને 128K+ context વાળા મફત મોડેલ
મૉડેલમફત ઉપલબ્ધસંદર્ભમફત મર્યાદા (શ્રેષ્ઠ ઑફર)સાધનોવિઝન
GLM 5.3UnoRouter1M1 વિનંતી/મિનિટ
1 req/min per model
હાના
GLM 5.3 FlashNVIDIA NIM, UnoRouter1M40 વિનંતી/મિનિટ
40 RPM
હાહા
Gemini 3.8 FlashGoogle AI Studio1MRecurring provider quotaહાહા
Qwen3.8 Flash NextAMD Radeon Cloud262KRecurring daily account allowanceહાના
Qwen3.8 FlashElectronHub1M$0.25/week shared recurring creditહાહા
Gemini 3.7 FlashGoogle AI Studio1M10 વિનંતી/મિનિટ
20 વિનંતી/દિવસ
250,000 ટોકન/મિનિટ
~3M
હાહા
GPT-5.6 LunaElectronHub1M$0.25/week shared recurring creditહાહા
Dots3 Note PreviewKilo Gateway, OpenRouter512K20 વિનંતી/મિનિટ
50 વિનંતી/દિવસ
50 req/day account-wide (1,000 after a $10 purchase)
હાહા
DeepSeek V4 FlashAMD Radeon Cloud, BazaarLink, ElectronHub1M10 વિનંતી/મિનિટ
50 વિનંતી/દિવસ
Shared rate limit
હાના
Qwen3.8 27BElectronHub, Groq, OVH AI Endpoints262K30 વિનંતી/મિનિટ
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 errorcontext_window જવાબ આપનાર મોડેલ કરતાં મોટી છેનાની કિંમત સેટ કરો, અથવા લાંબા context નો profile વાપરો

કયા પ્રદાતાએ વિનંતીનો જવાબ આપ્યો તે જોવા FreeLLMAPI ડેશબોર્ડ વાપરો. Analytics પેજ દરેક પ્રદાતા અને મોડેલ માટે વિનંતી, latency અને errors બતાવે છે. દરેક response માં X-Routed-Via header પણ હોય છે. જો રાઉટરે પ્રદાતા બદલ્યો હોય, તો X-Fallback-Trail header દરેક નિષ્ફળ પ્રયાસ અને કારણ દર્શાવે છે.

આ બધાનો ઉપયોગ એક જ કી દ્વારા કરો. FreeLLMAPI એક ઓપન-સોર્સ, સ્વ-હોસ્ટેડ રાઉટર છે. તે આ બધા મફત ટાયરને એક OpenAI સાથે સુસંગત એન્ડપોઇન્ટ પાછળ મૂકે છે અને જ્યારે એક મૉડેલની રેટ મર્યાદા આવે ત્યારે બીજા પર આપમેળે સ્વિચ કરે છે. કૅટલૉગ બ્રાઉઝ કરો અથવા લાઇવ જાઓ.

વારંવાર પૂછાતા પ્રશ્નો

શું મફત 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 કરો.

સંબંધિત માર્ગદર્શિકાઓ

સ્રોતો

બધી માર્ગદર્શિકાઓ · બધા મફત મૉડેલ જુઓ