Open a prepaid session
const session = await client.createPrepaidSession({
agentAuth: "AGENT_AUTHORITY",
budgetUsdc: 5.0,
});
Send messages
const response = await client.sendMessageWithBudget({
sessionId: session.sessionId,
message: "Analyze this dataset",
});
// Follow up
const follow = await client.sendMessageWithBudget({
sessionId: session.sessionId,
message: "Now compare it with last month's data",
});
Close and refund
const result = await client.closeSession(session.sessionId);
console.log(`Refunded: $${result.refunded}`);

