Key facts
| Shape | OpenAI-compatible tools array and tool_calls response |
| Loop | The model returns tool calls, your code executes them and returns role=tool results |
| Parallel calls | Multiple tool calls in one response, dispatched concurrently |
| tool_choice | Force a named tool, auto, or none |
| JSON mode | response_format set to json_object for guaranteed JSON output |
| Strict schemas | strict:true forces the exact schema with no extra fields |
| Frameworks | LangChain, LlamaIndex, Vercel AI SDK and the OpenAI SDKs |
| Product status | Live |
TL;DR
- Tools are JSON Schema objects with descriptions and required fields.
- Parallel tool calls and tool_choice are supported with the OpenAI shape.
- Strict mode forces the model to match your schema exactly.
- Count on 5-20 tools in practice; more makes selection unreliable.
- Combine with the agents API when you want retries, memory and audit logs.
How it works, step by step
- Define tools as JSON Schema objects with clear field descriptions.
- Send them in the tools array on /v1/chat/completions.
- Detect tool_calls in the response and parse the JSON arguments.
- Execute your function and append a role=tool message with the result.
- Loop until the model returns a normal message with no tool calls.
- Add tool_choice or strict mode where you need determinism.
- Return tool errors as payloads the model can see and react to.
Try it yourself
Open the function calling tester →
The function calling loop
The loop has five steps: send the conversation plus your tools array, receive either normal text or one or more tool calls, execute the requested functions, append a role=tool message with each result, and continue until the model answers without asking for tools.
Because the shape matches OpenAI, the same loop works with the official SDKs and with frameworks such as LangChain, LlamaIndex and the Vercel AI SDK. Plugsky validates arguments against your schema before returning the call to your code.
Tool definition rules
Tools are JSON Schema objects. Use type: object with properties and required, and support string, number, integer, boolean, array, enum and nested objects. Descriptions on every field matter because the model uses them to decide what to call and when.
Keep the tool count deliberate. The live guidance is that 5-20 tools is the sweet spot; beyond that the model struggles to choose correctly, and every definition consumes context on each request.
The same platform exposes 30+ models, so you can run cheap models for routine tool calls and stronger models for planning steps.Parallel calls, JSON mode and agents
Plugsky supports parallel function calls, so the model can return several tool calls in one response and your code can dispatch them concurrently. tool_choice lets you force a specific tool, while response_format set to json_object guarantees JSON output. With strict: true on a tool, the model must use exactly the schema you provide.
When you want managed retries, memory and audit logs, combine function calling with the AI agents API. Otherwise the loop above scales to any number of tools and steps.
Honest comparison
| Feature | Plugsky | Roll-your-own dispatch | Non-compatible providers |
|---|---|---|---|
| Tool call shape | OpenAI tool_calls | You define the protocol | Varies |
| Parallel calls | Supported | You dispatch | Rare |
| JSON mode | response_format json_object | Prompt engineering | Varies |
| Strict schema | strict:true supported | You validate | Rare |
| Frameworks | Drop-in with OpenAI SDKs | Custom glue | Per-vendor SDK |
| Managed agents | Agent runtime with memory and logs | You build retries and logging | Varies |
Frequently asked questions
How many tools can I define?
There is no hard limit, but 5-20 tools is the practical sweet spot. More than that and the model struggles to pick the right one.
Can I force the model to call a specific tool?
Yes. Set tool_choice to a named function, or use auto and none to control whether tools may be called at all.
Does streaming work with function calling?
Yes. With stream set to true the model streams the text portion and emits the tool call when it is ready.
What happens if my tool throws an error?
Catch it in your code and return an error message as the tool result. The model sees the error and can retry or surface it to the user.
Is the tools shape identical to OpenAI?
Yes. The tools array, tool_choice and tool call response shape match, so existing function-calling code works after a base_url change.
Do I need the agents API to use tools?
No. A single tool-calling loop can run in your own code. The agents API adds managed retries, memory and replayable audit logs.
Plugsky (2026). “Function Calling API: OpenAI Tool Use”. Plugsky. Available at: https://plugsky.com/articles/function-calling-api (last updated 2026-09-25).