Function calling ഉള്ള സൗജന്യ LLM API
Function calling, അല്ലെങ്കിൽ tool calling, ഒരു function പ്രവർത്തിപ്പിക്കാൻ നിങ്ങളുടെ കോഡിനോട് ആവശ്യപ്പെടാൻ LLM-നെ അനുവദിക്കുന്നു. ഏജന്റുകളും തത്സമയ ഡാറ്റയുള്ള chat bots ഉം ഘടനാപരമായ extraction ഉം എല്ലാം ഇത് ഉപയോഗിക്കുന്നു. FreeLLMAPI catalog-ൽ tool calling ഉള്ള 190 സൗജന്യ മോഡൽ ഓഫറുകളുണ്ട്. നിങ്ങൾ OpenAI-style tools അയയ്ക്കുന്നു, gateway ഓരോ provider-നും അവയെ പരിവർത്തനം ചെയ്യുന്നു.
കോഡ്, മോഡൽ പേരുകളും തത്സമയ കാറ്റലോഗ് ലേബലുകളും ഇംഗ്ലീഷിൽ കാണിക്കുന്നു.
FreeLLMAPI വഴി tool calling എങ്ങനെ പ്രവർത്തിക്കുന്നു
- നിങ്ങൾ സന്ദേശങ്ങളും
toolsപട്ടികയും അയയ്ക്കുന്നു. ഓരോ tool-നും ഒരു പേര്, ഒരു വിവരണം, അതിന്റെ parameters-നുള്ള ഒരു JSON Schema എന്നിവയുണ്ട്. - മോഡൽ
tool_calls,finish_reason: "tool_calls"എന്നിവയോടെ ഉത്തരം നൽകുന്നു. അത് സ്വയം ഒന്നും പ്രവർത്തിപ്പിക്കുന്നില്ല. - നിങ്ങളുടെ കോഡ് function പ്രവർത്തിപ്പിക്കുകയും ഫലം
role: "tool"ഉള്ള ഒരു സന്ദേശമായി ചേർക്കുകയും ചെയ്യുന്നു. - നിങ്ങൾ സംഭാഷണം വീണ്ടും അയയ്ക്കുന്നു. അന്തിമ ഉത്തരം എഴുതാൻ മോഡൽ ഫലം ഉപയോഗിക്കുന്നു.
Groq, Cerebras, Mistral, OpenRouter, Cloudflare പോലുള്ള OpenAI-compatible providers അഭ്യർത്ഥന മാറ്റമില്ലാതെ സ്വീകരിക്കുന്നു. Gemini-ക്ക്, FreeLLMAPI tools-നെ Google’s functionDeclarations ഫോർമാറ്റിലേക്ക് പരിവർത്തനം ചെയ്യുകയും ഉത്തരം തിരികെ പരിവർത്തനം ചെയ്യുകയും ചെയ്യുന്നു. എല്ലാ providers-നും നിങ്ങളുടെ കോഡ് ഒന്നുതന്നെയാണ്.
ചില മോഡലുകൾ യഥാർത്ഥ tool call ആയല്ല, സാധാരണ വാചകമായി tool call എഴുതുന്നു. FreeLLMAPI ഇവ കണ്ടെത്തി യഥാർത്ഥ tool_calls ആക്കി മാറ്റുന്നു.
ഇന്ന് tool calling ഉള്ള സൗജന്യ മോഡലുകൾ
ഏറ്റവും ശക്തമായ tool calling ഉള്ള സൗജന്യ മോഡലുകൾ പട്ടിക കാണിക്കുന്നു. ഡാറ്റ തത്സമയ catalog-ൽ നിന്നാണ്. ഏജന്റുകൾക്ക്, 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 open source ആണ്. ഇത് Docker-ൽ നിങ്ങളുടെ കമ്പ്യൂട്ടറിൽ പ്രവർത്തിക്കുന്നു. നിങ്ങളുടെ provider കീകൾ നിങ്ങളുടെ കമ്പ്യൂട്ടറിൽ തന്നെ തുടരുന്നു.
ഇൻസ്റ്റാൾ ചെയ്യുക (macOS അല്ലെങ്കിൽ Linux)
curl -fsSL https://freellmapi.co/install.sh | bashhttp://localhost:3001-ൽ ഡാഷ്ബോർഡ് തുറക്കുക. Keys പേജിൽ മൂന്നോ അതിലധികമോ providers-ൽ നിന്ന് കീകൾ ചേർക്കുക. ഒരു tool loop ഒരു task-ന് നിരവധി അഭ്യർത്ഥനകൾ അയയ്ക്കുന്നു, അതിനാൽ കൂടുതൽ കീകൾ കൂടുതൽ ഇടം നൽകുന്നു. അതേ പേജിൽ നിന്ന് നിങ്ങളുടെ ഏകീകൃത കീ പകർത്തുക.
ഘട്ടം 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)})stream=True-ഓടെയും tool calling പ്രവർത്തിക്കുന്നു. delta.tool_calls chunks ലഭിക്കുന്നു, പിന്നെ finish_reason: "tool_calls"-ഓടെ ഒരു അന്തിമ chunk. JSON parse ചെയ്യുന്നതിന് മുമ്പ് argument chunks ചേർക്കുക.
ഘടനാപരമായ ഡാറ്റ ലഭിക്കാൻ ഒരു tool ഉപയോഗിക്കുക
നിശ്ചിത രൂപത്തിലുള്ള ഡാറ്റ ലഭിക്കാനും tool calling നല്ല വഴിയാണ്. നിങ്ങൾക്ക് വേണ്ട fields parameters ആകുന്ന ഒരു tool നിർവചിക്കുക. മോഡൽ ഒരു tool വിളിക്കണമെന്ന് ഉറപ്പാക്കാൻ tool_choice "required" ആയി സജ്ജമാക്കുക. പിന്നെ arguments വായിക്കുക. ഏതെങ്കിലും function പ്രവർത്തിപ്പിക്കേണ്ടതില്ല.
Python: നിർബന്ധിത tool call ഉപയോഗിച്ച് fields extract ചെയ്യുക
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 പരിശോധിക്കുക. ഒരു മോഡലിന് നിർബന്ധിത field ഒഴിവാക്കാനോ തെറ്റായ തരം അയയ്ക്കാനോ കഴിയും. പരിശോധന പരാജയപ്പെട്ടാൽ, പിശക് തിരികെ അയച്ച് വീണ്ടും ചോദിക്കുക.
കുഴികൾ
- Arguments ഒരു string ആണ്:
function.argumentsഒരു JSON string ആണ്. അത് parse ചെയ്യുക, പിശകുകൾ പിടിക്കുക. ചെറിയ മോഡലുകൾ ചിലപ്പോൾ സാധുവല്ലാത്ത JSON അയയ്ക്കുന്നു. - ids പൊരുത്തപ്പെടുത്തുക: ഓരോ tool സന്ദേശത്തിനും അതിന്റെ call-ന്റെ
tool_call_idആവശ്യമാണ്.tool_callsഉള്ള assistant സന്ദേശം tool സന്ദേശങ്ങൾക്ക് മുമ്പ് ചേർക്കുക. - ഒരേസമയം നിരവധി calls: ഒരു മോഡലിന് ഒരു ഉത്തരത്തിൽ ഒന്നിലധികം tool calls തിരികെ നൽകാം. അവയെല്ലാം പ്രവർത്തിപ്പിക്കുക, പിന്നെ എല്ലാ ഫലങ്ങളും അയയ്ക്കുക.
- Token ചെലവ്: ഓരോ tool നിർവചനവും ഓരോ അഭ്യർത്ഥനയിലും അയയ്ക്കുന്നു. വലിയ ഇരുപത് tools ആയിരക്കണക്കിന് tokens ഉപയോഗിക്കുകയും കുറഞ്ഞ tokens-per-minute പരിധി വേഗത്തിൽ എത്തുകയും ചെയ്യാം. task-ന് ആവശ്യമുള്ള tools മാത്രം അയയ്ക്കുക.
- വ്യക്തമായ വിവരണങ്ങൾ: മോഡൽ ഒരു tool തിരഞ്ഞെടുക്കുന്നത് അതിന്റെ പേരും വിവരണവും നോക്കിയാണ്. tool എന്ത് ചെയ്യുന്നു, എപ്പോൾ ഉപയോഗിക്കണം എന്ന് പറയുന്ന ഒരു ചെറിയ വാക്യം എഴുതുക.
- Loop നിർത്തുക: പരമാവധി റൗണ്ടുകളുടെ എണ്ണം സജ്ജമാക്കുക. ദുർബലമായ മോഡലിന് ഒരേ tool വീണ്ടും വീണ്ടും വിളിക്കാൻ കഴിയും.
- Tools ഇല്ലാത്ത മോഡലുകൾ: ചില സൗജന്യ providers tools പിന്തുണയ്ക്കുന്നില്ല. ഉദാഹരണത്തിന്, AI Horde tools ഒഴിവാക്കി സാധാരണ chat ആയി ഉത്തരം നൽകുന്നു.
പ്രശ്നപരിഹാരം
| പ്രശ്നം | കാരണം | പരിഹാരം |
|---|---|---|
| മോഡൽ വാചകത്തിൽ ഉത്തരം നൽകുന്നു, ഒരു tool-ഉം വിളിക്കുന്നില്ല | മോഡൽ tools-ൽ ദുർബലമാണ്, അല്ലെങ്കിൽ വിവരണം വ്യക്തമല്ല | പട്ടികയിൽ നിന്ന് ശക്തമായ ഒരു മോഡൽ പിൻ ചെയ്യുക, അല്ലെങ്കിൽ tool വിവരണം മെച്ചപ്പെടുത്തുക |
arguments-ൽ json.JSONDecodeError | മോഡൽ സാധുവല്ലാത്ത JSON അയച്ചു | പിശക് പിടിച്ച് tool ഫലമായി തിരികെ അയയ്ക്കുക, അതിലൂടെ മോഡലിന് വീണ്ടും ശ്രമിക്കാം |
| tool സന്ദേശത്തെക്കുറിച്ച് Error 400 | tool_call_id പൊരുത്തപ്പെടുന്നില്ല, അല്ലെങ്കിൽ assistant സന്ദേശം കാണുന്നില്ല | ആദ്യം assistant സന്ദേശം ചേർക്കുക, പിന്നെ ഓരോ call-നും ഒരു tool സന്ദേശം വീതം |
| ഒരു ഏജന്റ് task-നിടയിൽ Error 429 | loop നിരവധി വലിയ അഭ്യർത്ഥനകൾ അയയ്ക്കുന്നു | കൂടുതൽ provider കീകൾ ചേർക്കുക, കുറച്ച് tools അയയ്ക്കുക |
| loop നിൽക്കുന്നില്ല | മോഡൽ അതേ tool വീണ്ടും വിളിക്കുന്നു | ഒരു റൗണ്ട് പരിധി സജ്ജമാക്കുക, വ്യക്തമായ ഫലങ്ങൾ തിരികെ നൽകുക |
പതിവ് ചോദ്യങ്ങൾ
ഏത് സൗജന്യ LLM API-കൾ function calling പിന്തുണയ്ക്കുന്നു?
Gemini, Groq, Cerebras, Mistral, OpenRouter, Cloudflare എന്നിവയ്ക്കും മറ്റ് providers-നും tool calling ഉള്ള സൗജന്യ മോഡലുകളുണ്ട്. FreeLLMAPI catalog-ൽ ഇന്ന് tools ഉള്ള 190 സൗജന്യ മോഡൽ ഓഫറുകളുണ്ട്.
Tool calling എന്നത് function calling പോലെയാണോ?
അതെ. OpenAI ആദ്യം function calling എന്ന പേര് ഉപയോഗിച്ചു. ഇപ്പോഴത്തെ API tools ഉം tool_calls ഉം ഉപയോഗിക്കുന്നു. രണ്ട് പേരുകളും അർത്ഥമാക്കുന്നത്, ഒരു function പ്രവർത്തിപ്പിക്കാൻ മോഡൽ നിങ്ങളുടെ കോഡിനോട് ആവശ്യപ്പെടുന്നു എന്നാണ്.
OpenAI ഫോർമാറ്റിൽ Gemini tool calling പ്രവർത്തിക്കുമോ?
ഉവ്വ്, FreeLLMAPI വഴി. gateway OpenAI tools-നെ Gemini functionDeclarations ആയി പരിവർത്തനം ചെയ്യുകയും ഉത്തരം OpenAI tool_calls ആയി തിരികെ പരിവർത്തനം ചെയ്യുകയും ചെയ്യുന്നു.
tool calls streaming ചെയ്യാമോ?
ഉവ്വ്. stream=True ഉപയോഗിച്ചാൽ delta.tool_calls chunks ഉം tool_calls എന്ന അന്തിമ finish_reason ഉം ലഭിക്കുന്നു. parse ചെയ്യുന്നതിന് മുമ്പ് argument chunks ചേർക്കുക.
അനുബന്ധ ഗൈഡുകൾ
- AI ഏജന്റുകൾക്കുള്ള സൗജന്യ LLM API
- AI agent-കൾക്കുള്ള സൗജന്യ വെബ് സെർച്ച് API
- മികച്ച സൗജന്യ coding model API-കൾ
- 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 ൽ പരിശോധിച്ചത്)