Skip to main content
Function calling lets a model ask your code to run a function you declared, then continue with the result. It uses the standard OpenAI tools format.

Define functions

Complete example

Supported models

Function calling works on models whose supported_features include tools. Query GET /v1/models before selecting one.

Model Context Protocol (MCP)

MCP clients work with this API out of the box. Convert each MCP tool definition to an OpenAI tools entry (the MCP name, description, and inputSchema map directly to function.name, function.description, and function.parameters), send the request, and execute the returned tool_calls against your MCP server. No special endpoint is required: MCP runs on the standard tool-calling shown above.

Structured outputs

Chat completions

Agent frameworks