Tool calls
Pass OpenAI-style tools when the model supports capabilities.tools.
const response = await client.inference.chat({
model: "openai:gpt-4o-mini",
messages: [{ role: "user", content: "What is the weather in Lisbon?" }],
tools: [
{
type: "function",
function: {
name: "get_weather",
description: "Get weather for a city",
parameters: {
type: "object",
properties: {
city: { type: "string" },
},
required: ["city"],
},
},
},
],
});
Notes
- Confirm
toolsin model metadata before relying on tool calling - Tool definitions may affect pricing (
cost.toolCallswhen present) - Your app is responsible for executing tools and sending follow-up messages
List capable models: Models.