Functions Usage
The AI Gateway supports the OpenAI signature to define functions. Pass the tools parameter to models that support function/tool calling.
OpenAI NodeJS
OpenAI Python
cURL
On completion, the request logs in Strata Cloud Manager where tools and functions are visible. The AI Gateway automatically formats the JSON blocks in the input and output for easier debugging.
Create prompt templates with function/tool definitions in the AI Gateway’s Prompt Library. Set the tool_choice parameter, and the AI Gateway validates your tool definition on the fly, eliminating syntax errors.
Supported Providers and Models
The AI Gateway provides native function calling support across all major AI providers.
If you discover a function-calling capable LLM that isn’t working with the AI Gateway, please let us know at support@portkey.ai.
Cookbook
See the detailed cookbook on function calling.Last modified on September 15, 2026