होम / गाइड / Function calling वाला मुफ़्त LLM API

Function calling वाला मुफ़्त LLM API

Function calling, या tool calling, LLM को आपके code से एक function चलाने के लिए कहने देता है। Agents, लाइव डेटा वाले chat bots और संरचित extraction सभी इसका उपयोग करते हैं। FreeLLMAPI catalog में tool calling वाले 190 मुफ़्त model विकल्प हैं। आप OpenAI-style tools भेजते हैं, और gateway उन्हें हर provider के लिए बदलता है।

कोड, मॉडल नाम और लाइव कैटलॉग लेबल अंग्रेज़ी में दिखाए गए हैं।

FreeLLMAPI के माध्यम से tool calling कैसे काम करता है

  1. आप messages और tools की एक सूची भेजते हैं। हर tool का एक नाम, एक विवरण और उसके parameters के लिए एक JSON Schema होता है।
  2. Model tool_calls और finish_reason: "tool_calls" के साथ उत्तर देता है। वह स्वयं कुछ नहीं चलाता।
  3. आपका code function चलाता है और परिणाम को role: "tool" वाले message के रूप में जोड़ता है।
  4. आप बातचीत फिर से भेजते हैं। Model परिणाम का उपयोग करके अंतिम उत्तर लिखता है।

Groq, Cerebras, Mistral, OpenRouter और Cloudflare जैसे OpenAI-compatible providers अनुरोध को जैसा है वैसा ही पाते हैं। Gemini के लिए, FreeLLMAPI tools को Google के functionDeclarations format में बदलता है और उत्तर वापस बदलता है। हर provider के लिए आपका code एक जैसा है।

कुछ models tool call को असली tool call के बजाय सादे text में लिखते हैं। FreeLLMAPI इन्हें पहचानता है और असली tool_calls में बदल देता है।

आज tool calling वाले मुफ़्त models

तालिका tool calling वाले सबसे मज़बूत मुफ़्त models दिखाती है। डेटा लाइव catalog से आता है। Agents के लिए, context size भी जांचें, क्योंकि tool definitions और परिणाम बहुत से tokens लेते हैं।

Tool calling वाले मुफ़्त models, सबसे मज़बूत पहले
मॉडलमुफ़्त उपलब्धकॉन्टेक्स्टमुफ़्त सीमाएँ (सबसे अच्छा विकल्प)टूलविज़न
GLM 5.3UnoRouter1M1 अनुरोध/मिनट
1 req/min per model
हाँनहीं
Qwen3.8 MaxACLIDE-€20/month shared internal usage credits · no cardहाँनहीं
GLM 5.3 FlashNVIDIA NIM, UnoRouter1M40 अनुरोध/मिनट
40 RPM
हाँहाँ
Gemini 3.8 FlashGoogle AI Studio1MRecurring provider quotaहाँहाँ
Gemini Flash (latest alias)Google AI Studio-10 अनुरोध/मिनट
20 अनुरोध/दिन
250,000 टोकन/मिनट
~3M
हाँहाँ
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
हाँहाँ
Gemini 3.6 FlashGoogle AI Studio1M10 अनुरोध/मिनट
20 अनुरोध/दिन
250,000 टोकन/मिनट
~3M
हाँहाँ
Qwen 3.8 27BCloudflare Workers AI262KShared 10k neurons/dayहाँहाँ
Gemini 3.5 FlashGoogle AI Studio1M10 अनुरोध/मिनट
20 अनुरोध/दिन
250,000 टोकन/मिनट
~3M
हाँहाँ

146 मिलते-जुलते मुफ़्त मॉडल में से 15 दिखाए जा रहे हैं। सभी मॉडल देखें.

FreeLLMAPI कैटलॉग से लाइव डेटा (संस्करण 2026.11.19, जाँच 2026-11-19)। मुफ़्त सीमाएँ अक्सर बदलती हैं। कैटलॉग की हर दिन जाँच होती है।

चरण 1: FreeLLMAPI इंस्टॉल करें और keys जोड़ें

FreeLLMAPI open source है। यह आपके कंप्यूटर पर Docker में चलता है। आपकी provider keys आपके कंप्यूटर पर रहती हैं।

इंस्टॉल करें (macOS या Linux)

curl -fsSL https://freellmapi.co/install.sh | bash

http://localhost:3001 पर dashboard खोलें। Keys page पर तीन या अधिक providers की keys जोड़ें। Tool loop एक कार्य के लिए कई अनुरोध भेजता है, इसलिए अधिक keys अधिक जगह देती हैं। उसी page से अपनी unified key कॉपी करें।

चरण 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: model अंतिम उत्तर दे, तब तक 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 जोड़ें।

संरचित डेटा पाने के लिए tool उपयोग करें

