forked from phoenix/litellm-mirror
call spend logs endpoint
This commit is contained in:
parent
c86d1cb391
commit
414d2dcb52
2 changed files with 21 additions and 1 deletions
|
@ -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
|
||||
custom_auth: custom_auth_basic.user_api_key_auth
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue