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 ProxyException handling to count_tokens endpoint
Chesars28a20c180fca
diff --git a/litellm/proxy/response_api_endpoints/endpoints.py b/litellm/proxy/response_api_endpoints/endpoints.pyindex 96aec60eee1..441b0f1b317 100644--- a/litellm/proxy/response_api_endpoints/endpoints.py+++ b/litellm/proxy/response_api_endpoints/endpoints.py@@ -520,6 +520,12 @@ async def count_response_input_tokens(except HTTPException:raise+ except ProxyException as e:+ status_code = int(e.code) if e.code and e.code.isdigit() else 500+ raise HTTPException(+ status_code=status_code,+ detail={"error": e.message},+ )except Exception as e:verbose_proxy_logger.exception("litellm.proxy.response_api_endpoints.count_response_input_tokens(): Exception occurred - {}".format(@@ -527,7 +533,7 @@ async def count_response_input_tokens())raise HTTPException(- status_code=500, detail={"error": "Internal server error"}+ status_code=500, detail={"error": f"Internal server error: {str(e)}"})