Function Calling (also called tool calling) is a way for OpenAI models to interact with external systems and access information beyond their training data. In an API request, the application can provide the model with a set of tools; based on the prompt, the model decides whether to call a tool and returns a call request containing arguments; the application executes the corresponding code and passes the tool output back to the model, which then generates a final text reply or makes further tool calls.
Main capabilities:
- Function tools: defined with JSON Schema, supporting features such as property types, enums, descriptions, nested objects, and recursive objects, which the model uses to pass data to the application.
- Custom tools: use free-text input and output.
- Built-in tools: the platform also provides built-in tools such as web search, code execution, and access to MCP servers.
- Tool search: when the application has many functions or large Schemas, tool search can be used to defer loading infrequently used tools and load them only when the model needs them; the material states that only gpt-5.4 and later models support tool_search.
- Namespaces: related tools can be grouped by domain such as crm, billing, and shipping, helping the model choose among tools with different purposes.
Usage (five-step process):
- Send a request to the model along with the list of tools it can call;
- Receive the tool calls returned by the model;
- On the application side, execute code based on the call inputs;
- Send another request to the model with the tool outputs;
- Receive the model's final reply (or more tool calls). When using the Responses API, the application can continue this process as many times as the task requires, making any number of tool calls. The examples in the material cover Responses API and Chat Completions integration; for Agents API sessions, register functions with Functions and handle session action requests.
Applicable scenarios: examples listed in the material include getting the current day's weather for a location, accessing account details by user ID, issuing a refund for a lost order, and other operations where the model should know about or be able to perform something when answering a prompt.
Limitations and notes:
- Tool calling for GPT-6 Astra and GPT-6.1 Sol requires the Responses API; the Chat Completions example uses GPT-5.6 Terra with reasoning disabled.
- For reasoning models such as GPT-5 and o4-mini, the reasoning items returned along with tool calls in the model responsemust be passed back together with the tool call outputs.
- Tool call outputs can be structured JSON, plain text, image content, or file content, and must reference the specific model tool call (such as call_id).
- The material does not provide specific pricing, cost, or quota information.