Class: LiteLLMClient::BudgetSpendTrackingApi
- Inherits:
-
Object
- Object
- LiteLLMClient::BudgetSpendTrackingApi
- Defined in:
- lib/litellm_client/api/budget_spend_tracking_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#add_allowed_ip_add_allowed_ip_post(ip_address, opts = {}) ⇒ Object
Add Allowed Ip.
-
#add_allowed_ip_add_allowed_ip_post_with_http_info(ip_address, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Add Allowed Ip.
-
#calculate_spend_spend_calculate_post(spend_calculate_request, opts = {}) ⇒ Object
Calculate Spend Accepts all the params of completion_cost.
-
#calculate_spend_spend_calculate_post_with_http_info(spend_calculate_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Calculate Spend Accepts all the params of completion_cost.
-
#delete_allowed_ip_delete_allowed_ip_post(ip_address, opts = {}) ⇒ Object
Delete Allowed Ip.
-
#delete_allowed_ip_delete_allowed_ip_post_with_http_info(ip_address, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Delete Allowed Ip.
-
#get_global_spend_report_global_spend_report_get(opts = {}) ⇒ Array<LiteLLMSpendLogs>
Get Global Spend Report Get Daily Spend per Team, based on specific startTime and endTime.
-
#get_global_spend_report_global_spend_report_get_with_http_info(opts = {}) ⇒ Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>
Get Global Spend Report Get Daily Spend per Team, based on specific startTime and endTime.
-
#get_user_daily_activity_user_daily_activity_get(opts = {}) ⇒ SpendAnalyticsPaginatedResponse
Get User Daily Activity [BETA] This is a beta endpoint.
-
#get_user_daily_activity_user_daily_activity_get_with_http_info(opts = {}) ⇒ Array<(SpendAnalyticsPaginatedResponse, Integer, Hash)>
Get User Daily Activity [BETA] This is a beta endpoint.
-
#global_spend_reset_global_spend_reset_post(opts = {}) ⇒ Object
Global Spend Reset ADMIN ONLY / MASTER KEY Only Endpoint Globally reset spend for All API Keys and Teams, maintain LiteLLM_SpendLogs 1.
-
#global_spend_reset_global_spend_reset_post_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>
Global Spend Reset ADMIN ONLY / MASTER KEY Only Endpoint Globally reset spend for All API Keys and Teams, maintain LiteLLM_SpendLogs 1.
-
#global_view_spend_tags_global_spend_tags_get(opts = {}) ⇒ Array<LiteLLMSpendLogs>
Global View Spend Tags LiteLLM Enterprise - View Spend Per Request Tag.
-
#global_view_spend_tags_global_spend_tags_get_with_http_info(opts = {}) ⇒ Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>
Global View Spend Tags LiteLLM Enterprise - View Spend Per Request Tag.
-
#initialize(api_client = ApiClient.default) ⇒ BudgetSpendTrackingApi
constructor
A new instance of BudgetSpendTrackingApi.
-
#view_spend_logs_spend_logs_get(opts = {}) ⇒ Array<LiteLLMSpendLogs>
View Spend Logs View all spend logs, if request_id is provided, only logs for that request_id will be returned Example Request for all logs “‘ curl -X GET "0.0.0.0:8000/spend/logs" -H "Authorization: Bearer sk-1234" “` Example Request for specific request_id “` curl -X GET "0.0.0.0:8000/spend/logs?request_id=chatcmpl-6dcb2540-d3d7-4e49-bb27-291f863f112e" -H "Authorization: Bearer sk-1234" “` Example Request for specific api_key “` curl -X GET "0.0.0.0:8000/spend/logs?api_key=sk-Fn8Ej39NkBQmUagFEoUWPQ" -H "Authorization: Bearer sk-1234" “` Example Request for specific user_id “` curl -X GET "0.0.0.0:8000/spend/[email protected]" -H "Authorization: Bearer sk-1234" “`.
-
#view_spend_logs_spend_logs_get_with_http_info(opts = {}) ⇒ Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>
View Spend Logs View all spend logs, if request_id is provided, only logs for that request_id will be returned Example Request for all logs ``` curl -X GET "0.0.0.0:8000/spend/logs" -H "Authorization: Bearer sk-1234" ``` Example Request for specific request_id ``` curl -X GET "0.0.0.0:8000/spend/logs?request_id=chatcmpl-6dcb2540-d3d7-4e49-bb27-291f863f112e" -H "Authorization: Bearer sk-1234" ``` Example Request for specific api_key ``` curl -X GET "0.0.0.0:8000/spend/logs?api_key=sk-Fn8Ej39NkBQmUagFEoUWPQ" -H "Authorization: Bearer sk-1234" ``` Example Request for specific user_id ``` curl -X GET "0.0.0.0:8000/spend/logs?user_id=[email protected]" -H "Authorization: Bearer sk-1234" ```.
-
#view_spend_tags_spend_tags_get(opts = {}) ⇒ Array<LiteLLMSpendLogs>
View Spend Tags LiteLLM Enterprise - View Spend Per Request Tag Example Request: “‘ curl -X GET "0.0.0.0:8000/spend/tags" -H "Authorization: Bearer sk-1234" “` Spend with Start Date and End Date “` curl -X GET "0.0.0.0:8000/spend/tags?start_date=2022-01-01&end_date=2022-02-01" -H "Authorization: Bearer sk-1234" “`.
-
#view_spend_tags_spend_tags_get_with_http_info(opts = {}) ⇒ Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>
View Spend Tags LiteLLM Enterprise - View Spend Per Request Tag Example Request: ``` curl -X GET "0.0.0.0:8000/spend/tags" -H "Authorization: Bearer sk-1234" ``` Spend with Start Date and End Date ``` curl -X GET "0.0.0.0:8000/spend/tags?start_date=2022-01-01&end_date=2022-02-01" -H "Authorization: Bearer sk-1234" ```.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ BudgetSpendTrackingApi
Returns a new instance of BudgetSpendTrackingApi.
19 20 21 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#add_allowed_ip_add_allowed_ip_post(ip_address, opts = {}) ⇒ Object
Add Allowed Ip
26 27 28 29 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 26 def add_allowed_ip_add_allowed_ip_post(ip_address, opts = {}) data, _status_code, _headers = add_allowed_ip_add_allowed_ip_post_with_http_info(ip_address, opts) data end |
#add_allowed_ip_add_allowed_ip_post_with_http_info(ip_address, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Add Allowed Ip
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 35 def add_allowed_ip_add_allowed_ip_post_with_http_info(ip_address, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BudgetSpendTrackingApi.add_allowed_ip_add_allowed_ip_post ...' end # verify the required parameter 'ip_address' is set if @api_client.config.client_side_validation && ip_address.nil? fail ArgumentError, "Missing the required parameter 'ip_address' when calling BudgetSpendTrackingApi.add_allowed_ip_add_allowed_ip_post" end # resource path local_var_path = '/add/allowed_ip' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(ip_address) # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"BudgetSpendTrackingApi.add_allowed_ip_add_allowed_ip_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BudgetSpendTrackingApi#add_allowed_ip_add_allowed_ip_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#calculate_spend_spend_calculate_post(spend_calculate_request, opts = {}) ⇒ Object
Calculate Spend Accepts all the params of completion_cost. Calculate spend before making call: Note: If you see a spend of $0.0 you need to set custom_pricing for your model: docs.litellm.ai/docs/proxy/custom_pricing “‘ curl –location ’localhost:4000/spend/calculate’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data ‘{ "model": "anthropic.claude-v2", "messages": ["user", "content": "Hey, how”’s it going?"] }‘ “` Calculate spend after making call: “` curl –location ’localhost:4000/spend/calculate’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data ‘{ "completion_response": { "id": "chatcmpl-123", "object": "chat.completion", "created": 1677652288, "model": "gpt-3.5-turbo-0125", "system_fingerprint": "fp_44709d6fcb", "choices": [{ "index": 0, "message": { "role": "assistant", "content": "Hello there, how may I assist you today?" }, "logprobs": null, "finish_reason": "stop" }] "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 } } }’ “‘
93 94 95 96 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 93 def calculate_spend_spend_calculate_post(spend_calculate_request, opts = {}) data, _status_code, _headers = calculate_spend_spend_calculate_post_with_http_info(spend_calculate_request, opts) data end |
#calculate_spend_spend_calculate_post_with_http_info(spend_calculate_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Calculate Spend Accepts all the params of completion_cost. Calculate spend before making call: Note: If you see a spend of $0.0 you need to set custom_pricing for your model: docs.litellm.ai/docs/proxy/custom_pricing ``` curl –location 'localhost:4000/spend/calculate' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data '{ "model": "anthropic.claude-v2", "messages": ["user", "content": "Hey, how'''s it going?"] }' ``` Calculate spend after making call: ``` curl –location 'localhost:4000/spend/calculate' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data '{ "completion_response": { "id": "chatcmpl-123", "object": "chat.completion", "created": 1677652288, "model": "gpt-3.5-turbo-0125", "system_fingerprint": "fp_44709d6fcb", "choices": [{ "index": 0, "message": { "role": "assistant", "content": "Hello there, how may I assist you today?" }, "logprobs": null, "finish_reason": "stop" }] "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 } } }' ```
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 103 def calculate_spend_spend_calculate_post_with_http_info(spend_calculate_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BudgetSpendTrackingApi.calculate_spend_spend_calculate_post ...' end # verify the required parameter 'spend_calculate_request' is set if @api_client.config.client_side_validation && spend_calculate_request.nil? fail ArgumentError, "Missing the required parameter 'spend_calculate_request' when calling BudgetSpendTrackingApi.calculate_spend_spend_calculate_post" end # resource path local_var_path = '/spend/calculate' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(spend_calculate_request) # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"BudgetSpendTrackingApi.calculate_spend_spend_calculate_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BudgetSpendTrackingApi#calculate_spend_spend_calculate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_allowed_ip_delete_allowed_ip_post(ip_address, opts = {}) ⇒ Object
Delete Allowed Ip
160 161 162 163 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 160 def delete_allowed_ip_delete_allowed_ip_post(ip_address, opts = {}) data, _status_code, _headers = delete_allowed_ip_delete_allowed_ip_post_with_http_info(ip_address, opts) data end |
#delete_allowed_ip_delete_allowed_ip_post_with_http_info(ip_address, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Delete Allowed Ip
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 169 def delete_allowed_ip_delete_allowed_ip_post_with_http_info(ip_address, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BudgetSpendTrackingApi.delete_allowed_ip_delete_allowed_ip_post ...' end # verify the required parameter 'ip_address' is set if @api_client.config.client_side_validation && ip_address.nil? fail ArgumentError, "Missing the required parameter 'ip_address' when calling BudgetSpendTrackingApi.delete_allowed_ip_delete_allowed_ip_post" end # resource path local_var_path = '/delete/allowed_ip' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(ip_address) # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"BudgetSpendTrackingApi.delete_allowed_ip_delete_allowed_ip_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BudgetSpendTrackingApi#delete_allowed_ip_delete_allowed_ip_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_global_spend_report_global_spend_report_get(opts = {}) ⇒ Array<LiteLLMSpendLogs>
Get Global Spend Report Get Daily Spend per Team, based on specific startTime and endTime. Per team, view usage by each key, model [ { "group-by-day": "2024-05-10", "teams": [ { "team_name": "team-1" "spend": 10, "keys": [ "key": "1213", "usage": { "model-1": { "cost": 12.50, "input_tokens": 1000, "output_tokens": 5000, "requests": 100 }, "audio-modelname1": { "cost": 25.50, "seconds": 25, "requests": 50 }, } } ] ] }
233 234 235 236 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 233 def get_global_spend_report_global_spend_report_get(opts = {}) data, _status_code, _headers = get_global_spend_report_global_spend_report_get_with_http_info(opts) data end |
#get_global_spend_report_global_spend_report_get_with_http_info(opts = {}) ⇒ Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>
Get Global Spend Report Get Daily Spend per Team, based on specific startTime and endTime. Per team, view usage by each key, model [ { "group-by-day": "2024-05-10", "teams": [ { "team_name": "team-1" "spend": 10, "keys": [ "key": "1213", "usage": { "model-1": { "cost": 12.50, "input_tokens": 1000, "output_tokens": 5000, "requests": 100 }, "audio-modelname1": { "cost": 25.50, "seconds": 25, "requests": 50 }, } } ] ] }
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 249 def get_global_spend_report_global_spend_report_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BudgetSpendTrackingApi.get_global_spend_report_global_spend_report_get ...' end allowable_values = ["team", "customer", "api_key"] if @api_client.config.client_side_validation && opts[:'group_by'] && !allowable_values.include?(opts[:'group_by']) fail ArgumentError, "invalid value for \"group_by\", must be one of #{allowable_values}" end # resource path local_var_path = '/global/spend/report' # query parameters query_params = opts[:query_params] || {} query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'group_by'] = opts[:'group_by'] if !opts[:'group_by'].nil? query_params[:'api_key'] = opts[:'api_key'] if !opts[:'api_key'].nil? query_params[:'internal_user_id'] = opts[:'internal_user_id'] if !opts[:'internal_user_id'].nil? query_params[:'team_id'] = opts[:'team_id'] if !opts[:'team_id'].nil? query_params[:'customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array<LiteLLMSpendLogs>' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"BudgetSpendTrackingApi.get_global_spend_report_global_spend_report_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BudgetSpendTrackingApi#get_global_spend_report_global_spend_report_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_user_daily_activity_user_daily_activity_get(opts = {}) ⇒ SpendAnalyticsPaginatedResponse
Get User Daily Activity
- BETA
-
This is a beta endpoint. It will change. Meant to optimize querying spend data for analytics for a user. Returns: (by date) - spend - prompt_tokens - completion_tokens - cache_read_input_tokens - cache_creation_input_tokens - total_tokens - api_requests - breakdown by model, api_key, provider
314 315 316 317 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 314 def get_user_daily_activity_user_daily_activity_get(opts = {}) data, _status_code, _headers = get_user_daily_activity_user_daily_activity_get_with_http_info(opts) data end |
#get_user_daily_activity_user_daily_activity_get_with_http_info(opts = {}) ⇒ Array<(SpendAnalyticsPaginatedResponse, Integer, Hash)>
Get User Daily Activity
- BETA
-
This is a beta endpoint. It will change. Meant to optimize querying spend data for analytics for a user. Returns: (by date) - spend - prompt_tokens - completion_tokens - cache_read_input_tokens - cache_creation_input_tokens - total_tokens - api_requests - breakdown by model, api_key, provider
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 329 def get_user_daily_activity_user_daily_activity_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BudgetSpendTrackingApi.get_user_daily_activity_user_daily_activity_get ...' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling BudgetSpendTrackingApi.get_user_daily_activity_user_daily_activity_get, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling BudgetSpendTrackingApi.get_user_daily_activity_user_daily_activity_get, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling BudgetSpendTrackingApi.get_user_daily_activity_user_daily_activity_get, must be greater than or equal to 1.' end # resource path local_var_path = '/user/daily/activity' # query parameters query_params = opts[:query_params] || {} query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil? query_params[:'api_key'] = opts[:'api_key'] if !opts[:'api_key'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'SpendAnalyticsPaginatedResponse' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"BudgetSpendTrackingApi.get_user_daily_activity_user_daily_activity_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BudgetSpendTrackingApi#get_user_daily_activity_user_daily_activity_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#global_spend_reset_global_spend_reset_post(opts = {}) ⇒ Object
Global Spend Reset ADMIN ONLY / MASTER KEY Only Endpoint Globally reset spend for All API Keys and Teams, maintain LiteLLM_SpendLogs 1. LiteLLM_SpendLogs will maintain the logs on spend, no data gets deleted from there 2. LiteLLM_VerificationTokens spend will be set = 0 3. LiteLLM_TeamTable spend will be set = 0
395 396 397 398 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 395 def global_spend_reset_global_spend_reset_post(opts = {}) data, _status_code, _headers = global_spend_reset_global_spend_reset_post_with_http_info(opts) data end |
#global_spend_reset_global_spend_reset_post_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>
Global Spend Reset ADMIN ONLY / MASTER KEY Only Endpoint Globally reset spend for All API Keys and Teams, maintain LiteLLM_SpendLogs 1. LiteLLM_SpendLogs will maintain the logs on spend, no data gets deleted from there 2. LiteLLM_VerificationTokens spend will be set = 0 3. LiteLLM_TeamTable spend will be set = 0
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 404 def global_spend_reset_global_spend_reset_post_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BudgetSpendTrackingApi.global_spend_reset_global_spend_reset_post ...' end # resource path local_var_path = '/global/spend/reset' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"BudgetSpendTrackingApi.global_spend_reset_global_spend_reset_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BudgetSpendTrackingApi#global_spend_reset_global_spend_reset_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#global_view_spend_tags_global_spend_tags_get(opts = {}) ⇒ Array<LiteLLMSpendLogs>
Global View Spend Tags LiteLLM Enterprise - View Spend Per Request Tag. Used by LiteLLM UI Example Request: “‘ curl -X GET "0.0.0.0:4000/spend/tags" -H "Authorization: Bearer sk-1234" “` Spend with Start Date and End Date “` curl -X GET "0.0.0.0:4000/spend/tags?start_date=2022-01-01&end_date=2022-02-01" -H "Authorization: Bearer sk-1234" “`
455 456 457 458 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 455 def (opts = {}) data, _status_code, _headers = (opts) data end |
#global_view_spend_tags_global_spend_tags_get_with_http_info(opts = {}) ⇒ Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>
Global View Spend Tags LiteLLM Enterprise - View Spend Per Request Tag. Used by LiteLLM UI Example Request: ``` curl -X GET "0.0.0.0:4000/spend/tags" -H "Authorization: Bearer sk-1234" ``` Spend with Start Date and End Date ``` curl -X GET "0.0.0.0:4000/spend/tags?start_date=2022-01-01&end_date=2022-02-01" -H "Authorization: Bearer sk-1234" ```
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 467 def (opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BudgetSpendTrackingApi.global_view_spend_tags_global_spend_tags_get ...' end # resource path local_var_path = '/global/spend/tags' # query parameters query_params = opts[:query_params] || {} query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array<LiteLLMSpendLogs>' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"BudgetSpendTrackingApi.global_view_spend_tags_global_spend_tags_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BudgetSpendTrackingApi#global_view_spend_tags_global_spend_tags_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#view_spend_logs_spend_logs_get(opts = {}) ⇒ Array<LiteLLMSpendLogs>
View Spend Logs View all spend logs, if request_id is provided, only logs for that request_id will be returned Example Request for all logs “‘ curl -X GET "0.0.0.0:8000/spend/logs" -H "Authorization: Bearer sk-1234" “` Example Request for specific request_id “` curl -X GET "0.0.0.0:8000/spend/logs?request_id=chatcmpl-6dcb2540-d3d7-4e49-bb27-291f863f112e" -H "Authorization: Bearer sk-1234" “` Example Request for specific api_key “` curl -X GET "0.0.0.0:8000/spend/logs?api_key=sk-Fn8Ej39NkBQmUagFEoUWPQ" -H "Authorization: Bearer sk-1234" “` Example Request for specific user_id “` curl -X GET "0.0.0.0:8000/spend/[email protected]" -H "Authorization: Bearer sk-1234" “`
523 524 525 526 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 523 def view_spend_logs_spend_logs_get(opts = {}) data, _status_code, _headers = view_spend_logs_spend_logs_get_with_http_info(opts) data end |
#view_spend_logs_spend_logs_get_with_http_info(opts = {}) ⇒ Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>
View Spend Logs View all spend logs, if request_id is provided, only logs for that request_id will be returned Example Request for all logs ``` curl -X GET "0.0.0.0:8000/spend/logs" -H "Authorization: Bearer sk-1234" ``` Example Request for specific request_id ``` curl -X GET "0.0.0.0:8000/spend/logs?request_id=chatcmpl-6dcb2540-d3d7-4e49-bb27-291f863f112e" -H "Authorization: Bearer sk-1234" ``` Example Request for specific api_key ``` curl -X GET "0.0.0.0:8000/spend/logs?api_key=sk-Fn8Ej39NkBQmUagFEoUWPQ" -H "Authorization: Bearer sk-1234" ``` Example Request for specific user_id ``` curl -X GET "0.0.0.0:8000/spend/logs?user_id=[email protected]" -H "Authorization: Bearer sk-1234" ```
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 537 def view_spend_logs_spend_logs_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BudgetSpendTrackingApi.view_spend_logs_spend_logs_get ...' end # resource path local_var_path = '/spend/logs' # query parameters query_params = opts[:query_params] || {} query_params[:'api_key'] = opts[:'api_key'] if !opts[:'api_key'].nil? query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil? query_params[:'request_id'] = opts[:'request_id'] if !opts[:'request_id'].nil? query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array<LiteLLMSpendLogs>' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"BudgetSpendTrackingApi.view_spend_logs_spend_logs_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BudgetSpendTrackingApi#view_spend_logs_spend_logs_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#view_spend_tags_spend_tags_get(opts = {}) ⇒ Array<LiteLLMSpendLogs>
View Spend Tags LiteLLM Enterprise - View Spend Per Request Tag Example Request: “‘ curl -X GET "0.0.0.0:8000/spend/tags" -H "Authorization: Bearer sk-1234" “` Spend with Start Date and End Date “` curl -X GET "0.0.0.0:8000/spend/tags?start_date=2022-01-01&end_date=2022-02-01" -H "Authorization: Bearer sk-1234" “`
592 593 594 595 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 592 def (opts = {}) data, _status_code, _headers = (opts) data end |
#view_spend_tags_spend_tags_get_with_http_info(opts = {}) ⇒ Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>
View Spend Tags LiteLLM Enterprise - View Spend Per Request Tag Example Request: ``` curl -X GET "0.0.0.0:8000/spend/tags" -H "Authorization: Bearer sk-1234" ``` Spend with Start Date and End Date ``` curl -X GET "0.0.0.0:8000/spend/tags?start_date=2022-01-01&end_date=2022-02-01" -H "Authorization: Bearer sk-1234" ```
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 603 def (opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BudgetSpendTrackingApi.view_spend_tags_spend_tags_get ...' end # resource path local_var_path = '/spend/tags' # query parameters query_params = opts[:query_params] || {} query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array<LiteLLMSpendLogs>' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"BudgetSpendTrackingApi.view_spend_tags_spend_tags_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BudgetSpendTrackingApi#view_spend_tags_spend_tags_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |