Merge pull request #37444 from BerriAI/litellm_fix_vertex_batch_cost_assertion

test: derive vertex batch cost expectation from the cost map
This commit is contained in:
Mateo Wang 2026-08-18 22:58:02 -07:00 committed by GitHub
commit 61029814ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -890,8 +890,14 @@ async def test_handle_completed_vertex_batch_computes_cost_usage_and_models(monk
litellm_params={"vertex_project": "proj-1", "vertex_location": "us-central1"},
)
pricing = litellm.model_cost["vertex_ai/gemini-3.6-flash"]
batch_input = pricing["input_cost_per_token_batches"]
batch_output = pricing["output_cost_per_token_batches"]
assert batch_input < pricing["input_cost_per_token"]
assert batch_output < pricing["output_cost_per_token"]
assert cost > 0
assert cost == pytest.approx(30 * 7.5e-07 + 15 * 3.75e-06)
assert cost == pytest.approx(30 * batch_input + 15 * batch_output)
assert (usage.prompt_tokens, usage.completion_tokens, usage.total_tokens) == (30, 15, 45)
assert models == ["gemini-3.6-flash", "gemini-3.6-flash"]