Provider

Free LLM API with function calling

Function calling, or tool calling, lets an LLM ask your code to run a function. Agents, chat bots with live data and structured extraction all use it. The FreeLLMAPI catalog has 190 free model offers with tool calling. You send OpenAI-style tools, and the gateway translates them for each provider.

How tool calling works through FreeLLMAPI

  1. You send the messages and a list of tools. Each tool has a name, a description and a JSON Schema for its parameters.
  2. The model answers with tool_calls and finish_reason: "tool_calls". It does not run anything itself.
  3. Your code runs the function and adds the result as a message with role: "tool".
  4. You send the conversation again. The model uses the result to write the final answer.

OpenAI-compatible providers, such as Groq, Cerebras, Mistral, OpenRouter and Cloudflare, get the request as it is. For Gemini, FreeLLMAPI translates the tools into Google’s functionDeclarations format and translates the answer back. Your code is the same for every provider.

Some models write a tool call as plain text and not as a real tool call. FreeLLMAPI detects these and changes them into real tool_calls.

Free models with tool calling today

The table shows the strongest free models with tool calling. The data comes from the live catalog. For agents, also check the context size, because tool definitions and results use many tokens.

Free models with tool calling, strongest first
ModelFree onContextFree limits (best offer)ToolsVision
GLM 5.3UnoRouter1M1 req/min
1 req/min per model
YesNo
Qwen3.8 MaxACLIDE-€20/month shared internal usage credits · no cardYesNo
GLM 5.3 FlashNVIDIA NIM, UnoRouter1M40 req/min
40 RPM
YesYes
Gemini 3.8 FlashGoogle AI Studio1MRecurring provider quotaYesYes
Gemini Flash (latest alias)Google AI Studio-10 req/min
20 req/day
250,000 tokens/min
~3M
YesYes
Qwen3.8 Flash NextAMD Radeon Cloud262KRecurring daily account allowanceYesNo
Qwen3.8 FlashElectronHub1M$0.25/week shared recurring creditYesYes
Gemini 3.7 FlashGoogle AI Studio1M10 req/min
20 req/day
250,000 tokens/min
~3M
YesYes
GPT-5.6 LunaElectronHub1M$0.25/week shared recurring creditYesYes
Dots3 Note PreviewKilo Gateway, OpenRouter512K20 req/min
50 req/day
50 req/day account-wide (1,000 after a $10 purchase)
YesYes
DeepSeek V4 FlashAMD Radeon Cloud, BazaarLink, ElectronHub1M10 req/min
50 req/day
Shared rate limit
YesNo
Qwen3.8 27BElectronHub, Groq, OVH AI Endpoints262K30 req/min
250 req/day
70,000 tokens/min
~6M
YesYes
Gemini 3.6 FlashGoogle AI Studio1M10 req/min
20 req/day
250,000 tokens/min
~3M
YesYes
Qwen 3.8 27BCloudflare Workers AI262KShared 10k neurons/dayYesYes
Gemini 3.5 FlashGoogle AI Studio1M10 req/min
20 req/day
250,000 tokens/min
~3M
YesYes

Showing 15 of 146 matching free models. See all models.

Live data from the FreeLLMAPI catalog (version 2026.11.19, checked 19 November 2026). Free limits change often. The catalog is checked every day.

Step 1: Install FreeLLMAPI and add keys

FreeLLMAPI is open source. It runs on your computer in Docker. Your provider keys stay on your computer.

Install (macOS or Linux)

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

Open the dashboard at http://localhost:3001. Add keys from three or more providers on the Keys page. A tool loop sends several requests for one task, so more keys give more room. Copy your unified key from the same page.

Step 2: Run a complete tool loop

curl: the first request

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 until the model gives a final answer

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 also works with stream=True. You get delta.tool_calls chunks, then a final chunk with finish_reason: "tool_calls". Join the argument chunks before you parse the JSON.

Use a tool to get structured data

Tool calling is also a good way to get data in a fixed shape. Define one tool whose parameters are the fields that you want. Set tool_choice to "required", so that the model must call a tool. Then read the arguments. You do not need to run any function.

Python: extract fields with a required 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))

Validate the arguments with your own code. A model can leave out a required field or send a wrong type. If the check fails, send the error back and ask again.

Safety: do not run tool calls with side effects, such as payments, emails or file deletion, without a check. Ask the user to confirm these actions first.

Pitfalls

  • Arguments are a string: function.arguments is a JSON string. Parse it, and catch errors. Small models sometimes send JSON that is not valid.
  • Match the ids: each tool message needs the tool_call_id of its call. Add the assistant message with the tool_calls before the tool messages.
  • Several calls at once: a model can return more than one tool call in one answer. Run all of them, then send all results.
  • Token cost: each tool definition is sent with every request. Twenty large tools can use thousands of tokens and reach a low tokens-per-minute limit fast. Send only the tools that the task needs.
  • Clear descriptions: the model chooses a tool from its name and description. Write one short sentence that says what the tool does and when to use it.
  • Stop the loop: set a maximum number of rounds. A weak model can call the same tool again and again.
  • Models without tools: some free providers do not support tools. For example, AI Horde drops the tools and answers as plain chat.
Same model during a task: FreeLLMAPI keeps a conversation on one model for 30 minutes. A tool loop usually stays on one model. If a limit forces a change, the next model gets the full message history, including the tool results.

Troubleshooting

ProblemCauseFix
The model answers in text and calls no toolThe model is weak at tools, or the description is not clearPin a stronger model from the table, or improve the tool description
json.JSONDecodeError on argumentsThe model sent invalid JSONCatch the error and send it back as the tool result, so the model can try again
Error 400 about a tool messageThe tool_call_id does not match, or the assistant message is missingAdd the assistant message first, then one tool message for each call
Error 429 during an agent taskThe loop sends many large requestsAdd more provider keys, and send fewer tools
The loop does not stopThe model calls the same tool againSet a round limit, and return clear results
Use every one of these through one key. FreeLLMAPI is an open-source, self-hosted router that puts all these free tiers behind a single OpenAI-compatible endpoint and fails over when one is rate-limited. Browse the catalog or go live.

Frequently asked questions

Which free LLM APIs support function calling?

Gemini, Groq, Cerebras, Mistral, OpenRouter, Cloudflare and other providers have free models with tool calling. The FreeLLMAPI catalog has 190 free model offers with tools today.

Is tool calling the same as function calling?

Yes. OpenAI first used the name function calling. The current API uses tools and tool_calls. Both names mean that the model asks your code to run a function.

Does Gemini tool calling work with the OpenAI format?

Yes, through FreeLLMAPI. The gateway translates OpenAI tools into Gemini functionDeclarations and translates the answer back into OpenAI tool_calls.

Can I stream tool calls?

Yes. With stream=True you get delta.tool_calls chunks and a final finish_reason of tool_calls. Join the argument chunks before you parse them.

Sources

All guides · Browse all free models

Keep reading

All posts →
Provider

Free Gemini API

Google AI Studio's permanent free tier — Gemini and Gemma, no credit card.

Provider

Free DeepSeek API

DeepSeek V3, R1 and V4 served free across multiple providers.

Provider

Free Llama API

Meta's Llama models free across 14 providers, behind one key.