Functions Usage
Portkey supports the OpenAI signature to define functions as part of the API request. The tools parameter accepts functions which can be sent specifically for models that support function/tool calling.
NodeJS
Python
OpenAI NodeJS
OpenAI Python
cURL
On completion, the request will get logged in the logs UI where the tools and functions can be viewed. Portkey will automatically format the JSON blocks in the input and output which makes a great debugging experience.
Portkey’s Prompt Library supports creating prompt templates with function/tool definitions, as well as letting you set the tool choice param. Portkey will also validate your tool definition on the fly, eliminating syntax errors.
Supported Providers and Models
The following providers are supported for function calling with more providers getting added soon. Please raise a request or a PR to add model or provider to the AI gateway.
Cookbook
Here’s a detailed cookbook on function calling using Portkey.Last modified on March 24, 2026