Short answer. OpenAI, Anthropic, Gemini, Groq and MCP all expose tool calling, but the wire formats differ. OpenAI's Chat Completions uses
toolsandtool_calls; Responses usesfunction_callandfunction_call_outputitems; Anthropic usestool_useandtool_resultblocks; Gemini uses function declarations and function-result steps; MCP uses JSON-RPCtools/listandtools/call. Pick the protocol your code can actually validate.
What a tool calling API must do
At minimum, the API must accept a tool definition with a name, description and JSON schema, return a structured call with a stable identifier, and accept a result correlated to that identifier. If any of those is missing, you are parsing prose and hoping.
The second requirement is less obvious: the API must tell you when it did not call a tool. A model that returns a final answer is a valid outcome. A model that returns an empty string, a malformed JSON blob or a call to a tool you never declared is not. Your dispatcher should treat all three as errors, not as a reason to retry blindly.
Protocol shapes compared
| Protocol | Request field | Call shape | Result shape | Strict mode |
|---|---|---|---|---|
| OpenAI Chat Completions | tools[], externally tagged | message.tool_calls[] | role: tool with tool_call_id | Off by default |
| OpenAI Responses | tools[], internally tagged | output[] with function_call | function_call_output with call_id | Attempted by default |
| Anthropic Messages | tools[] with input_schema | tool_use content block | tool_result with tool_use_id | Optional strict |
| Gemini Interactions | tools[] with type: function | function_call step | function_result with call_id | Schema-defined |
| MCP | tools/list | Tool descriptor plus arguments | tools/call result content | Server-defined |
Shapes are from the linked specifications and guides, checked 20 November 2026. A compatibility layer may accept one shape and silently ignore fields from another.
Reliability rules that matter more than price
- Allowlist tools by name. Never execute a function the model invented. Compare the returned name to a fixed map.
- Validate arguments against the schema. JSON parsing is not validation. Check types, required fields and enums before touching a database.
- Use idempotency keys for writes. A timeout does not mean the write failed. Retrying a refund or an email without a key can duplicate it.
- Cap steps and wall-clock time. A loop that never terminates is a budget incident, not just a bad answer.
- Return errors as data. Tell the model "not found" or "permission denied" in a structured result. Do not throw a stack trace into the conversation.
- Log the call ID, tool name, arguments and result. You cannot debug an agent from the final text alone.
These rules apply whether the API is free or paid. A free tier with a good dispatcher is safer than a paid tier with an unvalidated loop.
Code: a safe dispatcher
The dispatcher below takes a tool name and a JSON string, rejects unknown tools, validates the required field, enforces a timeout, and returns a structured error instead of raising into the model loop. It is deliberately small; add your own allowlist and idempotency store.
import json
from concurrent.futures import ThreadPoolExecutor, TimeoutError
ALLOWED = {"lookup_order": {"order_id"}}
def dispatch(name: str, arguments: str, timeout: float = 5.0):
if name not in ALLOWED:
return {"error": "tool_not_allowed", "tool": name}
try:
args = json.loads(arguments)
except json.JSONDecodeError:
return {"error": "invalid_json"}
missing = ALLOWED[name] - args.keys()
if missing:
return {"error": "missing_fields", "fields": sorted(missing)}
def run():
# Replace with a real, idempotent lookup.
return {"order_id": args["order_id"], "status": "shipped"}
with ThreadPoolExecutor(max_workers=1) as pool:
future = pool.submit(run)
try:
return future.result(timeout=timeout)
except TimeoutError:
return {"error": "tool_timeout", "tool": name}
Keep the dispatcher synchronous and boring. Async tool execution is fine, but the model loop should still have one place where a call is authorized, executed and logged.
Free options and their limits
Groq's free tier is the easiest to budget: 30 requests per minute, 1,000 per day, 8,000 tokens per minute and 200,000 tokens per day, with tool use on every hosted model. Plugsky's new-account free plan is 100 requests and 50,000 tokens per day, with an OpenAI-compatible tool format and Micro/Lite models. Gemini 3.8 Flash is free of charge for input and output, but the per-model limits are login-gated in AI Studio. Cloudflare's 10,000 Neurons per day are shared across models, and OpenRouter's free-model cap is 20 requests per minute with 50 per day under 10 credits.
None of these tiers is a production SLA. Use them to validate the schema and the dispatcher, then move the loop to a paid plan with published concurrency. For the free-tier comparison, see free AI APIs with tool calling. For the conceptual overview, see what is function calling and function calling versus MCP.
FAQ
What is a tool calling API?
An API that lets a model request a named function with structured arguments, then accepts the function result and continues. OpenAI, Anthropic, Gemini, Groq and MCP all implement a version of this contract.
Is tool calling free anywhere?
Yes, within free-tier limits. Groq, Plugsky, Gemini and Cloudflare all offer a free allowance that includes tool calling, but each has request, token or compute caps.
What is the difference between function calling and MCP?
Function calling is the model-to-application contract for a tool call. MCP is a protocol for discovering and executing tools across applications, using JSON-RPC. MCP can expose tools that a model then calls through function calling.
How do I validate tool arguments?
Parse the JSON, check required fields and types against the schema, reject unknown tools, and return a structured error. Do not pass raw model output into a database or shell.
Why do tool calls fail after a timeout?
The model may retry the same call, or your application may retry a write that already succeeded. Use idempotency keys and return a clear error result so the model can choose a different action.
Sources, checked 20 November 2026: OpenAI function calling · OpenAI migrate to Responses · Anthropic tool use · Gemini function calling · Model Context Protocol specification. Provider limits and prices can change; confirm them in the provider console before capacity planning.
Reviewed 20 November 2026. This page is maintained by the Plugsky editorial team. It describes published provider limits and does not promise that a free tier will remain unchanged.