SuperAPIAI Directory

OpenAI Function Calling

platform.openai.com · AI developer platforms

OpenAI Function Calling (also known as tool calling) is a mechanism by which OpenAI models interact with external systems, allowing the model, while generating a response, to call functions or custom tools provided by the application in order to obtain information beyond its training data or to perform operations. Developers define functions via JSON Schema; the model determines based on the prompt whether a call is needed and returns a tool call request containing arguments; the application executes the corresponding code and passes the result back to the model, which then generates the final response. This mechanism supports integration with the Responses API and Chat Completions, and is suitable for scenarios requiring real-time data, business operations, or external system integration.

Open website Alternatives

About this tool

OpenAI Function Calling (tool calling) is a mechanism provided by the OpenAI platform that enables large language models to connect to external data and systems. When generating a response, the model can determine whether it needs to call tools predefined by the developer, thereby obtaining information beyond its training data or performing specific operations.

Key capabilities:

  • Function tools: Define functions using JSON Schema, including parameter types, enums, descriptions, nested objects, etc., based on which the model can generate call requests.
  • Custom tools: Tools that support free-text input and output.
  • Built-in tools: The platform also provides built-in tools such as web search, code execution, and MCP server access.
  • Tool search: When there are many functions or the schema is large, tool_search can be combined to lazily load infrequently used tools; only supported by gpt-5.4 and later models.
  • Namespaces: Related tools can be grouped by domain (such as crm, billing, shipping).

Usage: Tool calling is a multi-step conversation flow:

  1. Send a request to the model and provide the list of callable tools in the tools parameter.
  2. The model returns a tool call request containing the tool name and arguments.
  3. The application executes code using the input provided by the model.
  4. Pass the tool output (structured JSON, plain text, images, or file content) back to the model along with the original request and the tool call.
  5. The model generates the final response, or continues to make more tool calls.

This guide provides integration examples for the Responses API and Chat Completions. For Agents API sessions, you can use Functions to register functions and handle session operation requests. GPT-6 Astra and GPT-6.1 Sol require the Responses API for tool calling; the Chat Completions example uses GPT-5.6 Terra with reasoning disabled. For reasoning models (such as GPT-5 or o4-mini), the reasoning items returned in the model response need to be passed back along with the tool call output.

Applicable scenarios:

  • Obtaining real-time data, such as querying weather or account details.
  • Performing operations, such as initiating refunds or bookings.
  • Connecting to external systems or APIs to extend model capabilities.

Limitations:

  • Tool calling requires the application to implement the execution logic; the model only generates call requests.
  • Some advanced features (such as tool_search) have modelversion requirements.
  • Different models have different API requirements; refer to the migration guide.
  • Specific information such as fees and pricing is not yet provided.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools