Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion routstr/payment/cost_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,17 @@ def parse_token_count(value: object) -> int:
input_msats = int(cost_in_msats * input_ratio)
output_msats = cost_in_msats - input_msats
else:
output_msats = cost_in_msats
# No tokens reported — model produced empty output, issue full refund
logger.warning(
"Zero tokens with non-zero USD cost — issuing full refund",
extra={
"usd_cost": usd_cost,
"model": response_data.get("model", "unknown"),
},
)
input_msats = 0
output_msats = 0
cost_in_msats = 0

logger.info(
"Using cost from usage data/details",
Expand Down
Loading