🎉 svc-infra v1.0 is here — Production-ready backend infrastructure
What's new
nfrax logonfrax

Infrastructure that just works. Ship products, not boilerplate.

Frameworks

  • svc-infra
  • ai-infra
  • fin-infra
  • robo-infra

Resources

  • Getting Started
  • What's New
  • Contributing

Community

  • GitHub

© 2026 nfrax. All rights reserved.

nfrax logonfrax
Start HereWhat's New
GitHub
svc-infra / API Reference

AsyncBillingService

from svc_infra.billing.async_service import AsyncBillingService
View source
svc_infra.billing.async_service

Async billing service for usage tracking and invoicing. Provides full async/await support for recording usage events, aggregating metrics, and generating invoices for multi-tenant billing workflows.

Attributes

session: SQLAlchemy async database session. tenant_id: Tenant identifier for multi-tenant billing isolation.

python
async with async_session_maker() as session:
        service = AsyncBillingService(session, tenant_id="tenant_123")
        await service.record_usage(
            metric="api_calls",
            amount=1,
            at=datetime.now(timezone.utc),
            idempotency_key="unique-key",
        )
Constructor
AsyncBillingService(session: AsyncSession, tenant_id: str)
ParameterTypeDefaultDescription
sessionrequiredAsyncSession——
tenant_idrequiredstr——

Methods

On This Page

Constructoraggregate_dailyasyncgenerate_monthly_invoiceasynclist_daily_aggregatesasyncrecord_usageasync