Fix batches api cost tracking + Log batch models in spend logs / standard logging payload (#9077)

* feat(batches/): fix batch cost calculation - ensure it's accurate

use the correct cost value - prev. defaulting to non-batch cost

* feat(batch_utils.py): log batch models to spend logs + standard logging payload

makes it easy to understand how cost was calculated

* fix: fix stored payload for test

* test: fix test
This commit is contained in:
Krish Dholakia 2025-03-08 11:47:25 -08:00 committed by GitHub
parent 048ff931be
commit 44c9eef64f
8 changed files with 110 additions and 7 deletions

View file

@ -4408,6 +4408,12 @@ def _get_model_info_helper( # noqa: PLR0915
input_cost_per_audio_token=_model_info.get(
"input_cost_per_audio_token", None
),
input_cost_per_token_batches=_model_info.get(
"input_cost_per_token_batches"
),
output_cost_per_token_batches=_model_info.get(
"output_cost_per_token_batches"
),
output_cost_per_token=_output_cost_per_token,
output_cost_per_audio_token=_model_info.get(
"output_cost_per_audio_token", None