Skip to main content
Tool use is supported on both the Responses API (/ai/v2/responses — the recommended surface for new integrations) and Completions V2 (/ai/v2/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).
Completions V1 is Deprecated: /ai/v1/chat/completions is the legacy Completions V1 endpoint and is no longer recommended. Migrate to either the Responses API (recommended for new integrations) or Completions V2 — this guide covers both.
Adding Tools to the Completions API allows you to grow your experience with Gloo AI, adding capabilities that are human flourishing.

Extended Capabilities Beyond Text Generation

All models are excellent at language generation, but they can’t access real-time data or perform calculations natively. Tools allow the model 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).
This turns the AI into a universal interface for diverse tasks.

Automation of Multi-Step Workflows

By using tools, Gloo AI models can:
  • 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 is vital for real-world applications where AI becomes a true assistant rather than just a chatbot.

Improved Accuracy and Reliability

Rather than “hallucinating” answers, the model can use tools to ground its outputs in real data. By delegating precision tasks like date parsing, data lookup, or logic execution to deterministic systems, you reduce the chance of errors and make the AI trustworthy in mission-critical scenarios.

Using Tools with the Responses API

The Responses API (/ai/v2/responses) is the recommended endpoint for new integrations and supports the same function-calling capability as Completions V2. Tool definitions use the identical OpenAI function schema{"type": "function", "function": { ... }}. 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.

Defining tools

Send tools (and optionally tool_choice) alongside input. Because Gloo is OpenAI-compatible, you can use the official OpenAI SDKs — set the base URL to /ai/v2 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.

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

Gloo provides several models with tooling support. For a complete and up-to-date list of all available models and their specific capabilities, please see our Supported Models Guide.

Tool Calling with V2 Routing

Tool calling works seamlessly with all Completions V2 routing mechanisms:
  • AI Core (auto_routing: true): Gloo automatically selects the best model for your tools based on query complexity
  • AI Core Select (model_family): Tools work with your preferred provider family (OpenAI, Anthropic, Google, Open Source)
  • AI Select (model): Direct model selection with explicit tool support
For details on routing mechanisms, see the Completions V2 Guide.

Supported Models for Tool Use

Gloo V2 provides multiple models with tool calling support across different providers:
For the complete list of supported models and their capabilities, see our Supported Models Guide.

Using cURL

cURL

Using the OpenAI SDK (Python)

Using Inngest’s AgentKit SDK (TypeScript)

TypeScript

Example Response

JSON