Skip to content

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]

fix tests on viewing spend logs

Ishaan Jaffb75581452a44
diff --git a/litellm/tests/test_key_generate_prisma.py b/litellm/tests/test_key_generate_prisma.py
index 962d61afba5..a8d48e5e510 100644
--- a/litellm/tests/test_key_generate_prisma.py
+++ b/litellm/tests/test_key_generate_prisma.py
@@ -1610,7 +1610,10 @@ def test_call_with_key_over_budget_no_cache(prisma_client):
proxy_logging_obj=proxy_logging_obj,
)
# test spend_log was written and we can read it
- spend_logs = await view_spend_logs(request_id=request_id)
+ spend_logs = await view_spend_logs(
+ request_id=request_id,
+ user_api_key_dict=UserAPIKeyAuth(api_key=generated_key),
+ )
print("read spend logs", spend_logs)
assert len(spend_logs) == 1
@@ -1730,7 +1733,10 @@ def test_call_with_key_over_model_budget(prisma_client):
proxy_logging_obj=proxy_logging_obj,
)
# test spend_log was written and we can read it
- spend_logs = await view_spend_logs(request_id=request_id)
+ spend_logs = await view_spend_logs(
+ request_id=request_id,
+ user_api_key_dict=UserAPIKeyAuth(api_key=generated_key),
+ )
print("read spend logs", spend_logs)
assert len(spend_logs) == 1
@@ -2299,7 +2305,10 @@ async def test_proxy_load_test_db(prisma_client):
await asyncio.sleep(120)
try:
# call spend logs
- spend_logs = await view_spend_logs(api_key=generated_key)
+ spend_logs = await view_spend_logs(
+ api_key=generated_key,
+ user_api_key_dict=UserAPIKeyAuth(api_key=generated_key),
+ )
print(f"len responses: {len(spend_logs)}")
assert len(spend_logs) == n