Tool calling
Tool calling lets models invoke functions you define. Gateway passes your tool definitions to the model, the model suggests which tool to call with what arguments, and your application executes it and sends back the result. This works identically across all providers — Gateway handles format translation.
Define tools
Tools are defined as function objects with a name, description, and a JSON Schema for the parameters.
Send a request with tools
Handle the response
When the model calls a tool, the response contains a tool_use content block with finish_reason: "tool_use".
Send tool results
After executing the function, send the result back with a tool_result input to continue the conversation.
Tool choice
Control whether and how the model uses tools.
OpenAI SDK
Tool calling works through the OpenAI SDK with a simple update of changing the base url and API key.
FAQ
Which models support tool calling?
Any model with capabilities.tools: true supports tool calling. Check via GET /v1/models or the Gateway dashboard. Most recent models from OpenAI, Anthropic, and Google support it.
Can the model call multiple tools at once?
Yes. The response may contain multiple tool_use content blocks. Send a tool_result for each one before continuing the conversation.
Does Gateway validate tool parameters?
No. Tool parameter schemas are passed directly to the provider. Validation is handled by the model and your application.