Skip to main content
Tool calling lets the model request named functions with JSON arguments; your code runs them and returns results in the conversation. SUPA accepts the same tool schemas as OpenAI Chat Completions.

OpenAI SDK

Use tools on chat.completions.create. Define each tool with type: 'function' and a JSON Schema in function.parameters.
If the model issues a tool call, message.tool_calls contains the function name and arguments string. Parse the arguments, run your function, and send a follow-up request with role: 'tool' messages (or continue the loop until the model responds with text only).

Vercel AI SDK

Use generateText with tool and Zod inputSchema. Reuse the same SUPA provider as in the Vercel AI SDK guide.

TanStack AI

Define tools with toolDefinition and .server() for the implementation. Use the same adapter configuration as in the TanStack AI guide.