import { ReyGrid, ReyGridAuthError, ReyGridNetworkError } from "reygrid";
const client = new ReyGrid({ apiKey: process.env.REYGRID_API_KEY });
try {
const usage = await client.getUsage();
console.log(`Usage: ${usage.total} / ${usage.quotaLimit}`);
const res = await client.chat("{AgentId}", "Hello!", { userId: "user-42" });
console.log(res.output.reply.content);
} catch (err) {
if (err instanceof ReyGridAuthError) console.error("Invalid API key");
else if (err instanceof ReyGridNetworkError) console.error("Network problem:", err.message);
else throw err;
}