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(internal_user_endpoints.py): re-introduce upsert on user not found
Krrish Dholakia07b1e6aa1cd6
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yamlindex 36ec0550481..86172ae2690 100644--- a/litellm/proxy/_new_secret_config.yaml+++ b/litellm/proxy/_new_secret_config.yaml@@ -8,7 +8,6 @@ model_list:litellm_settings:num_retries: 0- callbacks: ["otel"]router_settings:routing_strategy: usage-based-routing-v2 # 👈 KEY CHANGEdiff --git a/litellm/proxy/management_endpoints/internal_user_endpoints.py b/litellm/proxy/management_endpoints/internal_user_endpoints.pyindex 1cc31a8849b..43d8273dee5 100644--- a/litellm/proxy/management_endpoints/internal_user_endpoints.py+++ b/litellm/proxy/management_endpoints/internal_user_endpoints.py@@ -737,13 +737,16 @@ async def user_update(existing_user_row = await prisma_client.db.litellm_usertable.find_first(where={"user_id": data.user_id})- if existing_user_row is None:- raise Exception(f"User not found, passed user_id={data.user_id}")- existing_user_row = LiteLLM_UserTable(- **existing_user_row.model_dump(exclude_none=True)- )+ if existing_user_row is not None:+ existing_user_row = LiteLLM_UserTable(+ **existing_user_row.model_dump(exclude_none=True)+ )- existing_metadata = cast(Dict, getattr(existing_user_row, "metadata", {}) or {})+ existing_metadata = (+ cast(Dict, getattr(existing_user_row, "metadata", {}) or {})+ if existing_user_row is not None+ else {}+ )non_default_values = prepare_metadata_fields(data=data,