From 414d2dcb523daa3a4aecd4e73e1a771c54c4ea3a Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 30 Aug 2024 16:35:07 -0700 Subject: [PATCH] call spend logs endpoint --- .../pass_through_config.yaml | 2 +- tests/pass_through_tests/test_vertex_ai.py | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/example_config_yaml/pass_through_config.yaml b/litellm/proxy/example_config_yaml/pass_through_config.yaml index db9558b3cf..41d581249f 100644 --- a/litellm/proxy/example_config_yaml/pass_through_config.yaml +++ b/litellm/proxy/example_config_yaml/pass_through_config.yaml @@ -6,4 +6,4 @@ model_list: api_base: https://exampleopenaiendpoint-production.up.railway.app/ general_settings: master_key: sk-1234 - custom_auth: example_config_yaml.custom_auth.user_api_key_auth \ No newline at end of file + custom_auth: custom_auth_basic.user_api_key_auth \ No newline at end of file diff --git a/tests/pass_through_tests/test_vertex_ai.py b/tests/pass_through_tests/test_vertex_ai.py index 10660ddb95..30600c97d6 100644 --- a/tests/pass_through_tests/test_vertex_ai.py +++ b/tests/pass_through_tests/test_vertex_ai.py @@ -57,6 +57,23 @@ def load_vertex_ai_credentials(): os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = os.path.abspath(temp_file.name) +async def call_spend_logs_endpoint(): + """ + Call this + curl -X GET "http://0.0.0.0:4000/spend/logs?start_date={}" -H "Authorization: Bearer sk-1234" + """ + import datetime + import requests + + todays_date = datetime.datetime.now().strftime("%Y-%m-%d") + url = f"http://0.0.0.0:4000/spend/logs?start_date={todays_date}" + headers = {"Authorization": f"Bearer sk-1234"} + response = requests.get(url, headers=headers) + print("response from call_spend_logs_endpoint", response) + + return response + + LITE_LLM_ENDPOINT = "http://localhost:4000" @@ -74,4 +91,7 @@ async def test_basic_vertex_ai_pass_through_with_spendlog(): print("response", response) + _spend_logs_response = await call_spend_logs_endpoint() + print("spend logs response", _spend_logs_response) + pass