Skip to main content
Tool use (also called function calling) lets a model ask your application to run a function, such as looking up an order or checking a calendar. Your application runs it and sends the result back, and the model uses that result in its answer. Tool use is supported on both the Responses API (/ai/v2/guarded/responses) and Completions V2 (/ai/v2/guarded/chat/completions). Tool definitions use the identical OpenAI function schema on both endpoints; they differ only in how the request is framed (input vs messages) and how tool calls are returned (output[] typed items vs choices[].message.tool_calls). New to the idea? Tool Use (or Function Calling) in the AI Learning Center explains it in plain terms, and Tools and MCP in AI 104 walks through a full tool loop.

Using Tools with the Responses API

The Responses API (/ai/v2/guarded/responses) supports the same function calling as Completions V2, with the same tool definitions. The difference is on the response side: a tool call comes back as a typed function_call item inside the output[] array (rather than choices[].message.tool_calls).
The Responses API uses pinned models: pass the exact model you want. Auto-routing and model_family selection are Completions V2 features; use Completions V2 if you need them.
Besides your own functions, most OpenAI GPT-5 and GPT-6 models can use OpenAI’s hosted image_generation tool to draw images. See Image generation tool for the models that support it.

Defining tools

Send tools (and optionally tool_choice) alongside input. With the official OpenAI SDKs, set the base URL to /ai/v2/guarded and call responses.create.
Use the Chat Completions (nested) function schema, {"type": "function", "function": { ... }}, on the Responses API, the same schema Completions V2 uses. Pass that nested object even when calling the SDK’s responses.create (in TypeScript, add // @ts-ignore since the SDK types expect the flat Responses schema). The flat Responses tool schema is not reliably accepted across providers.
For a step-by-step build, follow the tool use tutorial.

Tool call output

When the model invokes a tool, the response contains a function_call item in output[]:
JSON

Returning a tool result (multi-turn)

Run your function, then continue the conversation by appending two items to input: the model’s function_call, followed by a function_call_output carrying the result under the matching call_id.
The model uses the tool result to produce its final answer as a message item. function_call and function_call_output items both require a matching call_id.

Using Tools with Completions V2

Many Gloo models support tools; the Supported Models Guide lists each model’s capabilities.
Completions V1 is Deprecated: /ai/v1/chat/completions is the legacy Completions V1 endpoint and is no longer recommended. Migrate to the Responses API or Completions V2; this guide covers both. New integrations can use Direct Responses or guarded Responses.

Tool Calling with V2 Routing

Tool calling works with all Completions V2 routing mechanisms: For details on routing mechanisms, see the Completions V2 Guide.

Supported Models for Tool Use

Examples by provider:

Calling a tool

JSON
TypeScript

What tools let you do

Language models are good at writing text, but on their own they can’t reach live data or do exact calculations. With tools, the model can ask your application to:
  • Fetch up-to-date information (e.g., weather, stock prices, calendars).
  • Execute code or math (e.g., calculate complex equations, generate charts).
  • Interact with databases, APIs, or internal systems (e.g., CRM updates, file searches, emails).
By using tools, Gloo AI models can also automate multi-step workflows:
  • Chain together steps in a workflow (e.g., “Analyze this document, then email a summary”).
  • Act like a coordinator between systems (e.g., Slack + GitHub + Notion integration).
  • Enable interactive applications where the AI can take actions and report back results.
This lets AI act as an assistant that gets work done, not only a chatbot that answers. Tools also improve accuracy and reliability. Rather than “hallucinating” answers, the model can use tools to ground its outputs in real data. Handing exact work such as date parsing, data lookup or calculations to your own code, which gives the same answer every time, means fewer errors where accuracy matters.
Validating arguments, bounding the tool loop, guarding side effects and getting reliable JSON are covered in Tools, Structured Output and Agents.

Next steps

Step-by-step tutorial

Structured output with tool use, step by step.

Responses

Tool use with the Responses API.

Before you ship

Handle errors and retries in production.