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
feat(lasso): send source.type=litellm for Used By attribution (#33090)
yucheng-berri78e5c4330124
diff --git a/litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py b/litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.pyindex 9c4cef2f06b..31ce0cc2214 100644--- a/litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py+++ b/litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py@@ -772,7 +772,13 @@ class LassoGuardrail(CustomGuardrail):data: Request data (used for conversation_id generation and tools extraction)cache: Cache instance for storing conversation_id (optional for post-call)"""- payload: Dict[str, Any] = {"messages": messages, "messageType": message_type}+ payload: Dict[str, Any] = {+ "messages": messages,+ "messageType": message_type,+ # Drives the "Used By" badge on Lasso Application API Keys: every call from this+ # integration is attributed as "litellm" on the keys list.+ "source": {"type": "litellm"},+ }# Add optional parameters if availableif self.user_id:diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_lasso.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_lasso.pyindex 5a84b6ebecd..16185cadbdf 100644--- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_lasso.py+++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_lasso.py@@ -693,6 +693,8 @@ class TestLassoGuardrail:assert prompt_payload["messages"] == messagesassert prompt_payload["userId"] == "test-user"assert prompt_payload["sessionId"] == "test-conversation"+ # Every call is attributed to the "litellm" integration for the "Used By" badge.+ assert prompt_payload["source"] == {"type": "litellm"}# Test COMPLETION payloadcompletion_messages = [{"role": "assistant", "content": "Test response"}]@@ -703,6 +705,7 @@ class TestLassoGuardrail:assert completion_payload["messages"] == completion_messagesassert completion_payload["userId"] == "test-user"assert completion_payload["sessionId"] == "test-conversation"+ assert completion_payload["source"] == {"type": "litellm"}def test_header_preparation(self):"""Test header preparation."""