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

List capable models: Models.