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 pagination to jwt key mapping list endpoint
Harshit28j0f9d3808748b
diff --git a/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py b/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.pyindex 6c19f8c5dd4..770b9a48dd5 100644--- a/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py+++ b/litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py@@ -1,4 +1,4 @@-from fastapi import APIRouter, Depends, HTTPException+from fastapi import APIRouter, Depends, HTTPException, Queryfrom litellm.proxy._types import *from litellm.proxy._types import hash_tokenfrom litellm.proxy.auth.user_api_key_auth import user_api_key_auth@@ -118,6 +118,8 @@ async def delete_jwt_key_mapping(@router.get("/jwt/key/mapping/list", tags=["JWT Key Mapping"])async def list_jwt_key_mappings(user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),+ page: int = Query(1, description="Page number", ge=1),+ size: int = Query(50, description="Page size", ge=1, le=100),):from litellm.proxy.proxy_server import prisma_client@@ -130,8 +132,19 @@ async def list_jwt_key_mappings(raise HTTPException(status_code=500, detail="Database not connected")try:- mappings = await prisma_client.db.litellm_jwtkeymapping.find_many()- return mappings+ skip = (page - 1) * size+ mappings = await prisma_client.db.litellm_jwtkeymapping.find_many(+ skip=skip,+ take=size,+ order={"created_at": "desc"},+ )+ total_count = await prisma_client.db.litellm_jwtkeymapping.count()+ return {+ "mappings": mappings,+ "total_count": total_count,+ "current_page": page,+ "total_pages": -(-total_count // size), # ceiling division+ }except Exception as e:raise HTTPException(status_code=500, detail=str(e))