Skip to content

feat: cost analytics types, audit meters, and client methods#1134

Merged
ebarroca merged 9 commits intopreviewfrom
feat/cost-dashboard
Apr 7, 2026
Merged

feat: cost analytics types, audit meters, and client methods#1134
ebarroca merged 9 commits intopreviewfrom
feat/cost-dashboard

Conversation

@ebarroca
Copy link
Copy Markdown
Contributor

@ebarroca ebarroca commented Apr 3, 2026

Summary

  • Add CostAnalyticsQuery and CostAnalyticsResponse types to @vertesia/common
  • Add generic audit meters ({category, type, quantity}) to AuditTrailEvent
  • Add BILLABLE_AUDIT_ACTIONS constant for filtering inference/embedding events
  • Add billing_read permission for cost analytics access
  • Add CostApi client methods: getAnalytics(), getGlobalAnalytics(), getExportUrl()
  • Add interaction to group_by options, scope (project/org), pricing_source (list/historical)

Test plan

  • Build @vertesia/common and @vertesia/client packages
  • Verify types are consumed correctly by studio/zeno servers
  • Test CostApi methods against deployed dev environment

🤖 Generated with Claude Code

- AuditAction: add inference, embedding, image_generation actions
- AuditMeter: generic { category, type, quantity } metering on audit events
- AuditTrailEvent: add meters[] and details (JSON) fields
- BILLABLE_AUDIT_ACTIONS constant for cost query filtering
- CostAnalyticsQuery/Response types for cost dashboard
- Client: getCostAnalytics() and getGlobalCostAnalytics() methods

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ebarroca ebarroca requested a review from a team as a code owner April 3, 2026 10:08
@ebarroca ebarroca force-pushed the feat/cost-dashboard branch 3 times, most recently from 7af3eb4 to d82ccd8 Compare April 3, 2026 11:03
@ebarroca ebarroca force-pushed the feat/cost-dashboard branch from d82ccd8 to 8842b4b Compare April 3, 2026 11:15
ebarroca and others added 7 commits April 5, 2026 17:24
New Permission.billing_read = "billing:read" for viewing cost/usage data.
Separate from manage_billing (Stripe management).
Developer role gets it by default (not in the delete list).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Refactor to sync Promise executor with async init() helper.
Fixes lint: "Promise executor functions should not be async"
Also improves error handling — unhandled rejections now properly
propagate via init().catch(reject).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ebarroca ebarroca merged commit afc3d8a into preview Apr 7, 2026
9 checks passed
@ebarroca ebarroca deleted the feat/cost-dashboard branch April 7, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants