function calling સાથે મફત LLM API
Function calling, અથવા tool calling, LLM ને તમારા કોડને function ચલાવવા કહેવા દે છે. Agents, લાઇવ ડેટાવાળા chat bots અને structured extraction બધા તેનો ઉપયોગ કરે છે. FreeLLMAPI catalog માં tool calling સાથે 190 મફત મોડેલ ઑફર છે. તમે OpenAI-શૈલીના tools મોકલો છો, અને ગેટવે દરેક પ્રદાતા માટે તેમનું રૂપાંતર કરે છે.
કોડ, મૉડેલ નામ અને લાઇવ કૅટલૉગ લેબલ અંગ્રેજીમાં બતાવવામાં આવે છે.
FreeLLMAPI દ્વારા tool calling કેવી રીતે કામ કરે છે
- તમે messages અને
toolsની યાદી મોકલો છો. દરેક tool માં નામ, વર્ણન અને તેના parameters માટે JSON Schema હોય છે. - મોડેલ
tool_callsઅનેfinish_reason: "tool_calls"સાથે જવાબ આપે છે. તે પોતે કંઈ ચલાવતું નથી. - તમારો કોડ function ચલાવે છે, અને પરિણામ
role: "tool"સાથે message તરીકે ઉમેરે છે. - તમે વાતચીત ફરીથી મોકલો છો. મોડેલ પરિણામ વાપરીને અંતિમ જવાબ લખે છે.
Groq, Cerebras, Mistral, OpenRouter અને Cloudflare જેવા OpenAI સાથે સુસંગત પ્રદાતા વિનંતી જેમ છે તેમ મેળવે છે. Gemini માટે, FreeLLMAPI tools ને Google’s functionDeclarations ફોર્મેટમાં રૂપાંતરિત કરે છે અને જવાબ પાછો રૂપાંતરિત કરે છે. દરેક પ્રદાતા માટે તમારો કોડ એક જ છે.
કેટલાક મોડેલ tool call ને સાદા લખાણ તરીકે લખે છે, વાસ્તવિક tool call તરીકે નહીં. FreeLLMAPI આને શોધે છે અને તેમને વાસ્તવિક tool_calls માં બદલે છે.
આજે tool calling સાથે મફત મોડેલ
કોષ્ટક tool calling સાથેના સૌથી મજબૂત મફત મોડેલ બતાવે છે. ડેટા લાઇવ catalog માંથી આવે છે. Agents માટે, context નું કદ પણ તપાસો, કારણ કે tool ની વ્યાખ્યાઓ અને પરિણામો ઘણા tokens વાપરે છે.
| મૉડેલ | મફત ઉપલબ્ધ | સંદર્ભ | મફત મર્યાદા (શ્રેષ્ઠ ઑફર) | સાધનો | વિઝન |
|---|---|---|---|---|---|
| GLM 5.3 | UnoRouter | 1M | 1 વિનંતી/મિનિટ 1 req/min per model | હા | ના |
| Qwen3.8 Max | ACLIDE | - | €20/month shared internal usage credits · no card | હા | ના |
| GLM 5.3 Flash | NVIDIA NIM, UnoRouter | 1M | 40 વિનંતી/મિનિટ 40 RPM | હા | હા |
| Gemini 3.8 Flash | Google AI Studio | 1M | Recurring provider quota | હા | હા |
| Gemini Flash (latest alias) | Google AI Studio | - | 10 વિનંતી/મિનિટ 20 વિનંતી/દિવસ 250,000 ટોકન/મિનિટ ~3M | હા | હા |
| 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 | હા | હા |
| Gemini 3.6 Flash | Google AI Studio | 1M | 10 વિનંતી/મિનિટ 20 વિનંતી/દિવસ 250,000 ટોકન/મિનિટ ~3M | હા | હા |
| Qwen 3.8 27B | Cloudflare Workers AI | 262K | Shared 10k neurons/day | હા | હા |
| Gemini 3.5 Flash | Google AI Studio | 1M | 10 વિનંતી/મિનિટ 20 વિનંતી/દિવસ 250,000 ટોકન/મિનિટ ~3M | હા | હા |
મેળ ખાતા 146 મફત મૉડેલમાંથી 15 બતાવ્યા. બધા મૉડેલ જુઓ.
FreeLLMAPI કૅટલૉગનો લાઇવ ડેટા (સંસ્કરણ 2026.11.19, તપાસ્યું 2026-11-19). મફત મર્યાદાઓ વારંવાર બદલાય છે. કૅટલૉગ દરરોજ તપાસવામાં આવે છે.
પગલું 1: FreeLLMAPI ઇન્સ્ટોલ કરો અને કી ઉમેરો
FreeLLMAPI ઓપન સોર્સ છે. તે Docker માં તમારા કમ્પ્યુટર પર ચાલે છે. તમારી પ્રદાતા કી તમારા કમ્પ્યુટર પર જ રહે છે.
ઇન્સ્ટોલ કરો (macOS અથવા Linux)
curl -fsSL https://freellmapi.co/install.sh | bashhttp://localhost:3001 પર ડૅશબોર્ડ ખોલો. Keys પેજ પર ત્રણ કે વધુ પ્રદાતાઓની કી ઉમેરો. tool loop એક કાર્ય માટે ઘણી વિનંતી મોકલે છે, તેથી વધુ કી વધુ જગ્યા આપે છે. એ જ પેજ પરથી તમારી યુનિફાઇડ કી કૉપી કરો.
પગલું 2: સંપૂર્ણ tool loop ચલાવો
curl: પહેલી વિનંતી
curl http://localhost:3001/v1/chat/completions \
-H "Authorization: Bearer <unified-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"messages": [{"role": "user", "content": "What is the weather in Karachi?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city.",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}]
}'Python: મોડેલ અંતિમ જવાબ આપે ત્યાં સુધી loop કરો
import json
from openai import OpenAI
client = OpenAI(base_url="http://localhost:3001/v1", api_key="<unified-key>")
def get_weather(city: str) -> dict:
return {"city": city, "temp_c": 32, "condition": "sunny"} # call a real API here
FUNCS = {"get_weather": get_weather}
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city.",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
}]
messages = [{"role": "user", "content": "What is the weather in Karachi and Lahore?"}]
for _ in range(5): # stop after 5 rounds
msg = client.chat.completions.create(model="auto", messages=messages, tools=tools).choices[0].message
if not msg.tool_calls:
print(msg.content)
break
messages.append(msg)
for call in msg.tool_calls:
try:
args = json.loads(call.function.arguments or "{}")
result = FUNCS[call.function.name](**args)
except Exception as exc: # bad JSON, unknown tool or wrong arguments
result = {"error": str(exc)}
messages.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps(result)})Tool calling stream=True સાથે પણ કામ કરે છે. તમને delta.tool_calls chunks મળે છે, પછી finish_reason: "tool_calls" સાથે અંતિમ chunk. JSON parse કરતા પહેલાં argument chunks જોડો.
structured ડેટા મેળવવા tool વાપરો
Tool calling નિશ્ચિત આકારમાં ડેટા મેળવવાની સારી રીત પણ છે. એક tool વ્યાખ્યાયિત કરો જેના parameters તમે ઇચ્છો તે ફીલ્ડ હોય. tool_choice ને "required" પર સેટ કરો, જેથી મોડેલે tool કૉલ કરવો જ પડે. પછી arguments વાંચો. તમારે કોઈ function ચલાવવાની જરૂર નથી.
Python: જરૂરી tool call સાથે ફીલ્ડ કાઢો
import json
from openai import OpenAI
client = OpenAI(base_url="http://localhost:3001/v1", api_key="<unified-key>")
schema = {
"type": "function",
"function": {
"name": "save_contact",
"description": "Save one contact found in the text.",
"parameters": {
"type": "object",
"properties": {"name": {"type": "string"}, "email": {"type": "string"}},
"required": ["name", "email"],
},
},
}
resp = client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Reach Sara Khan at [email protected]."}],
tools=[schema],
tool_choice="required",
)
print(json.loads(resp.choices[0].message.tool_calls[0].function.arguments))તમારા પોતાના કોડ વડે arguments ચકાસો. મોડેલ જરૂરી ફીલ્ડ છોડી શકે છે અથવા ખોટો પ્રકાર મોકલી શકે છે. ચકાસણી નિષ્ફળ જાય, તો ભૂલ પાછી મોકલો અને ફરીથી પૂછો.
સામાન્ય ભૂલો
- Arguments સ્ટ્રિંગ છે:
function.argumentsએ JSON સ્ટ્રિંગ છે. તેને parse કરો, અને ભૂલો પકડો. નાના મોડેલ ક્યારેક માન્ય ન હોય તેવું JSON મોકલે છે. - ids મેળવો: દરેક tool message ને તેના call નો
tool_call_idજોઈએ. tool messages પહેલાંtool_callsવાળો assistant message ઉમેરો. - એક સાથે ઘણા calls: મોડેલ એક જવાબમાં એક કરતાં વધુ tool call પાછા આપી શકે છે. તે બધા ચલાવો, પછી બધા પરિણામો મોકલો.
- Token ખર્ચ: દરેક tool ની વ્યાખ્યા દરેક વિનંતી સાથે મોકલાય છે. વીસ મોટા tools હજારો tokens વાપરી શકે છે અને નીચી tokens-per-minute મર્યાદા ઝડપથી પહોંચી શકે છે. કાર્યને જરૂરી tools જ મોકલો.
- સ્પષ્ટ વર્ણન: મોડેલ તેના નામ અને વર્ણન પરથી tool પસંદ કરે છે. એક ટૂંકું વાક્ય લખો જે કહે કે tool શું કરે છે અને ક્યારે વાપરવું.
- loop રોકો: rounds ની મહત્તમ સંખ્યા સેટ કરો. નબળું મોડેલ એ જ tool વારંવાર કૉલ કરી શકે છે.
- Tools વગરના મોડેલ: કેટલાક મફત પ્રદાતા tools સપોર્ટ કરતા નથી. ઉદાહરણ તરીકે, AI Horde tools કાઢી નાખે છે અને સાદા chat તરીકે જવાબ આપે છે.
મુશ્કેલી નિવારણ
| સમસ્યા | કારણ | ઉકેલ |
|---|---|---|
| મોડેલ લખાણમાં જવાબ આપે છે અને કોઈ tool કૉલ કરતું નથી | મોડેલ tools માં નબળું છે, અથવા વર્ણન સ્પષ્ટ નથી | કોષ્ટકમાંથી મજબૂત મોડેલ પિન કરો, અથવા tool નું વર્ણન સુધારો |
arguments પર json.JSONDecodeError | મોડેલે માન્ય ન હોય તેવું JSON મોકલ્યું | ભૂલ પકડો અને તેને tool પરિણામ તરીકે પાછી મોકલો, જેથી મોડેલ ફરી પ્રયાસ કરી શકે |
| tool message વિશે ભૂલ 400 | tool_call_id મેળ ખાતો નથી, અથવા assistant message ખૂટે છે | પહેલા assistant message ઉમેરો, પછી દરેક call માટે એક tool message |
| agent કાર્ય દરમિયાન ભૂલ 429 | loop ઘણી મોટી વિનંતીઓ મોકલે છે | વધુ પ્રદાતા કી ઉમેરો, અને ઓછા tools મોકલો |
| loop અટકતો નથી | મોડેલ એ જ tool ફરીથી કૉલ કરે છે | round મર્યાદા સેટ કરો, અને સ્પષ્ટ પરિણામો પરત કરો |
વારંવાર પૂછાતા પ્રશ્નો
કઈ મફત LLM API function calling સપોર્ટ કરે છે?
Gemini, Groq, Cerebras, Mistral, OpenRouter, Cloudflare અને બીજા પ્રદાતાઓ પાસે tool calling સાથે મફત મોડેલ છે. FreeLLMAPI catalog માં આજે tools સાથે 190 મફત મોડેલ ઑફર છે.
શું tool calling એ function calling જેવું જ છે?
હા. OpenAI એ પહેલા function calling નામ વાપર્યું. હાલનો API tools અને tool_calls વાપરે છે. બંને નામોનો અર્થ એક જ છે: મોડેલ તમારા કોડને function ચલાવવા કહે છે.
શું OpenAI ફોર્મેટ સાથે Gemini tool calling કામ કરે છે?
હા, FreeLLMAPI દ્વારા. ગેટવે OpenAI tools ને Gemini functionDeclarations માં રૂપાંતરિત કરે છે, અને જવાબને પાછો OpenAI tool_calls માં રૂપાંતરિત કરે છે.
શું tool calls stream કરી શકાય?
હા. stream=True સાથે તમને delta.tool_calls chunks અને tool_calls નો અંતિમ finish_reason મળે છે. parse કરતા પહેલાં argument chunks જોડો.
સંબંધિત માર્ગદર્શિકાઓ
- AI એજન્ટ્સ માટે મફત LLM API
- AI agents માટે મફત વેબ શોધ API
- શ્રેષ્ઠ મફત coding model APIs
- LangChain માટે મફત LLM API
- Python માં મફત LLM API
સ્રોતો
- FreeLLMAPI docs: Tool calling (તપાસ્યું 20 November 2026)
- FreeLLMAPI README: features (તપાસ્યું 20 November 2026)
- OpenAI API reference: Chat Completions tools (તપાસ્યું 20 November 2026)