Tool calling एक तय आकार में डेटा पाने का भी अच्छा तरीका है। एक tool परिभाषित करें जिसके parameters वे फ़ील्ड हों जो आप चाहते हैं। tool_choice को "required" पर सेट करें, ताकि model को tool call करना ही पड़े। फिर 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 की जांच अपने code से करें। Model कोई आवश्यक फ़ील्ड छोड़ सकता है या गलत प्रकार भेज सकता है। यदि जांच विफल हो, तो error वापस भेजें और फिर से पूछें।

सुरक्षा: payments, emails या file deletion जैसे side effects वाले tool calls बिना जांच के न चलाएं। ऐसी कार्रवाइयों से पहले उपयोगकर्ता से पुष्टि लें।

आम गलतियां

  • Arguments एक string हैं: function.arguments एक JSON string है। इसे parse करें, और errors पकड़ें। छोटे models कभी-कभी ऐसा JSON भेजते हैं जो मान्य नहीं होता।
  • ids मिलाएं: हर tool message को अपने call की tool_call_id चाहिए। Tool messages से पहले tool_calls वाला assistant message जोड़ें।
  • एक साथ कई calls: Model एक उत्तर में एक से अधिक tool calls लौटा सकता है। उन सभी को चलाएं, फिर सभी परिणाम भेजें।
  • Token लागत: हर tool definition हर अनुरोध के साथ भेजी जाती है। बीस बड़े tools हज़ारों tokens ले सकते हैं और कम tokens-per-minute limit को जल्दी छू सकते हैं। केवल वही tools भेजें जो कार्य को चाहिए।
  • स्पष्ट विवरण: Model tool को उसके नाम और विवरण से चुनता है। एक छोटा वाक्य लिखें जो बताए कि tool क्या करता है और कब उपयोग करें।
  • Loop रोकें: अधिकतम rounds की संख्या सेट करें। कमज़ोर model एक ही tool को बार-बार call कर सकता है।
  • Tools के बिना models: कुछ मुफ़्त providers tools समर्थित नहीं करते। उदाहरण के लिए, AI Horde tools हटा देता है और सादे chat के रूप में उत्तर देता है।
कार्य के दौरान एक ही model: FreeLLMAPI एक बातचीत को 30 मिनट तक एक model पर रखता है। Tool loop आम तौर पर एक ही model पर रहता है। यदि कोई limit बदलाव मजबूर करे, तो अगले model को tool परिणामों समेत पूरा message history मिलता है।

समस्या निवारण

समस्याकारणसमाधान
Model text में उत्तर देता है और कोई tool call नहीं करताModel tools में कमज़ोर है, या विवरण स्पष्ट नहीं हैतालिका से मज़बूत model पिन करें, या tool का विवरण सुधारें
Arguments पर json.JSONDecodeErrorModel ने मान्य न होने वाला JSON भेजाError पकड़ें और उसे tool परिणाम के रूप में वापस भेजें, ताकि model फिर से प्रयास कर सके
Tool message के बारे में Error 400tool_call_id मेल नहीं खाता, या assistant message नहीं हैपहले assistant message जोड़ें, फिर हर call के लिए एक tool message
Agent कार्य के दौरान Error 429Loop कई बड़े अनुरोध भेजता हैअधिक provider keys जोड़ें, और कम tools भेजें
Loop नहीं रुकताModel वही tool फिर से call करता हैRound limit सेट करें, और स्पष्ट परिणाम लौटाएं
इनमें से हर एक का उपयोग एक ही कुंजी से करें। FreeLLMAPI एक ओपन-सोर्स, सेल्फ़-होस्टेड राउटर है। यह इन सभी मुफ़्त टियर को एक OpenAI-संगत एंडपॉइंट के पीछे रखता है। जब कोई एक सीमा पर पहुँचता है, तो यह अगले प्रदाता पर स्विच कर देता है। कैटलॉग देखें या शुरू करें.

अक्सर पूछे जाने वाले प्रश्न

कौन सी मुफ़्त LLM APIs function calling समर्थित करती हैं?

Gemini, Groq, Cerebras, Mistral, OpenRouter, Cloudflare और अन्य providers के पास tool calling वाले मुफ़्त models हैं। FreeLLMAPI catalog में आज tools वाले 190 मुफ़्त model विकल्प हैं।

क्या tool calling, function calling के समान है?

हां। OpenAI ने पहले function calling नाम उपयोग किया। वर्तमान API tools और tool_calls उपयोग करता है। दोनों नामों का अर्थ है कि model आपके code से एक function चलाने के लिए कहता है।

क्या OpenAI format के साथ Gemini tool calling काम करता है?

हां, FreeLLMAPI के माध्यम से। Gateway OpenAI tools को Gemini functionDeclarations में बदलता है और उत्तर को वापस OpenAI tool_calls में बदलता है।

क्या मैं tool calls को stream कर सकता हूं?

हां। stream=True के साथ आपको delta.tool_calls chunks मिलते हैं और अंत में finish_reason tool_calls। Parse करने से पहले argument chunks जोड़ें।

संबंधित गाइड

स्रोत

सभी गाइड · सभी मुफ़्त मॉडल देखें