@lumoauth/agent 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -357,6 +357,22 @@ var LumoAgent = class {
357
357
  async budget() {
358
358
  return this.agents.budget();
359
359
  }
360
+ /**
361
+ * Report the model tokens and cost that the agent just used, for example
362
+ * the `usage` that the model provider returned. LumoAuth does not see
363
+ * model calls, so token and cost limits count only reported usage. The
364
+ * result's `budget.exhausted` says whether the next metered call (Ask,
365
+ * token or JIT request) will get 429.
366
+ *
367
+ * ```ts
368
+ * const resp = await llm.chat(...);
369
+ * const { budget } = await agent.reportUsage({ tokens: resp.usage.total_tokens, costUsd: 0.0042 });
370
+ * if (budget.exhausted) throw new Error('budget spent');
371
+ * ```
372
+ */
373
+ async reportUsage(report) {
374
+ return this.agents.reportUsage(report);
375
+ }
360
376
  // ── Internal ──────────────────────────────────────────────────────
361
377
  requireOrgId() {
362
378
  if (!this.orgId) {