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
Revert "[Fix] Security - Remove example API keys with high entropy (#18255)"
Ishaan Jaffer6112160a163a
diff --git a/.circleci/config.yml b/.circleci/config.ymlindex 789f297ea19..162f3409de9 100644--- a/.circleci/config.yml+++ b/.circleci/config.yml@@ -657,7 +657,7 @@ jobs:docker run -d \--name postgres-db \-e POSTGRES_USER=postgres \- -e POSTGRES_PASSWORD=test-postgres \+ -e POSTGRES_PASSWORD=postgres \-e POSTGRES_DB=circle_test \-p 5432:5432 \postgres:14@@ -2108,7 +2108,7 @@ jobs:docker run -d \--name postgres-db \-e POSTGRES_USER=postgres \- -e POSTGRES_PASSWORD=test-postgres \+ -e POSTGRES_PASSWORD=postgres \-e POSTGRES_DB=circle_test \-p 5432:5432 \postgres:14@@ -2250,7 +2250,7 @@ jobs:docker run -d \--name postgres-db \-e POSTGRES_USER=postgres \- -e POSTGRES_PASSWORD=test-postgres \+ -e POSTGRES_PASSWORD=postgres \-e POSTGRES_DB=circle_test \-p 5432:5432 \postgres:14@@ -2390,7 +2390,7 @@ jobs:docker run -d \--name postgres-db \-e POSTGRES_USER=postgres \- -e POSTGRES_PASSWORD=test-postgres \+ -e POSTGRES_PASSWORD=postgres \-e POSTGRES_DB=circle_test \-p 5432:5432 \postgres:14@@ -2551,7 +2551,7 @@ jobs:docker run -d \--name postgres-db \-e POSTGRES_USER=postgres \- -e POSTGRES_PASSWORD=test-postgres \+ -e POSTGRES_PASSWORD=postgres \-e POSTGRES_DB=circle_test \-p 5432:5432 \postgres:14@@ -2664,7 +2664,7 @@ jobs:docker run -d \--name postgres-db \-e POSTGRES_USER=postgres \- -e POSTGRES_PASSWORD=test-postgres \+ -e POSTGRES_PASSWORD=postgres \-e POSTGRES_DB=circle_test \-p 5432:5432 \postgres:14@@ -2800,7 +2800,7 @@ jobs:docker run -d \--name postgres-db \-e POSTGRES_USER=postgres \- -e POSTGRES_PASSWORD=test-postgres \+ -e POSTGRES_PASSWORD=postgres \-e POSTGRES_DB=circle_test \-p 5432:5432 \postgres:14@@ -3032,7 +3032,7 @@ jobs:docker run -d \--name postgres-db \-e POSTGRES_USER=postgres \- -e POSTGRES_PASSWORD=test-postgres \+ -e POSTGRES_PASSWORD=postgres \-e POSTGRES_DB=circle_test \-p 5432:5432 \postgres:14@@ -3549,7 +3549,7 @@ jobs:docker run -d \--name postgres-db \-e POSTGRES_USER=postgres \- -e POSTGRES_PASSWORD=test-postgres \+ -e POSTGRES_PASSWORD=postgres \-e POSTGRES_DB=circle_test \-p 5432:5432 \postgres:14diff --git a/.gitguardian.yaml b/.gitguardian.yamldeleted file mode 100644index 861dd6e6d68..00000000000--- a/.gitguardian.yaml+++ /dev/null@@ -1,84 +0,0 @@-version: 2--secret:- # Exclude files and paths by globbing- ignored_paths:- - "**/*.whl"- - "**/*.pyc"- - "**/__pycache__/**"- - "**/node_modules/**"- - "**/dist/**"- - "**/build/**"- - "**/.git/**"- - "**/venv/**"- - "**/.venv/**"-- # Large data/metadata files that don't need scanning- - "**/model_prices_and_context_window*.json"- - "**/*_metadata/*.txt"- - "**/tokenizers/*.json"- - "**/tokenizers/*"- - "miniconda.sh"-- # Build outputs and static assets- - "litellm/proxy/_experimental/out/**"- - "ui/litellm-dashboard/public/**"- - "**/swagger/*.js"- - "**/*.woff"- - "**/*.woff2"- - "**/*.avif"- - "**/*.webp"-- # Test data files- - "**/tests/**/data_map.txt"- - "tests/**/*.txt"-- # Documentation and other non-code files- - "docs/**"- - "**/*.md"- - "**/*.lock"- - "poetry.lock"- - "package-lock.json"-- # Ignore security incidents with the SHA256 of the occurrence (false positives)- ignored_matches:- # === Current detected false positives (SHA-based) ===-- # gcs_pub_sub_body - folder name, not a password- - name: GCS pub/sub test folder name- match: 75f377c456eede69e5f6e47399ccee6016a2a93cc5dd11db09cc5b1359ae569a-- # os.environ/APORIA_API_KEY_1 - environment variable reference- - name: Environment variable reference APORIA_API_KEY_1- match: e2ddeb8b88eca97a402559a2be2117764e11c074d86159ef9ad2375dea188094-- # os.environ/APORIA_API_KEY_2 - environment variable reference- - name: Environment variable reference APORIA_API_KEY_2- match: 09aa39a29e050b86603aa55138af1ff08fb86a4582aa965c1bd0672e1575e052-- # oidc/circleci_v2/ - test authentication path, not a secret- - name: OIDC CircleCI test path- match: feb3475e1f89a65b7b7815ac4ec597e18a9ec1847742ad445c36ca617b536e15-- # text-davinci-003 - OpenAI model identifier, not a secret- - name: OpenAI model identifier text-davinci-003- match: c489000cf6c7600cee0eefb80ad0965f82921cfb47ece880930eb7e7635cf1f1-- # === Preventive patterns for test keys (pattern-based) ===-- # Test API keys (124 instances across 45 files)- - name: Test API keys with sk-test prefix- match: sk-test--- # Mock API keys- - name: Mock API keys with sk-mock prefix- match: sk-mock--- # Fake API keys- - name: Fake API keys with sk-fake prefix- match: sk-fake--- # Generic test API key patterns- - name: Test API key patterns- match: test-api-key-diff --git a/.github/workflows/locustfile.py b/.github/workflows/locustfile.pyindex 65d0d56b3a6..36dbeee9c48 100644--- a/.github/workflows/locustfile.py+++ b/.github/workflows/locustfile.py@@ -8,7 +8,7 @@ class MyUser(HttpUser):def chat_completion(self):headers = {"Content-Type": "application/json",- "Authorization": "Bearer sk-test-load-test-key-123",+ "Authorization": "Bearer sk-8N1tLOOyH8TIxwOLahhIVg",# Include any additional headers you may need for authentication, etc.}diff --git a/.github/workflows/publish-migrations.yml b/.github/workflows/publish-migrations.ymlindex a81a64ab46a..8e5a67bcf85 100644--- a/.github/workflows/publish-migrations.yml+++ b/.github/workflows/publish-migrations.yml@@ -20,7 +20,7 @@ jobs:env:POSTGRES_DB: temp_dbPOSTGRES_USER: postgres- POSTGRES_PASSWORD: test-postgres+ POSTGRES_PASSWORD: postgresports:- 5432:5432options: >-@@ -35,7 +35,7 @@ jobs:env:POSTGRES_DB: shadow_dbPOSTGRES_USER: postgres- POSTGRES_PASSWORD: test-postgres+ POSTGRES_PASSWORD: postgresports:- 5433:5432options: >-diff --git a/ci_cd/TEST_KEY_PATTERNS.md b/ci_cd/TEST_KEY_PATTERNS.mddeleted file mode 100644index bd59f582839..00000000000--- a/ci_cd/TEST_KEY_PATTERNS.md+++ /dev/null@@ -1,40 +0,0 @@-# Test Key Patterns Standard--Standard patterns for test/mock keys and credentials in the LiteLLM codebase to avoid triggering secret detection.--## How GitGuardian Works--GitGuardian uses **machine learning and entropy analysis**, not just pattern matching:-- **Low entropy** values (like `sk-1234`, `postgres`) are automatically ignored-- **High entropy** values (realistic-looking secrets) trigger detection-- **Context-aware** detection understands code syntax like `os.environ["KEY"]`--## Recommended Test Key Patterns--### Option 1: Low Entropy Values (Simplest)-These won't trigger GitGuardian's ML detector:--```python-api_key = "sk-1234"-api_key = "sk-12345"-database_password = "postgres"-token = "test123"-```--### Option 2: High Entropy with Test Prefixes-If you need realistic-looking test keys with high entropy, use these prefixes:--```python-api_key = "sk-test-abc123def456ghi789..." # OpenAI-style test key-api_key = "sk-mock-1234567890abcdef1234..." # Mock key-api_key = "sk-fake-xyz789uvw456rst123..." # Fake key-token = "test-api-key-with-high-entropy"-```--## Configured Ignore Patterns--These patterns are in `.gitguardian.yaml` for high-entropy test keys:-- `sk-test-*` - OpenAI-style test keys-- `sk-mock-*` - Mock API keys-- `sk-fake-*` - Fake API keys-- `test-api-key` - Generic test tokensdiff --git a/cookbook/LiteLLM_PromptLayer.ipynb b/cookbook/LiteLLM_PromptLayer.ipynbindex 8fd54941027..3552636011a 100644--- a/cookbook/LiteLLM_PromptLayer.ipynb+++ b/cookbook/LiteLLM_PromptLayer.ipynb@@ -39,7 +39,7 @@"import os\n","os.environ['OPENAI_API_KEY'] = \"\"\n","os.environ['REPLICATE_API_TOKEN'] = \"\"\n",- "os.environ['PROMPTLAYER_API_KEY'] = \"test-promptlayer-key-123\"\n",+ "os.environ['PROMPTLAYER_API_KEY'] = \"pl_4ea2bb00a4dca1b8a70cebf2e9e11564\"\n","\n","# Set Promptlayer as a success callback\n","litellm.success_callback =['promptlayer']\n",diff --git a/cookbook/Migrating_to_LiteLLM_Proxy_from_OpenAI_Azure_OpenAI.ipynb b/cookbook/Migrating_to_LiteLLM_Proxy_from_OpenAI_Azure_OpenAI.ipynbindex 740e7c7a4c8..39677ed2a8a 100644--- a/cookbook/Migrating_to_LiteLLM_Proxy_from_OpenAI_Azure_OpenAI.ipynb+++ b/cookbook/Migrating_to_LiteLLM_Proxy_from_OpenAI_Azure_OpenAI.ipynb@@ -1,10 +1,21 @@{+ "nbformat": 4,+ "nbformat_minor": 0,+ "metadata": {+ "colab": {+ "provenance": []+ },+ "kernelspec": {+ "name": "python3",+ "display_name": "Python 3"+ },+ "language_info": {+ "name": "python"+ }+ },"cells": [{"cell_type": "markdown",- "metadata": {- "id": "kccfk0mHZ4Ad"- },"source": ["# Migrating to LiteLLM Proxy from OpenAI/Azure OpenAI\n","\n",@@ -21,26 +32,29 @@"To pass provider-specific args, [go here](https://docs.litellm.ai/docs/completion/provider_specific_params#proxy-usage)\n","\n","To drop unsupported params (E.g. frequency_penalty for bedrock with librechat), [go here](https://docs.litellm.ai/docs/completion/drop_params#openai-proxy-usage)\n"- ]+ ],+ "metadata": {+ "id": "kccfk0mHZ4Ad"+ }},{"cell_type": "markdown",- "metadata": {- "id": "nmSClzCPaGH6"- },"source": ["## /chat/completion\n","\n"- ]+ ],+ "metadata": {+ "id": "nmSClzCPaGH6"+ }},{"cell_type": "markdown",- "metadata": {- "id": "_vqcjwOVaKpO"- },"source": ["### OpenAI Python SDK"- ]+ ],+ "metadata": {+ "id": "_vqcjwOVaKpO"+ }},{"cell_type": "code",@@ -80,20 +94,15 @@},{"cell_type": "markdown",- "metadata": {- "id": "AqkyKk9Scxgj"- },"source": ["## Function Calling"- ]+ ],+ "metadata": {+ "id": "AqkyKk9Scxgj"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "wDg10VqLczE1"- },- "outputs": [],"source": ["from openai import OpenAI\n","client = OpenAI(\n",@@ -130,24 +139,24 @@")\n","\n","print(completion)\n"- ]+ ],+ "metadata": {+ "id": "wDg10VqLczE1"+ },+ "execution_count": null,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "YYoxLloSaNWW"- },"source": ["### Azure OpenAI Python SDK"- ]+ ],+ "metadata": {+ "id": "YYoxLloSaNWW"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "yA1XcgowaSRy"- },- "outputs": [],"source": ["import openai\n","client = openai.AzureOpenAI(\n",@@ -175,24 +184,24 @@")\n","\n","print(response)"- ]+ ],+ "metadata": {+ "id": "yA1XcgowaSRy"+ },+ "execution_count": null,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "yl9qhDvnaTpL"- },"source": ["### Langchain Python"- ]+ ],+ "metadata": {+ "id": "yl9qhDvnaTpL"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "5MUZgSquaW5t"- },- "outputs": [],"source": ["from langchain.chat_models import ChatOpenAI\n","from langchain.prompts.chat import (\n",@@ -230,22 +239,24 @@"response = chat(messages)\n","\n","print(response)"- ]+ ],+ "metadata": {+ "id": "5MUZgSquaW5t"+ },+ "execution_count": null,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "B9eMgnULbRaz"- },"source": ["### Curl"- ]+ ],+ "metadata": {+ "id": "B9eMgnULbRaz"+ }},{"cell_type": "markdown",- "metadata": {- "id": "VWCCk5PFcmhS"- },"source": ["\n","\n",@@ -269,24 +280,22 @@"}'\n","```\n","\n"- ]+ ],+ "metadata": {+ "id": "VWCCk5PFcmhS"+ }},{"cell_type": "markdown",- "metadata": {- "id": "drBAm2e1b6xe"- },"source": ["### LlamaIndex"- ]+ ],+ "metadata": {+ "id": "drBAm2e1b6xe"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "d0bZcv8fb9mL"- },- "outputs": [],"source": ["import os, dotenv\n","\n",@@ -317,24 +326,24 @@"query_engine = index.as_query_engine()\n","response = query_engine.query(\"What did the author do growing up?\")\n","print(response)\n"- ]+ ],+ "metadata": {+ "id": "d0bZcv8fb9mL"+ },+ "execution_count": null,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "xypvNdHnb-Yy"- },"source": ["### Langchain JS"- ]+ ],+ "metadata": {+ "id": "xypvNdHnb-Yy"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "R55mK2vCcBN2"- },- "outputs": [],"source": ["import { ChatOpenAI } from \"@langchain/openai\";\n","\n",@@ -350,24 +359,24 @@"const message = await model.invoke(\"Hi there!\");\n","\n","console.log(message);\n"- ]+ ],+ "metadata": {+ "id": "R55mK2vCcBN2"+ },+ "execution_count": null,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "nC4bLifCcCiW"- },"source": ["### OpenAI JS"- ]+ ],+ "metadata": {+ "id": "nC4bLifCcCiW"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "MICH8kIMcFpg"- },- "outputs": [],"source": ["const { OpenAI } = require('openai');\n","\n",@@ -389,24 +398,24 @@"}\n","\n","main();\n"- ]+ ],+ "metadata": {+ "id": "MICH8kIMcFpg"+ },+ "execution_count": null,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "D1Q07pEAcGTb"- },"source": ["### Anthropic SDK"- ]+ ],+ "metadata": {+ "id": "D1Q07pEAcGTb"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "qBjFcAvgcI3t"- },- "outputs": [],"source": ["import os\n","\n",@@ -414,7 +423,7 @@"\n","client = Anthropic(\n"," base_url=\"http://localhost:4000\", # proxy endpoint\n",- " api_key=\"sk-test-proxy-key-123\", # litellm proxy virtual key (example)\n",+ " api_key=\"sk-s4xN1IiLTCytwtZFJaYQrA\", # litellm proxy virtual key\n",")\n","\n","message = client.messages.create(\n",@@ -428,33 +437,33 @@" model=\"claude-3-opus-20240229\",\n",")\n","print(message.content)"- ]+ ],+ "metadata": {+ "id": "qBjFcAvgcI3t"+ },+ "execution_count": null,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "dFAR4AJGcONI"- },"source": ["## /embeddings"- ]+ ],+ "metadata": {+ "id": "dFAR4AJGcONI"+ }},{"cell_type": "markdown",- "metadata": {- "id": "lgNoM281cRzR"- },"source": ["### OpenAI Python SDK"- ]+ ],+ "metadata": {+ "id": "lgNoM281cRzR"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "NY3DJhPfcQhA"- },- "outputs": [],"source": ["import openai\n","from openai import OpenAI\n",@@ -469,24 +478,24 @@")\n","\n","print(response)\n"- ]+ ],+ "metadata": {+ "id": "NY3DJhPfcQhA"+ },+ "execution_count": null,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "hmbg-DW6cUZs"- },"source": ["### Langchain Embeddings"- ]+ ],+ "metadata": {+ "id": "hmbg-DW6cUZs"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "lX2S8Nl1cWVP"- },- "outputs": [],"source": ["from langchain.embeddings import OpenAIEmbeddings\n","\n",@@ -517,22 +526,24 @@"\n","print(f\"TITAN EMBEDDINGS\")\n","print(query_result[:5])"- ]+ ],+ "metadata": {+ "id": "lX2S8Nl1cWVP"+ },+ "execution_count": null,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "oqGbWBCQcYfd"- },"source": ["### Curl Request"- ]+ ],+ "metadata": {+ "id": "oqGbWBCQcYfd"+ }},{"cell_type": "markdown",- "metadata": {- "id": "7rkIMV9LcdwQ"- },"source": ["\n","\n",@@ -545,21 +556,10 @@" }'\n","```\n","\n"- ]- }- ],- "metadata": {- "colab": {- "provenance": []- },- "kernelspec": {- "display_name": "Python 3",- "name": "python3"- },- "language_info": {- "name": "python"+ ],+ "metadata": {+ "id": "7rkIMV9LcdwQ"+ }}- },- "nbformat": 4,- "nbformat_minor": 0-}+ ]+}\ No newline at end of filediff --git a/docs/my-website/docs/oidc.md b/docs/my-website/docs/oidc.mdindex b541329aa38..3db4b6ecdc5 100644--- a/docs/my-website/docs/oidc.md+++ b/docs/my-website/docs/oidc.md@@ -106,7 +106,7 @@ model_list:aws_region_name: us-west-2aws_session_name: "my-test-session"aws_role_name: "arn:aws:iam::335785316107:role/litellm-github-unit-tests-circleci"- aws_web_identity_token: "oidc/example-provider/"+ aws_web_identity_token: "oidc/circleci_v2/"```#### Amazon IAM Role Configuration for CircleCI v2 -> Bedrockdiff --git a/docs/my-website/docs/proxy/alerting.md b/docs/my-website/docs/proxy/alerting.mdindex 38d6d47be44..4cbcd0cffce 100644--- a/docs/my-website/docs/proxy/alerting.md+++ b/docs/my-website/docs/proxy/alerting.md@@ -215,16 +215,16 @@ general_settings:alerting: ["slack"]alerting_threshold: 0.0001 # (Seconds) set an artificially low threshold for testing alertingalert_to_webhook_url: {- "llm_exceptions": "example-slack-webhook-url",- "llm_too_slow": "example-slack-webhook-url",- "llm_requests_hanging": "example-slack-webhook-url",- "budget_alerts": "example-slack-webhook-url",- "db_exceptions": "example-slack-webhook-url",- "daily_reports": "example-slack-webhook-url",- "spend_reports": "example-slack-webhook-url",- "cooldown_deployment": "example-slack-webhook-url",- "new_model_added": "example-slack-webhook-url",- "outage_alerts": "example-slack-webhook-url",+ "llm_exceptions": "https://hooks.slack.com/services/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",+ "llm_too_slow": "https://hooks.slack.com/services/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",+ "llm_requests_hanging": "https://hooks.slack.com/services/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",+ "budget_alerts": "https://hooks.slack.com/services/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",+ "db_exceptions": "https://hooks.slack.com/services/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",+ "daily_reports": "https://hooks.slack.com/services/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",+ "spend_reports": "https://hooks.slack.com/services/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",+ "cooldown_deployment": "https://hooks.slack.com/services/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",+ "new_model_added": "https://hooks.slack.com/services/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",+ "outage_alerts": "https://hooks.slack.com/services/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",}litellm_settings:@@ -399,7 +399,7 @@ curl -X GET --location 'http://0.0.0.0:4000/health/services?service=webhook' \{"spend": 1, # the spend for the 'event_group'"max_budget": 0, # the 'max_budget' set for the 'event_group'- "token": "example-api-key-123",+ "token": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","user_id": "default_user_id","team_id": null,"user_email": null,diff --git a/docs/my-website/docs/proxy/cost_tracking.md b/docs/my-website/docs/proxy/cost_tracking.mdindex 26a4920c093..019cd62c620 100644--- a/docs/my-website/docs/proxy/cost_tracking.md+++ b/docs/my-website/docs/proxy/cost_tracking.md@@ -722,7 +722,7 @@ curl -X GET 'http://localhost:4000/global/spend/report?start_date=2024-04-01&end```shell[{- "api_key": "example-api-key-123",+ "api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","total_cost": 0.3201286305151999,"total_input_tokens": 36.0,"total_output_tokens": 1593.0,@@ -766,7 +766,7 @@ curl -X GET 'http://localhost:4000/global/spend/report?start_date=2024-04-01&end```shell[{- "api_key": "example-api-key-123",+ "api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","total_cost": 0.00013132,"total_input_tokens": 105.0,"total_output_tokens": 872.0,@@ -1151,7 +1151,7 @@ curl -X GET "http://0.0.0.0:4000/spend/logs?request_id=<your-call-id" \ # e.g.:"request_id": "chatcmpl-9ZKMURhVYSi9D6r6PJ9vLcayIK0Vm","call_type": "acompletion","metadata": {- "user_api_key": "example-api-key-123",+ "user_api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","user_api_key_alias": null,"spend_logs_metadata": { # 👈 LOGGED CUSTOM METADATA"hello": "world"diff --git a/docs/my-website/docs/proxy/customers.md b/docs/my-website/docs/proxy/customers.mdindex 1101884c36b..66142ca3d84 100644--- a/docs/my-website/docs/proxy/customers.md+++ b/docs/my-website/docs/proxy/customers.md@@ -103,7 +103,7 @@ Expected Response{"spend": 0.0011120000000000001, # 👈 SPEND"max_budget": null,- "token": "example-api-key-123",+ "token": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","customer_id": "krrish12", # 👈 CUSTOMER ID"user_id": null,"team_id": null,diff --git a/docs/my-website/docs/proxy/guardrails/litellm_content_filter.md b/docs/my-website/docs/proxy/guardrails/litellm_content_filter.mdindex f247a327cd6..5ba39ba35ed 100644--- a/docs/my-website/docs/proxy/guardrails/litellm_content_filter.md+++ b/docs/my-website/docs/proxy/guardrails/litellm_content_filter.md@@ -257,7 +257,7 @@ Contact me at [EMAIL_REDACTED]| `amex` | American Express cards | `3782-822463-10005` || `aws_access_key` | AWS access keys | `AKIAIOSFODNN7EXAMPLE` || `aws_secret_key` | AWS secret keys | `wJalrXUtnFEMI/K7MDENG/bPxRfi...` |-| `github_token` | GitHub tokens | `example-github-token-123` |+| `github_token` | GitHub tokens | `ghp_16C7e42F292c6912E7710c838347Ae178B4a` |### Using Prebuilt Patternsdiff --git a/docs/my-website/docs/proxy/guardrails/pillar_security.md b/docs/my-website/docs/proxy/guardrails/pillar_security.mdindex de983d2a5dd..099919dc393 100644--- a/docs/my-website/docs/proxy/guardrails/pillar_security.md+++ b/docs/my-website/docs/proxy/guardrails/pillar_security.md@@ -790,7 +790,7 @@ curl -X POST "http://localhost:4000/v1/chat/completions" \"messages": [{"role": "user",- "content": "Generate python code that accesses my Github repo using this PAT: example-github-token-123"+ "content": "Generate python code that accesses my Github repo using this PAT: ghp_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8"}],"max_tokens": 50@@ -815,7 +815,7 @@ curl -X POST "http://localhost:4000/v1/chat/completions" \"type": "github_token","start_idx": 66,"end_idx": 106,- "evidence": "example-github-token-123",+ "evidence": "ghp_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8",}]}diff --git a/docs/my-website/docs/proxy/multiple_admins.md b/docs/my-website/docs/proxy/multiple_admins.mdindex cf122f85b99..479b9323ad1 100644--- a/docs/my-website/docs/proxy/multiple_admins.md+++ b/docs/my-website/docs/proxy/multiple_admins.md@@ -89,7 +89,7 @@ curl -X POST 'http://0.0.0.0:4000/team/update' \"id": "bd136c28-edd0-4cb6-b963-f35464cf6f5a","updated_at": "2024-06-08 23:41:14.793","changed_by": "[email protected]", # 👈 CHANGED BY- "changed_by_api_key": "example-api-key-123",+ "changed_by_api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","action": "updated","table_name": "LiteLLM_TeamTable","object_id": "8bf18b11-7f52-4717-8e1f-7c65f9d01e52",diff --git a/docs/my-website/docs/proxy/prod.md b/docs/my-website/docs/proxy/prod.mdindex 71f0317cedf..76698071c65 100644--- a/docs/my-website/docs/proxy/prod.md+++ b/docs/my-website/docs/proxy/prod.md@@ -33,7 +33,7 @@ litellm_settings:Set slack webhook url in your env```shell-export SLACK_WEBHOOK_URL="example-slack-webhook-url"+export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/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"```Turn off FASTAPI's default info logsdiff --git a/docs/my-website/docs/proxy/quick_start.md b/docs/my-website/docs/proxy/quick_start.mdindex cf1ab78b352..a343bb00e9b 100644--- a/docs/my-website/docs/proxy/quick_start.md+++ b/docs/my-website/docs/proxy/quick_start.md@@ -400,7 +400,7 @@ from anthropic import Anthropicclient = Anthropic(base_url="http://localhost:4000", # proxy endpoint- api_key="sk-test-proxy-key-123", # litellm proxy virtual key (example)+ api_key="sk-s4xN1IiLTCytwtZFJaYQrA", # litellm proxy virtual key)message = client.messages.create(diff --git a/docs/my-website/docs/proxy/user_keys.md b/docs/my-website/docs/proxy/user_keys.mdindex 72ec8ccd759..21e1d3dbf40 100644--- a/docs/my-website/docs/proxy/user_keys.md+++ b/docs/my-website/docs/proxy/user_keys.md@@ -285,7 +285,7 @@ from anthropic import Anthropicclient = Anthropic(base_url="http://localhost:4000", # proxy endpoint- api_key="sk-test-proxy-key-123", # litellm proxy virtual key (example)+ api_key="sk-s4xN1IiLTCytwtZFJaYQrA", # litellm proxy virtual key)message = client.messages.create(diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.pyindex 14d221d19e1..3e37657504a 100644--- a/litellm/proxy/management_endpoints/key_management_endpoints.py+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py@@ -1910,14 +1910,14 @@ async def info_key_fn(Example Curl:```- curl -X GET "http://0.0.0.0:4000/key/info?key=sk-test-example-key-123" \+ curl -X GET "http://0.0.0.0:4000/key/info?key=sk-02Wr4IAlN3NvPXvL5JVvDA" \-H "Authorization: Bearer sk-1234"```Example Curl - if no key is passed, it will use the Key Passed in Authorization Header```curl -X GET "http://0.0.0.0:4000/key/info" \--H "Authorization: Bearer sk-test-example-key-123"+-H "Authorization: Bearer sk-02Wr4IAlN3NvPXvL5JVvDA"```"""from litellm.proxy.proxy_server import prisma_clientdiff --git a/litellm/proxy/spend_tracking/spend_management_endpoints.py b/litellm/proxy/spend_tracking/spend_management_endpoints.pyindex f8ece80707f..ca7e327dbd9 100644--- a/litellm/proxy/spend_tracking/spend_management_endpoints.py+++ b/litellm/proxy/spend_tracking/spend_management_endpoints.py@@ -14,15 +14,15 @@ from litellm._logging import verbose_proxy_loggerfrom litellm.proxy._types import *from litellm.proxy._types import ProviderBudgetResponse, ProviderBudgetResponseObjectfrom litellm.proxy.auth.user_api_key_auth import user_api_key_auth+from litellm.proxy.management_endpoints.common_utils import (+ _is_user_team_admin,+ _user_has_admin_view,+)from litellm.proxy.spend_tracking.spend_tracking_utils import (get_spend_by_team_and_customer,)from litellm.proxy.utils import handle_exception_on_proxyfrom litellm.router_strategy.budget_limiter import RouterBudgetLimiting-from litellm.proxy.management_endpoints.common_utils import (- _is_user_team_admin,- _user_has_admin_view,-)if TYPE_CHECKING:from litellm.proxy.proxy_server import PrismaClient@@ -1938,7 +1938,7 @@ async def view_spend_logs( # noqa: PLR0915Example Request for specific api_key```- curl -X GET "http://0.0.0.0:8000/spend/logs?api_key=sk-test-example-key-123" \+ curl -X GET "http://0.0.0.0:8000/spend/logs?api_key=sk-Fn8Ej39NkBQmUagFEoUWPQ" \-H "Authorization: Bearer sk-1234"```diff --git a/tests/agent_tests/local_vertex_agent.py b/tests/agent_tests/local_vertex_agent.pyindex cfc202936b3..3cc9f868612 100644--- a/tests/agent_tests/local_vertex_agent.py+++ b/tests/agent_tests/local_vertex_agent.py@@ -21,7 +21,7 @@ from google.auth.transport.requests import Requestimport httpx# Configuration - update these for your agent-PROJECT_ID = "test-gcp-project-id-123" # Your GCP project ID (test value)+PROJECT_ID = "gen-lang-client-0682925754" # Your GCP project IDLOCATION = "us-central1" # Your agent's location# For Reasoning Engines, use just the numeric ID at the enddiff --git a/tests/litellm_utils_tests/test_cyberark.py b/tests/litellm_utils_tests/test_cyberark.pyindex b7cb25791a9..b94e5949534 100644--- a/tests/litellm_utils_tests/test_cyberark.py+++ b/tests/litellm_utils_tests/test_cyberark.py@@ -13,7 +13,7 @@ from unittest.mock import AsyncMock, MagicMock, patchfrom litellm._uuid import uuid# Set up environment variables for testing-os.environ["CYBERARK_API_KEY"] = "test-cyberark-api-key-909"+os.environ["CYBERARK_API_KEY"] = "2syke5r262b6je2f4et1x3jptmry3frfx83t65e6417zad632e5qq8a"os.environ["CYBERARK_API_BASE"] = "http://0.0.0.0:8080"os.environ["CYBERARK_ACCOUNT"] = "default"os.environ["CYBERARK_USERNAME"] = "admin"diff --git a/tests/llm_translation/test_azure_openai.py b/tests/llm_translation/test_azure_openai.pyindex 09097c6b27d..9666968d66a 100644--- a/tests/llm_translation/test_azure_openai.py+++ b/tests/llm_translation/test_azure_openai.py@@ -196,7 +196,7 @@ def test_process_azure_endpoint_url(api_base, model, expected_endpoint):"azure_deployment": model,"max_retries": 2,"timeout": 600,- "api_key": "sk-test-mock-key-505",+ "api_key": "f28ab7b695af4154bc53498e5bdccb07",},"model": model,}diff --git a/tests/llm_translation/test_bedrock_agentcore.py b/tests/llm_translation/test_bedrock_agentcore.pyindex 3afb01482ac..029bdf4e37b 100644--- a/tests/llm_translation/test_bedrock_agentcore.py+++ b/tests/llm_translation/test_bedrock_agentcore.py@@ -218,7 +218,7 @@ def test_bedrock_agentcore_with_api_key_bearer_token():from litellm.llms.custom_httpx.http_handler import HTTPHandlerclient = HTTPHandler()- test_jwt_token = "test-jwt-token-header.payload.signature"+ test_jwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"with patch.object(client, "post", return_value=MagicMock()) as mock_post:try:diff --git a/tests/llm_translation/test_bedrock_completion.py b/tests/llm_translation/test_bedrock_completion.pyindex 78c9f94239b..bd08d4444f6 100644--- a/tests/llm_translation/test_bedrock_completion.py+++ b/tests/llm_translation/test_bedrock_completion.py@@ -295,7 +295,7 @@ def bedrock_session_token_creds():aws_role_name = ("arn:aws:iam::335785316107:role/litellm-github-unit-tests-circleci")- aws_web_identity_token = "test-oidc-token-123"+ aws_web_identity_token = "oidc/circleci_v2/"creds = bllm.get_credentials(aws_region_name=aws_region_name,diff --git a/tests/local_testing/test_alangfuse.py b/tests/local_testing/test_alangfuse.pyindex 306c7749f18..a20370135f9 100644--- a/tests/local_testing/test_alangfuse.py+++ b/tests/local_testing/test_alangfuse.py@@ -1019,7 +1019,7 @@ generation_params = {],},},- "user_api_key": "sk-test-mock-api-key-123",+ "user_api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","litellm_api_version": "0.0.0","user_api_key_user_id": "default_user_id","user_api_key_spend": 0.0,@@ -1142,7 +1142,7 @@ def test_langfuse_prompt_type(prompt):],},},- "user_api_key": "sk-test-mock-api-key-123",+ "user_api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","litellm_api_version": "0.0.0","user_api_key_user_id": "default_user_id","user_api_key_spend": 0.0,diff --git a/tests/local_testing/test_completion.py b/tests/local_testing/test_completion.pyindex d72dcbb974b..d06568c8796 100644--- a/tests/local_testing/test_completion.py+++ b/tests/local_testing/test_completion.py@@ -4160,10 +4160,10 @@ def test_openai_hallucinated_tool_call_util(function_name, expect_modification):def test_langfuse_completion(monkeypatch):monkeypatch.setenv(- "LANGFUSE_PUBLIC_KEY", "test-langfuse-public-key-123"+ "LANGFUSE_PUBLIC_KEY", "pk-lf-b3db7e8e-c2f6-4fc7-825c-a541a8fbe003")monkeypatch.setenv(- "LANGFUSE_SECRET_KEY", "test-langfuse-secret-key-456"+ "LANGFUSE_SECRET_KEY", "sk-lf-b11ef3a8-361c-4445-9652-12318b8596e4")monkeypatch.setenv("LANGFUSE_HOST", "https://us.cloud.langfuse.com")litellm.set_verbose = Truediff --git a/tests/local_testing/test_completion_cost.py b/tests/local_testing/test_completion_cost.pyindex 2f78f27361e..40efcc23868 100644--- a/tests/local_testing/test_completion_cost.py+++ b/tests/local_testing/test_completion_cost.py@@ -401,7 +401,7 @@ def test_dalle_3_azure_cost_tracking():{"b64_json": None,"revised_prompt": "A close-up image of an adorable baby sea otter. Its fur is thick and fluffy to provide buoyancy and insulation against the cold water. Its eyes are round, curious and full of life. It's lying on its back, floating effortlessly on the calm sea surface under the warm sun. Surrounding the otter are patches of colorful kelp drifting along the gentle waves, giving the scene a touch of vibrancy. The sea otter has its small paws folded on its chest, and it seems to be taking a break from its play.",- "url": "test-azure-blob-url-with-sas-token",+ "url": "https://dalleprodsec.blob.core.windows.net/private/images/3e5d00f3-700e-4b75-869d-2de73c3c975d/generated_00.png?se=2024-03-13T17%3A49%3A51Z&sig=R9RJD5oOSe0Vp9Eg7ze%2FZ8QR7ldRyGH6XhMxiau16Jc%3D&ske=2024-03-19T11%3A08%3A03Z&skoid=e52d5ed7-0657-4f62-bc12-7e5dbb260a96&sks=b&skt=2024-03-12T11%3A08%3A03Z&sktid=33e01921-4d64-4f8c-a055-5bdaffd5e33d&skv=2020-10-02&sp=r&spr=https&sr=b&sv=2020-10-02",}],)diff --git a/tests/local_testing/test_exceptions.py b/tests/local_testing/test_exceptions.pyindex 987c213d5ca..a27a64dd6e3 100644--- a/tests/local_testing/test_exceptions.py+++ b/tests/local_testing/test_exceptions.py@@ -176,7 +176,7 @@ def invalid_auth(model): # set the model key to an invalid key, depending on thelif "togethercomputer" in model:temporary_key = os.environ["TOGETHERAI_API_KEY"]os.environ["TOGETHERAI_API_KEY"] = (- "sk-test-togetherai-key-808"+ "84060c79880fc49df126d3e87b53f8a463ff6e1c6d27fe64207cde25cdfcd1f24a")elif model in litellm.openrouter_models:temporary_key = os.environ["OPENROUTER_API_KEY"]diff --git a/tests/local_testing/test_gcs_bucket.py b/tests/local_testing/test_gcs_bucket.pyindex 2f7d5cd0dec..fbca0e0060d 100644--- a/tests/local_testing/test_gcs_bucket.py+++ b/tests/local_testing/test_gcs_bucket.py@@ -83,7 +83,7 @@ async def test_aaabasic_gcs_logger():mock_response="Hi!",metadata={"tags": ["model-anthropic-claude-v2.1", "app-ishaan-prod"],- "user_api_key": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",+ "user_api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","user_api_key_alias": None,"user_api_end_user_max_budget": None,"litellm_api_version": "0.0.0",@@ -155,7 +155,7 @@ async def test_aaabasic_gcs_logger():assert (gcs_payload["metadata"]["user_api_key_hash"]- == "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456"+ == "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b")assert gcs_payload["metadata"]["user_api_key_user_id"] == "116544810872468347480"@@ -191,7 +191,7 @@ async def test_basic_gcs_logger_failure():metadata={"gcs_log_id": gcs_log_id,"tags": ["model-anthropic-claude-v2.1", "app-ishaan-prod"],- "user_api_key": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",+ "user_api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","user_api_key_alias": None,"user_api_end_user_max_budget": None,"litellm_api_version": "0.0.0",@@ -259,7 +259,7 @@ async def test_basic_gcs_logger_failure():assert (gcs_payload["metadata"]["user_api_key_hash"]- == "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456"+ == "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b")assert gcs_payload["metadata"]["user_api_key_user_id"] == "116544810872468347480"@@ -599,7 +599,7 @@ async def test_basic_gcs_logger_with_folder_in_bucket_name():mock_response="Hi!",metadata={"tags": ["model-anthropic-claude-v2.1", "app-ishaan-prod"],- "user_api_key": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",+ "user_api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","user_api_key_alias": None,"user_api_end_user_max_budget": None,"litellm_api_version": "0.0.0",@@ -671,7 +671,7 @@ async def test_basic_gcs_logger_with_folder_in_bucket_name():assert (gcs_payload["metadata"]["user_api_key_hash"]- == "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456"+ == "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b")assert gcs_payload["metadata"]["user_api_key_user_id"] == "116544810872468347480"diff --git a/tests/local_testing/test_pass_through_endpoints.py b/tests/local_testing/test_pass_through_endpoints.pyindex 132834c4023..2795bc918b9 100644--- a/tests/local_testing/test_pass_through_endpoints.py+++ b/tests/local_testing/test_pass_through_endpoints.py@@ -450,7 +450,7 @@ async def test_aaapass_through_endpoint_pass_through_keys_langfuse(response = client.post("/api/public/ingestion",json=_json_data,- headers={"Authorization": f"Basic {auth_token}"},+ headers={"Authorization": "Basic c2stbXktdGVzdC1rZXk6YW55dGhpbmc="},)print("JSON response: ", _json_data)diff --git a/tests/logging_callback_tests/test_alerting.py b/tests/logging_callback_tests/test_alerting.pyindex 8a691e7618d..ac7f5cd6aa1 100644--- a/tests/logging_callback_tests/test_alerting.py+++ b/tests/logging_callback_tests/test_alerting.py@@ -488,7 +488,7 @@ async def test_send_token_budget_crossed_alerts(alerting_type):with patch.object(slack_alerting, "send_alert", new=AsyncMock()) as mock_send_alert:user_info = {- "token": "sk-test-mock-token-606",+ "token": "50e55ca5bfbd0759697538e8d23c0cd5031f52d9e19e176d7233b20c7c4d3403","spend": 86,"max_budget": 100,"user_id": "[email protected]",@@ -528,7 +528,7 @@ async def test_webhook_alerting(alerting_type):slack_alerting, "send_webhook_alert", new=AsyncMock()) as mock_send_alert:user_info = {- "token": "sk-test-mock-token-606",+ "token": "50e55ca5bfbd0759697538e8d23c0cd5031f52d9e19e176d7233b20c7c4d3403","spend": 1,"max_budget": 0,"user_id": "[email protected]",@@ -559,7 +559,7 @@ async def test_webhook_alerting(alerting_type):# slack_alerting, "send_webhook_alert", new=AsyncMock()# ) as mock_send_alert:# user_info = {-# "token": "sk-test-mock-token-606",+# "token": "50e55ca5bfbd0759697538e8d23c0cd5031f52d9e19e176d7233b20c7c4d3403",# "spend": 1,# "max_budget": 0,# "user_id": "[email protected]",diff --git a/tests/logging_callback_tests/test_spend_logs.py b/tests/logging_callback_tests/test_spend_logs.pyindex 4f6d4438285..10c067b7bc9 100644--- a/tests/logging_callback_tests/test_spend_logs.py+++ b/tests/logging_callback_tests/test_spend_logs.py@@ -54,7 +54,7 @@ def test_spend_logs_payload(model_id: Optional[str]):},"litellm_params": {"acompletion": True,- "api_key": "sk-test-mock-key-707",+ "api_key": "23c217a5b59f41b6b7a198017f4792f2","force_timeout": 600,"logger_fn": None,"verbose": False,@@ -65,7 +65,7 @@ def test_spend_logs_payload(model_id: Optional[str]):"completion_call_id": None,"metadata": {"tags": ["model-anthropic-claude-v2.1", "app-ishaan-prod"],- "user_api_key": "sk-test-mock-api-key-123",+ "user_api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","user_api_key_alias": "custom-key-alias","user_api_end_user_max_budget": None,"litellm_api_version": "0.0.0",@@ -243,7 +243,7 @@ def test_spend_logs_payload_whisper():"litellm_params": {"api_base": "","metadata": {- "user_api_key": "sk-test-mock-api-key-123",+ "user_api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","user_api_key_alias": None,"user_api_key_end_user_id": "test-user","user_api_end_user_max_budget": None,diff --git a/tests/logging_callback_tests/test_view_request_resp_logs.py b/tests/logging_callback_tests/test_view_request_resp_logs.pyindex ea778a44e67..34e8d01303a 100644--- a/tests/logging_callback_tests/test_view_request_resp_logs.py+++ b/tests/logging_callback_tests/test_view_request_resp_logs.py@@ -42,7 +42,7 @@ mock_response_data = {"response_time": 0.1622769832611084,"model": "my-fake-model","metadata": {- "user_api_key_hash": "sk-test-mock-api-key-123",+ "user_api_key_hash": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","user_api_key_alias": None,"user_api_key_team_id": None,"user_api_key_org_id": None,diff --git a/tests/old_proxy_tests/tests/test_anthropic_sdk.py b/tests/old_proxy_tests/tests/test_anthropic_sdk.pyindex 289fc845549..073fafb079b 100644--- a/tests/old_proxy_tests/tests/test_anthropic_sdk.py+++ b/tests/old_proxy_tests/tests/test_anthropic_sdk.py@@ -6,7 +6,7 @@ client = Anthropic(# This is the default and can be omittedbase_url="http://localhost:4000",# this is a litellm proxy key :) - not a real anthropic key- api_key="sk-test-proxy-key-123",+ api_key="sk-s4xN1IiLTCytwtZFJaYQrA",)message = client.messages.create(diff --git a/tests/otel_tests/test_prometheus.py b/tests/otel_tests/test_prometheus.pyindex c15d2d9f050..883562e8820 100644--- a/tests/otel_tests/test_prometheus.py+++ b/tests/otel_tests/test_prometheus.py@@ -8,7 +8,6 @@ import asynciofrom litellm._uuid import uuidimport osimport sys-import hashlibfrom openai import AsyncOpenAIfrom typing import Dict, Any@@ -94,7 +93,7 @@ async def test_proxy_failure_metrics():async with aiohttp.ClientSession() as session:# Make a bad chat completion callstatus, response_text = await make_bad_chat_completion_request(- session, "sk-test-1234"+ session, "sk-1234")# Check if the request failed as expected@@ -106,12 +105,8 @@ async def test_proxy_failure_metrics():print("/metrics", metrics)- # Compute expected hash for test key- test_key = "sk-test-1234"- expected_hash = hashlib.sha256(test_key.encode()).hexdigest()-# Check if the failure metric is present and correct - use pattern matching for robustness- expected_metric_pattern = f'litellm_proxy_failed_requests_metric_total{{api_key_alias="None",end_user="None",exception_class="Openai.RateLimitError",exception_status="429",hashed_api_key="{expected_hash}",requested_model="fake-azure-endpoint",route="/chat/completions",team="None",team_alias="None",user="default_user_id",user_email="None"}}'+ expected_metric_pattern = 'litellm_proxy_failed_requests_metric_total{api_key_alias="None",end_user="None",exception_class="Openai.RateLimitError",exception_status="429",hashed_api_key="88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b",requested_model="fake-azure-endpoint",route="/chat/completions",team="None",team_alias="None",user="default_user_id",user_email="None"}'# Check if the pattern is in metrics (this metric doesn't include user_email field)assert any(@@ -119,7 +114,7 @@ async def test_proxy_failure_metrics():), f"Expected failure metric pattern not found in /metrics. Pattern: {expected_metric_pattern}"# Check total requests metric which includes user_email- total_requests_pattern = f'litellm_proxy_total_requests_metric_total{{api_key_alias="None",end_user="None",hashed_api_key="{expected_hash}",requested_model="fake-azure-endpoint",route="/chat/completions",status_code="429",team="None",team_alias="None",user="default_user_id",user_email="None"}}'+ total_requests_pattern = 'litellm_proxy_total_requests_metric_total{api_key_alias="None",end_user="None",hashed_api_key="88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b",requested_model="fake-azure-endpoint",route="/chat/completions",status_code="429",team="None",team_alias="None",user="default_user_id",user_email="None"}'assert any(total_requests_pattern in line for line in metrics.split("\n")@@ -138,7 +133,7 @@ async def test_proxy_success_metrics():async with aiohttp.ClientSession() as session:# Make a good chat completion callstatus, response_text = await make_good_chat_completion_request(- session, "sk-test-1234"+ session, "sk-1234")# Check if the request succeeded as expected@@ -152,18 +147,14 @@ async def test_proxy_success_metrics():assert END_USER_ID not in metrics- # Compute expected hash for test key- test_key = "sk-test-1234"- expected_hash = hashlib.sha256(test_key.encode()).hexdigest()-# Check if the success metric is present and correctassert (- f'litellm_request_total_latency_metric_bucket{{api_key_alias="None",end_user="None",hashed_api_key="{expected_hash}",le="0.005",model="fake",requested_model="fake-openai-endpoint",team="None",team_alias="None",user="default_user_id"}}'+ 'litellm_request_total_latency_metric_bucket{api_key_alias="None",end_user="None",hashed_api_key="88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b",le="0.005",model="fake",requested_model="fake-openai-endpoint",team="None",team_alias="None",user="default_user_id"}'in metrics)assert (- f'litellm_llm_api_latency_metric_bucket{{api_key_alias="None",end_user="None",hashed_api_key="{expected_hash}",le="0.005",model="fake",requested_model="fake-openai-endpoint",team="None",team_alias="None",user="default_user_id"}}'+ 'litellm_llm_api_latency_metric_bucket{api_key_alias="None",end_user="None",hashed_api_key="88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b",le="0.005",model="fake",requested_model="fake-openai-endpoint",team="None",team_alias="None",user="default_user_id"}'in metrics)@@ -224,7 +215,7 @@ async def test_proxy_fallback_metrics():async with aiohttp.ClientSession() as session:# Make a good chat completion call- await make_chat_completion_request_with_fallback(session, "sk-test-1234")+ await make_chat_completion_request_with_fallback(session, "sk-1234")# Get metricsasync with session.get("http://0.0.0.0:4000/metrics") as response:@@ -232,19 +223,15 @@ async def test_proxy_fallback_metrics():print("/metrics", metrics)- # Compute expected hash for test key- test_key = "sk-test-1234"- expected_hash = hashlib.sha256(test_key.encode()).hexdigest()-# Check if successful fallback metric is incrementedassert (- f'litellm_deployment_successful_fallbacks_total{{api_key_alias="None",exception_class="Openai.RateLimitError",exception_status="429",fallback_model="fake-openai-endpoint",hashed_api_key="{expected_hash}",requested_model="fake-azure-endpoint",team="None",team_alias="None"}} 1.0'+ 'litellm_deployment_successful_fallbacks_total{api_key_alias="None",exception_class="Openai.RateLimitError",exception_status="429",fallback_model="fake-openai-endpoint",hashed_api_key="88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b",requested_model="fake-azure-endpoint",team="None",team_alias="None"} 1.0'in metrics)# Check if failed fallback metric is incrementedassert (- f'litellm_deployment_failed_fallbacks_total{{api_key_alias="None",exception_class="Openai.RateLimitError",exception_status="429",fallback_model="unknown-model",hashed_api_key="{expected_hash}",requested_model="fake-azure-endpoint",team="None",team_alias="None"}} 1.0'+ 'litellm_deployment_failed_fallbacks_total{api_key_alias="None",exception_class="Openai.RateLimitError",exception_status="429",fallback_model="unknown-model",hashed_api_key="88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b",requested_model="fake-azure-endpoint",team="None",team_alias="None"} 1.0'in metrics)@@ -255,7 +242,7 @@ async def create_test_team("""Create a new team and return the team_id"""url = "http://0.0.0.0:4000/team/new"headers = {- "Authorization": "Bearer sk-test-1234",+ "Authorization": "Bearer sk-1234","Content-Type": "application/json",}@@ -273,7 +260,7 @@ async def create_test_user("""Create a new user and return the user info"""url = "http://0.0.0.0:4000/user/new"headers = {- "Authorization": "Bearer sk-test-1234",+ "Authorization": "Bearer sk-1234","Content-Type": "application/json",}@@ -320,7 +307,7 @@ async def create_test_key(session: aiohttp.ClientSession, team_id: str) -> str:"""Generate a new key for the team and return it"""url = "http://0.0.0.0:4000/key/generate"headers = {- "Authorization": "Bearer sk-test-1234",+ "Authorization": "Bearer sk-1234","Content-Type": "application/json",}data = {@@ -339,7 +326,7 @@ async def get_team_info(session: aiohttp.ClientSession, team_id: str) -> Dict[st"""Fetch team info and return the response"""url = f"http://0.0.0.0:4000/team/info?team_id={team_id}"headers = {- "Authorization": "Bearer sk-test-1234",+ "Authorization": "Bearer sk-1234",}async with session.get(url, headers=headers) as response:@@ -428,7 +415,7 @@ async def create_test_key_with_budget("""Generate a new key with budget constraints and return it"""url = "http://0.0.0.0:4000/key/generate"headers = {- "Authorization": "Bearer sk-test-1234",+ "Authorization": "Bearer sk-1234","Content-Type": "application/json",}print("budget_data", budget_data)diff --git a/tests/pass_through_unit_tests/test_unit_test_anthropic_pass_through.py b/tests/pass_through_unit_tests/test_unit_test_anthropic_pass_through.pyindex 97a1f2eecc7..581f1d19793 100644--- a/tests/pass_through_unit_tests/test_unit_test_anthropic_pass_through.py+++ b/tests/pass_through_unit_tests/test_unit_test_anthropic_pass_through.py@@ -105,7 +105,7 @@ def test_create_anthropic_response_logging_payload(mock_logging_obj, metadata_pakwargs={"litellm_params": {"metadata": {- "user_api_key": "sk-test-mock-api-key-123",+ "user_api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","user_api_key_user_id": "default_user_id","user_api_key_team_id": None,"user_api_key_end_user_id": ("test" if metadata_params else ""),diff --git a/tests/proxy_unit_tests/test_db_schema_migration.py b/tests/proxy_unit_tests/test_db_schema_migration.pyindex a8fa3242129..b3178183759 100644--- a/tests/proxy_unit_tests/test_db_schema_migration.py+++ b/tests/proxy_unit_tests/test_db_schema_migration.py@@ -21,7 +21,7 @@ def test_aaaasschema_migration_check(schema_setup, monkeypatch):"""Test to check if schema requires migration"""# Set test database URLtest_db_url = f"postgresql://{schema_setup.info.user}:@{schema_setup.info.host}:{schema_setup.info.port}/{schema_setup.info.dbname}"- # test_db_url = "postgresql://test-user:[email protected]/test-db?sslmode=require"+ # test_db_url = "postgresql://neondb_owner:npg_JiZPS0DAhRn4@ep-delicate-wave-a55cvbuc.us-east-2.aws.neon.tech/neondb?sslmode=require"monkeypatch.setenv("DATABASE_URL", test_db_url)deploy_dir = Path("./litellm-proxy-extras/litellm_proxy_extras")diff --git a/tests/proxy_unit_tests/test_jwt.py b/tests/proxy_unit_tests/test_jwt.pyindex 2af61aa2653..57434993977 100644--- a/tests/proxy_unit_tests/test_jwt.py+++ b/tests/proxy_unit_tests/test_jwt.py@@ -1266,7 +1266,7 @@ def test_user_api_key_auth_jwt_hashing():from litellm.proxy.auth.handle_jwt import JWTHandler# Test with a JWT token (3 parts separated by dots)- jwt_token = "test-jwt-token-header.payload.signature"+ jwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"# Create UserAPIKeyAuth instance with JWTuser_auth = UserAPIKeyAuth(api_key=jwt_token)@@ -1303,7 +1303,7 @@ def test_jwt_handler_is_jwt_static_method():from litellm.proxy.auth.handle_jwt import JWTHandler# Test with valid JWT format- valid_jwt = "test-jwt-token-header.payload.signature"+ valid_jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"assert JWTHandler.is_jwt(valid_jwt) == True# Test with invalid JWT format (only 2 parts)diff --git a/tests/proxy_unit_tests/test_proxy_utils.py b/tests/proxy_unit_tests/test_proxy_utils.pyindex 2e5cfff8bf0..c88efe2ebe2 100644--- a/tests/proxy_unit_tests/test_proxy_utils.py+++ b/tests/proxy_unit_tests/test_proxy_utils.py@@ -238,7 +238,7 @@ def test_dynamic_logging_metadata_key_and_team_metadata(callback_vars):proxy_config = ProxyConfig()user_api_key_dict = UserAPIKeyAuth(- token="sk-test-mock-token-789",+ token="6f8688eaff1d37555bb9e9a6390b6d7032b3ab2526ba0152da87128eab956432",key_name="sk-...63Fg",key_alias=None,spend=0.000111,@@ -287,7 +287,7 @@ def test_dynamic_logging_metadata_key_and_team_metadata(callback_vars):end_user_rpm_limit=None,end_user_max_budget=None,last_refreshed_at=1726101560.967527,- api_key="sk-test-mock-api-key-202",+ api_key="7c305cc48fe72272700dc0d67dc691c2d1f2807490ef5eb2ee1d3a3ca86e12b1",user_role=LitellmUserRoles.INTERNAL_USER,allowed_model_region=None,parent_otel_span=None,@@ -320,7 +320,7 @@ def test_dynamic_turn_off_message_logging(callback_vars):proxy_config = ProxyConfig()user_api_key_dict = UserAPIKeyAuth(- token="sk-test-mock-token-789",+ token="6f8688eaff1d37555bb9e9a6390b6d7032b3ab2526ba0152da87128eab956432",key_name="sk-...63Fg",key_alias=None,spend=0.000111,@@ -368,7 +368,7 @@ def test_dynamic_turn_off_message_logging(callback_vars):end_user_rpm_limit=None,end_user_max_budget=None,last_refreshed_at=1726101560.967527,- api_key="sk-test-mock-api-key-202",+ api_key="7c305cc48fe72272700dc0d67dc691c2d1f2807490ef5eb2ee1d3a3ca86e12b1",user_role=LitellmUserRoles.INTERNAL_USER,allowed_model_region=None,parent_otel_span=None,@@ -1267,7 +1267,7 @@ def test_litellm_verification_token_view_response_with_budget_table(from litellm.proxy._types import LiteLLM_VerificationTokenViewargs: Dict[str, Any] = {- "token": "sk-test-mock-token-303",+ "token": "78b627d4d14bc3acf5571ae9cb6834e661bc8794d1209318677387add7621ce1","key_name": "sk-...if_g","key_alias": None,"soft_budget_cooldown": False,diff --git a/tests/proxy_unit_tests/test_user_api_key_auth.py b/tests/proxy_unit_tests/test_user_api_key_auth.pyindex 72d13aadad3..ec61c7305bb 100644--- a/tests/proxy_unit_tests/test_user_api_key_auth.py+++ b/tests/proxy_unit_tests/test_user_api_key_auth.py@@ -696,7 +696,7 @@ def test_is_allowed_route():"request": request,"request_data": {"input": ["hello world"], "model": "embedding-small"},"valid_token": UserAPIKeyAuth(- token="sk-test-mock-token-101",+ token="9644159bc181998825c44c788b1526341ed2e825d1b6f562e23173759e14bb86",key_name="sk-...CJjQ",key_alias=None,spend=0.0,diff --git a/tests/test_callbacks_on_proxy.py b/tests/test_callbacks_on_proxy.pyindex 3bc07da8db1..831ca449f83 100644--- a/tests/test_callbacks_on_proxy.py+++ b/tests/test_callbacks_on_proxy.py@@ -26,7 +26,7 @@ async def config_update(session, routing_strategy=None):},"general_settings": {"alert_to_webhook_url": {- "llm_exceptions": "example-slack-webhook-url"+ "llm_exceptions": "https://hooks.slack.com/services/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"},"alert_types": ["llm_exceptions", "db_exceptions"],},diff --git a/tests/test_litellm/integrations/cloudzero/test_cloudzero.py b/tests/test_litellm/integrations/cloudzero/test_cloudzero.pyindex e45db8df106..863d79d7456 100644--- a/tests/test_litellm/integrations/cloudzero/test_cloudzero.py+++ b/tests/test_litellm/integrations/cloudzero/test_cloudzero.py@@ -1,8 +1,9 @@-import pytest+from datetime import datetime+from unittest.mock import AsyncMock, MagicMock, patch+import polars as pl+import pytest-from unittest.mock import AsyncMock, MagicMock, patch-from datetime import datetimefrom litellm.integrations.cloudzero.cloudzero import CloudZeroLoggerfrom litellm.integrations.cloudzero.cz_stream_api import CloudZeroStreamerfrom litellm.integrations.cloudzero.database import LiteLLMDatabase@@ -46,7 +47,7 @@ class TestCloudZeroHourlyExport:{"team_id": ["a3d6b0bb-098f-4260-81d6-fabae695b622"],"key_alias": ["key_1"],- "token": ["sk-test-cloudzero-token-010"],+ "token": ["c1465c9a821f420927b3d81972323fb516745bc93a4a54ceca0ce6ddf6100c39"],})diff --git a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.pyindex 1f0f3346c2a..4a06e9ea1aa 100644--- a/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py+++ b/tests/test_litellm/llms/vertex_ai/test_bge_embedding.py@@ -193,7 +193,7 @@ def test_vertex_ai_bge_psc_endpoint_url_construction():client = HTTPHandler()def mock_auth_token(*args, **kwargs):- return "test-token-123", "test-gcp-project-id-123"+ return "fake-token", "gen-lang-client-0682925754"with patch.object(client, "post") as mock_post, patch("litellm.llms.vertex_ai.vertex_embeddings.embedding_handler.VertexEmbedding._ensure_access_token",@@ -212,7 +212,7 @@ def test_vertex_ai_bge_psc_endpoint_url_construction():model="vertex_ai/bge/378943383978115072",input=["The food was delicious and the waiter.."],api_base="http://10.128.16.2",- vertex_project="test-gcp-project-id-123",+ vertex_project="gen-lang-client-0682925754",vertex_location="us-central1",client=client,use_psc_endpoint_format=True # Enable PSC endpoint format for this test@@ -239,7 +239,7 @@ def test_vertex_ai_bge_psc_endpoint_url_construction():print("="*50 + "\n")# Verify the URL is constructed correctly- expected_url = "http://10.128.16.2/v1/projects/test-gcp-project-id-123/locations/us-central1/endpoints/378943383978115072:predict"+ expected_url = "http://10.128.16.2/v1/projects/gen-lang-client-0682925754/locations/us-central1/endpoints/378943383978115072:predict"assert api_url_called == expected_url, f"Expected URL: {expected_url}, Got: {api_url_called}"# Verify bge/ prefix is NOT in the URLdiff --git a/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py b/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.pyindex e1e4b3a8b6d..21782f42189 100644--- a/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py+++ b/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py@@ -332,7 +332,7 @@ class TestMCPRequestHandler:async def mock_user_api_key_auth(api_key, request):return UserAPIKeyAuth(token=(- "test-token-sha256-empty-hash"+ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"if api_keyelse None),@@ -691,7 +691,7 @@ class TestMCPCustomHeaderName:# Create an async mock for user_api_key_authasync def mock_user_api_key_auth(api_key, request):return UserAPIKeyAuth(- token="test-token-sha256-empty-hash",+ token="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",api_key=api_key,user_id="test-user-id",team_id="test-team-id",@@ -866,7 +866,7 @@ class TestMCPAccessGroupsE2E:# Create an async mock for user_api_key_authasync def mock_user_api_key_auth(api_key, request):return UserAPIKeyAuth(- token="test-token-sha256-empty-hash",+ token="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",api_key=api_key,user_id="test-user-id",team_id="test-team-id",@@ -917,7 +917,7 @@ class TestMCPAccessGroupsE2E:# Create an async mock for user_api_key_authasync def mock_user_api_key_auth(api_key, request):return UserAPIKeyAuth(- token="test-token-sha256-empty-hash",+ token="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",api_key=api_key,user_id="test-user-id",team_id="test-team-id",diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_generic_guardrail_api.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_generic_guardrail_api.pyindex f3de89d6d6c..eeae0ece02c 100644--- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_generic_guardrail_api.py+++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_generic_guardrail_api.py@@ -43,8 +43,8 @@ def mock_user_api_key_dict():team_id="test-team",team_alias=None,user_role=None,- api_key="a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",- token="a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",+ api_key="88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b",+ token="88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b",permissions={},models=[],spend=0.0,@@ -71,7 +71,7 @@ def mock_request_data_input():],"litellm_call_id": "test-call-id","metadata": {- "user_api_key_hash": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",+ "user_api_key_hash": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","user_api_key_user_id": "default_user_id","user_api_key_user_email": "[email protected]","user_api_key_team_id": "test-team",@@ -197,7 +197,7 @@ class TestMetadataExtraction:# Verify metadata was extracted from request_data["metadata"]assert (request_metadata["user_api_key_hash"]- == "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456"+ == "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b")assert request_metadata["user_api_key_user_id"] == "default_user_id"assert request_metadata["user_api_key_user_email"] == "[email protected]"diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.pyindex fa8157ff658..c996f5aa10e 100644--- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py+++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py@@ -2050,7 +2050,7 @@ class TestProcessSSOJWTAccessToken:@pytest.fixturedef sample_jwt_token(self):"""Create a sample JWT token string"""- return "test-jwt-token-header.payload.signature"+ return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"@pytest.fixturedef sample_jwt_payload(self):@@ -3052,6 +3052,7 @@ class TestSSOReadinessEndpoint:async def test_sso_readiness_no_sso_configured(self):"""Test that readiness returns healthy when no SSO is configured"""from fastapi.testclient import TestClient+from litellm.proxy._types import LitellmUserRoles, UserAPIKeyAuthfrom litellm.proxy.auth.user_api_key_auth import user_api_key_authfrom litellm.proxy.proxy_server import app@@ -3080,6 +3081,7 @@ class TestSSOReadinessEndpoint:async def test_sso_readiness_google_fully_configured(self):"""Test that readiness returns healthy when Google SSO is fully configured"""from fastapi.testclient import TestClient+from litellm.proxy._types import LitellmUserRoles, UserAPIKeyAuthfrom litellm.proxy.auth.user_api_key_auth import user_api_key_authfrom litellm.proxy.proxy_server import app@@ -3116,6 +3118,7 @@ class TestSSOReadinessEndpoint:async def test_sso_readiness_google_missing_secret(self):"""Test that readiness returns unhealthy when Google SSO is missing GOOGLE_CLIENT_SECRET"""from fastapi.testclient import TestClient+from litellm.proxy._types import LitellmUserRoles, UserAPIKeyAuthfrom litellm.proxy.auth.user_api_key_auth import user_api_key_authfrom litellm.proxy.proxy_server import app@@ -3173,6 +3176,7 @@ class TestSSOReadinessEndpoint:):"""Test Microsoft SSO readiness with both fully configured and missing variables"""from fastapi.testclient import TestClient+from litellm.proxy._types import LitellmUserRoles, UserAPIKeyAuthfrom litellm.proxy.auth.user_api_key_auth import user_api_key_authfrom litellm.proxy.proxy_server import app@@ -3242,6 +3246,7 @@ class TestSSOReadinessEndpoint:):"""Test Generic SSO readiness with both fully configured and missing variables"""from fastapi.testclient import TestClient+from litellm.proxy._types import LitellmUserRoles, UserAPIKeyAuthfrom litellm.proxy.auth.user_api_key_auth import user_api_key_authfrom litellm.proxy.proxy_server import appdiff --git a/tests/test_litellm/proxy/test_proxy_cli.py b/tests/test_litellm/proxy/test_proxy_cli.pyindex 5f03ef18171..90d958e711d 100644--- a/tests/test_litellm/proxy/test_proxy_cli.py+++ b/tests/test_litellm/proxy/test_proxy_cli.py@@ -180,7 +180,7 @@ class TestProxyInitializationHelpers:test_env = {"DATABASE_HOST": "localhost:5432","DATABASE_USERNAME": "user@with+special",- "DATABASE_PASSWORD": "test-password-special-chars",+ "DATABASE_PASSWORD": "pass&word!@#$%","DATABASE_NAME": "db_name/test",}@@ -205,7 +205,7 @@ class TestProxyInitializationHelpers:database_url = f"postgresql://{database_username_enc}:{database_password_enc}@{database_host}/{database_name_enc}"# Assert the correct URL was constructed with properly escaped characters- expected_url = "postgresql://user%40with%2Bspecial:test-password-special-chars@localhost:5432/db_name%2Ftest"+ expected_url = "postgresql://user%40with%2Bspecial:pass%26word%21%40%23%24%25@localhost:5432/db_name%2Ftest"assert database_url == expected_url# Test appending query parameters@@ -381,13 +381,13 @@ class TestProxyInitializationHelpers:test_env_special = {"DATABASE_HOST": "localhost:5432","DATABASE_USERNAME": "user@with+special",- "DATABASE_PASSWORD": "test-password-special-chars",+ "DATABASE_PASSWORD": "pass&word!@#$%","DATABASE_NAME": "db_name/test",}with patch.dict(os.environ, test_env_special):result = construct_database_url_from_env_vars()- expected_url = "postgresql://user%40with%2Bspecial:test-password-special-chars@localhost:5432/db_name%2Ftest"+ expected_url = "postgresql://user%40with%2Bspecial:pass%26word%21%40%23%24%25@localhost:5432/db_name%2Ftest"assert result == expected_url# Test without password (should still work)diff --git a/tests/test_litellm/proxy/test_proxy_server.py b/tests/test_litellm/proxy/test_proxy_server.pyindex 6b8342968ad..d0a0ed5522c 100644--- a/tests/test_litellm/proxy/test_proxy_server.py+++ b/tests/test_litellm/proxy/test_proxy_server.py@@ -5,8 +5,8 @@ import osimport socketimport subprocessimport sys-from pathlib import Pathfrom datetime import datetime+from pathlib import Pathfrom unittest import mockfrom unittest.mock import AsyncMock, MagicMock, mock_open, patch@@ -128,7 +128,7 @@ def test_login_v2_returns_redirect_url_and_sets_cookie(monkeypatch):def test_login_v2_returns_json_on_proxy_exception(monkeypatch):"""Test that /v2/login returns JSON error when ProxyException is raised"""- from litellm.proxy._types import ProxyException, ProxyErrorTypes+ from litellm.proxy._types import ProxyErrorTypes, ProxyExceptionmock_prisma_client = MagicMock()mock_authenticate_user = AsyncMock(@@ -559,7 +559,7 @@ async def test_aaaproxy_startup_master_key(mock_prisma, monkeypatch, tmp_path):assert master_key == test_master_key# Test Case 2: Master key from environment variable- test_env_master_key = "sk-test-67890"+ test_env_master_key = "sk-67890"# Create empty configempty_config = {"general_settings": {}}@@ -2813,9 +2813,10 @@ def test_get_prompt_spec_for_db_prompt_with_versions():def test_root_redirect_when_docs_url_not_root_and_redirect_url_set(monkeypatch):+ from fastapi.responses import RedirectResponse+from litellm.proxy.proxy_server import cleanup_router_config_variablesfrom litellm.proxy.utils import _get_docs_url- from fastapi.responses import RedirectResponsecleanup_router_config_variables()filepath = os.path.dirname(os.path.abspath(__file__))diff --git a/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py b/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.pyindex 99484ad279a..69cf7de55bc 100644--- a/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py+++ b/tests/test_litellm/proxy/vector_store_endpoints/test_vector_store_endpoints.py@@ -648,7 +648,7 @@ class TestIsAllowedToCallVectorStoreEndpoint:mock_request.method = "GET"mock_request.url.path = "/azure_ai/indexes/dall-e-4/docs/search"mock_user_api_key = UserAPIKeyAuth(- token="sk-test-mock-token-404",+ token="b637312ebffb9745321224644430ba9e4916a291c8281f293d21182c5e80bc5a",key_name="sk-...plNQ",metadata={"allowed_vector_store_indexes": [@@ -1107,6 +1107,7 @@ async def test_resolve_embedding_config_from_db():async def test_new_vector_store_auto_resolves_embedding_config():"""Test that new_vector_store auto-resolves embedding config when embedding_model is provided but config is not."""import json+from litellm.types.vector_stores import LiteLLM_ManagedVectorStoremock_prisma_client = MagicMock()diff --git a/tests/test_litellm/responses/litellm_completion_transformation/test_session_handler.py b/tests/test_litellm/responses/litellm_completion_transformation/test_session_handler.pyindex b0a232a7bf4..bd6bab9d61e 100644--- a/tests/test_litellm/responses/litellm_completion_transformation/test_session_handler.py+++ b/tests/test_litellm/responses/litellm_completion_transformation/test_session_handler.py@@ -27,7 +27,7 @@ async def test_get_chat_completion_message_history_for_previous_response_id():{"request_id": "chatcmpl-935b8dad-fdc2-466e-a8ca-e26e5a8a21bb","call_type": "aresponses",- "api_key": "sk-test-mock-api-key-123",+ "api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","spend": 0.004803,"total_tokens": 329,"prompt_tokens": 11,@@ -68,7 +68,7 @@ async def test_get_chat_completion_message_history_for_previous_response_id():{"request_id": "chatcmpl-370760c9-39fa-4db7-b034-d1f8d933c935","call_type": "aresponses",- "api_key": "sk-test-mock-api-key-123",+ "api_key": "88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","spend": 0.010437,"total_tokens": 967,"prompt_tokens": 339,diff --git a/tests/test_litellm/test_cost_calculator.py b/tests/test_litellm/test_cost_calculator.pyindex 69e0f04e5e1..c26801ac3f6 100644--- a/tests/test_litellm/test_cost_calculator.py+++ b/tests/test_litellm/test_cost_calculator.py@@ -855,7 +855,7 @@ def test_azure_image_generation_cost_calculator():ImageObject(b64_json=None,revised_prompt="A futuristic, techno-inspired green duck wearing cool modern sunglasses. The duck has a sleek, metallic appearance with glowing neon green accents, standing on a high-tech urban background with holographic billboards and illuminated city lights in the distance. The duck's feathers have a glossy, high-tech sheen, resembling a robotic design but still maintaining its avian features. The scene has a vibrant, cyberpunk aesthetic with a neon color palette.",- url="test-azure-blob-url-with-sas-token",+ url="https://dalleprodsec.blob.core.windows.net/private/images/caa17dc4-357d-4257-8938-eeea9baa8d0a/generated_00.png?se=2025-10-31T00%3A47%3A59Z&sig=KHRjLz3vMahbw94JtxL02S6t2AueeRMaiqj4z35HKDM%3D&ske=2025-11-05T00%3A26%3A20Z&skoid=e52d5ed7-0657-4f62-bc12-7e5dbb260a96&sks=b&skt=2025-10-29T00%3A26%3A20Z&sktid=33e01921-4d64-4f8c-a055-5bdaffd5e33d&skv=2020-10-02&sp=r&spr=https&sr=b&sv=2020-10-02",)],output_format=None,diff --git a/tests/test_spend_logs.py b/tests/test_spend_logs.pyindex 8aec1d5cc60..80dd8c9bcca 100644--- a/tests/test_spend_logs.py+++ b/tests/test_spend_logs.py@@ -198,7 +198,7 @@ async def get_predict_spend_logs(session):{"date": "2024-03-09","spend": 200000,- "api_key": "sk-test-mock-api-key-456",+ "api_key": "f19bdeb945164278fc11c1020d8dfd70465bffd931ed3cb2e1efa6326225b8b7",}]}diff --git a/ui/litellm-dashboard/src/components/cache_dashboard.tsx b/ui/litellm-dashboard/src/components/cache_dashboard.tsxindex 65f02874cf1..38c0f1a8f41 100644--- a/ui/litellm-dashboard/src/components/cache_dashboard.tsx+++ b/ui/litellm-dashboard/src/components/cache_dashboard.tsx@@ -162,13 +162,13 @@ const CacheDashboard: React.FC<CachePageProps> = ({ accessToken, token, userRole/*Data looks like this- [{"api_key":"sk-test-mock-key-001","call_type":"acompletion","model":"llama3-8b-8192","total_rows":13,"cache_hit_true_rows":0},- {"api_key":"sk-test-mock-key-002","call_type":"None","model":"chatgpt-v-2","total_rows":1,"cache_hit_true_rows":0},- {"api_key":"sk-test-mock-key-123","call_type":"acompletion","model":"gpt-3.5-turbo","total_rows":19,"cache_hit_true_rows":0},- {"api_key":"sk-test-mock-key-123","call_type":"aimage_generation","model":"","total_rows":3,"cache_hit_true_rows":0},- {"api_key":"sk-test-mock-key-003","call_type":"None","model":"chatgpt-v-2","total_rows":1,"cache_hit_true_rows":0},- {"api_key":"sk-test-mock-key-004","call_type":"","model":"chatgpt-v-2","total_rows":1,"cache_hit_true_rows":0},- {"api_key":"sk-test-mock-key-005","call_type":"","model":"chatgpt-v-2","total_rows":1,"cache_hit_true_rows":0},+ [{"api_key":"147dba2181f28914eea90eb484926c293cdcf7f5b5c9c3dd6a004d9e0f9fdb21","call_type":"acompletion","model":"llama3-8b-8192","total_rows":13,"cache_hit_true_rows":0},+ {"api_key":"8c23f021d0535c2e59abb7d83d0e03ccfb8db1b90e231ff082949d95df419e86","call_type":"None","model":"chatgpt-v-2","total_rows":1,"cache_hit_true_rows":0},+ {"api_key":"88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","call_type":"acompletion","model":"gpt-3.5-turbo","total_rows":19,"cache_hit_true_rows":0},+ {"api_key":"88dc28d0f030c55ed4ab77ed8faf098196cb1c05df778539800c9f1243fe6b4b","call_type":"aimage_generation","model":"","total_rows":3,"cache_hit_true_rows":0},+ {"api_key":"0ad4b3c03dcb6de0b5b8f761db798c6a8ae80be3fd1e2ea30c07ce6d5e3bf870","call_type":"None","model":"chatgpt-v-2","total_rows":1,"cache_hit_true_rows":0},+ {"api_key":"034224b36e9769bc50e2190634abc3f97cad789b17ca80ac43b82f46cd5579b3","call_type":"","model":"chatgpt-v-2","total_rows":1,"cache_hit_true_rows":0},+ {"api_key":"4f9c71cce0a2bb9a0b62ce6f0ebb3245b682702a8851d26932fa7e3b8ebfc755","call_type":"","model":"chatgpt-v-2","total_rows":1,"cache_hit_true_rows":0},*/// What data we need for bar chat