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
fix: add auth headers and empty latencies guard to benchmark script
Ryan Crabbe95d951405465
diff --git a/scripts/benchmark_mock.py b/scripts/benchmark_mock.pyindex 3d681c96607..f02f50e41f2 100644--- a/scripts/benchmark_mock.py+++ b/scripts/benchmark_mock.py@@ -16,12 +16,17 @@ REQUEST_BODY = {"user": "new_user",}+HEADERS = {+ "Authorization": "Bearer sk-1234",+ "Content-Type": "application/json",+}+async def send_request(session, url, semaphore):async with semaphore:start = time.perf_counter()try:- async with session.post(url, json=REQUEST_BODY) as resp:+ async with session.post(url, json=REQUEST_BODY, headers=HEADERS) as resp:await resp.read()elapsed = time.perf_counter() - startreturn elapsed if resp.status == 200 else None@@ -50,6 +55,14 @@ async def run_benchmark(url, n_requests, max_concurrent):latencies = [r for r in results if r is not None]failures = sum(1 for r in results if r is None)+ if not latencies:+ return {+ "mean": 0, "p50": 0, "p95": 0, "p99": 0,+ "throughput": 0, "failures": n_requests,+ "wall_time": wall_elapsed, "n_requests": n_requests,+ "max_concurrent": max_concurrent, "latencies": [],+ }+latencies.sort()n = len(latencies)mean = statistics.mean(latencies) * 1000