Skip to content

Function tools

Run client-side functions requested by a model.

SingleAPI supports client-executed function tools. Your application describes a function in a chat request. The model may ask to use it; your application runs the function and sends its result in a second request. SingleAPI carries the messages between your application and the model provider. It does not run your function.

The request flow

  1. Send a chat request with a tools entry describing a function your application can run. Choose a model that supports tool calling.
  2. If the response contains tool_calls, read each call's name and JSON arguments. Your application validates those arguments and runs the matching function.
  3. Add the assistant's tool-call message and a role: "tool" message containing the result and matching tool_call_id to the conversation. Send a new chat request. Include the tool definition again if the model may need it for another call.
  4. Read the model's answer or handle another tool call. Your application controls when to stop.

The first and follow-up model calls are separate inference requests. Managed requests are charged separately; running your own function may also have costs outside SingleAPI.

For the exact tools, tool_choice, response and follow-up message shapes, see tool calling in the API reference. For an OpenAI SDK setup, start with the quickstart.

Current limits

SingleAPI accepts OpenAI-style type: "function" tools. Provider web search and Anthropic web fetch are separate, explicitly enabled features. Other provider-hosted tools, custom tool types, automatic client-function execution and an automatic agent loop are not included. parallel_tool_calls is not supported. With streaming, tool-call arguments can arrive in pieces; collect them before parsing JSON. Provider support varies by model.

The API reference lists all supported fields and limits.

Need a hand?

Manage your keys, credits and usage from the dashboard.

Open the dashboard