VisibleBase
上线与运维

日志与 usage

如何按用户、产品和模型记录 AI 调用。

VisibleBase 不决定日志存哪里,但 hook 会给你统一入口。

推荐字段

  • user_id
  • product_id
  • model
  • provider
  • started_at
  • ended_at
  • status
  • error

记录位置

base.all().after(async (ctx) => {
  await logService.write({
    user_id: ctx.user.user_id,
    product_id: ctx.product.product_id,
    model: ctx.model.model_id,
    provider: ctx.model.provider,
    started_at: ctx.started_at,
    ended_at: ctx.ended_at,
  });
});

多产品共用 Base 后,usage 数据天然集中,后续做成本分析和商业决策会更简单。

目录