Function calling
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending
.mdto the page URL.
Function calling (also known as tool calling) provides a powerful and flexible way for OpenAI models to interface with external systems and access data outside their training data. This guide shows how you can connect a model to data and actions provided by your application. We'll show how to use function tools (defined by a JSON schema) and custom tools which work with free form text inputs and outputs.
For Agents API sessions, use Functions to register functions and handle session action requests. The examples in this guide show the Responses API and Chat Completions integrations.
If your application has many functions or large schemas, you can pair function calling with tool search to defer rarely used tools and load them only when the model needs them. Only gpt-5.4 and later models support tool_search.
GPT-6 Astra requires the Responses API for tool calling. The Chat Completions examples use GPT-5.6 for compatibility. See the migration guide to update an existing integration.