Write monthly_bill(job) that prices a workload in its lane.
job has calls_per_day, in_tokens, out_tokens, and lane
("batch" or "realtime").
- Per-call cost:
in_tokens/1M × IN_RATE + out_tokens/1M × OUT_RATE - Monthly: per-call × calls_per_day × 30 days
- Batch lane only: multiply by
(1 - BATCH_DISCOUNT) - Return a float rounded to 2 decimals.
Two workloads run. Expected output:
tagger (batch): $255.00/mo
chat (realtime): $322.50/mo
Look at what those two lines say: the batch tagger makes four times as many calls as the chat feature and still costs less per month. Volume isn't what decides the bill — the lane is.