import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.withhopper.com/v1",
apiKey: process.env.HOPPER_API_KEY,
});
const tools = [
{
type: "function" as const,
function: {
name: "get_balance",
description: "Return the account balance in dollars.",
parameters: {
type: "object",
properties: { account_id: { type: "string" } },
required: ["account_id"],
},
},
},
];
const response = await client.chat.completions.create({
model: "gemma-4-31b",
messages: [{ role: "user", content: "What is the balance on account a-17?" }],
tools,
});
console.log(response.choices[0].message.tool_calls);