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(openrouter/chat/transformation.py): raise informative message for openrouter key error (#9626)
Krish Dholakia4879e1ecf0ee
diff --git a/litellm/llms/openrouter/chat/transformation.py b/litellm/llms/openrouter/chat/transformation.pyindex 4b95ec87cfc..ab4d3c52b99 100644--- a/litellm/llms/openrouter/chat/transformation.py+++ b/litellm/llms/openrouter/chat/transformation.py@@ -84,5 +84,11 @@ class OpenRouterChatCompletionStreamingHandler(BaseModelResponseIterator):model=chunk["model"],choices=new_choices,)+ except KeyError as e:+ raise OpenRouterException(+ message=f"KeyError: {e}, Got unexpected response from OpenRouter: {chunk}",+ status_code=400,+ headers={"Content-Type": "application/json"},+ )except Exception as e:raise e