agentsociety.commercial.billing.calculator

Billing Calculator

Provides billing calculation logic for experiments.

Module Contents

Functions

compute_bill

计算并记录账单

check_balance

检查余额是否充足

record_experiment_bill

记录实验计费

API

async agentsociety.commercial.billing.calculator.compute_bill(db: sqlalchemy.ext.asyncio.AsyncSession, experiment, rates: Optional[Dict[str, float]] = None) → None

计算并记录账单

async agentsociety.commercial.billing.calculator.check_balance(tenant_id: str, db: sqlalchemy.ext.asyncio.AsyncSession) → bool

检查余额是否充足

async agentsociety.commercial.billing.calculator.record_experiment_bill(db: sqlalchemy.ext.asyncio.AsyncSession, tenant_id: str, exp_id: uuid.UUID, llm_config_id: Optional[uuid.UUID] = None) → None

记录实验计费