The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(integration): require a zero cost header to read zero when the case bills nothing
kerry23f5df05f2b5
diff --git a/tests/integration/cost_calculation/test_cost_tracking.py b/tests/integration/cost_calculation/test_cost_tracking.pyindex 6c1ac166196..3822b5cb3c6 100644--- a/tests/integration/cost_calculation/test_cost_tracking.py+++ b/tests/integration/cost_calculation/test_cost_tracking.py@@ -92,7 +92,11 @@ def test_case_bills_expected_cost(gateway: Gateway, case: CostTrackingTestCase)assert isinstance(expected, ExactExpected)if case.response.content_type == "application/json":header: Final = cast(str | None, response.headers.get("x-litellm-response-cost"))- assert expected.spend == 0 or (header is not None and approx_equal(float(header), expected.spend)), (+ assert (+ (header is None or approx_equal(float(header), 0.0))+ if expected.spend == 0+ else (header is not None and approx_equal(float(header), expected.spend))+ ), (f"{case.name}: x-litellm-response-cost {header} != expected {expected.spend}")assert row.spend is not None and approx_equal(row.spend, expected.spend), (