Class: LiteLLMClient::BudgetSpendTrackingApi

Inherits:
Object
  • Object
show all
Defined in:
lib/litellm_client/api/budget_spend_tracking_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_clientObject

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

Parameters:

  • ip_address (IPAddress)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


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

Parameters:

  • ip_address (IPAddress)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



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']

  new_options = 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, new_options)
  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 } } }’ “‘

Parameters:

  • spend_calculate_request (SpendCalculateRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


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 &#x60;&#x60;&#x60; curl –location &#39;localhost:4000/spend/calculate&#39; –header &#39;Authorization: Bearer sk-1234&#39; –header &#39;Content-Type: application/json&#39; –data &#39;{ &quot;model&quot;: &quot;anthropic.claude-v2&quot;, &quot;messages&quot;: [&quot;user&quot;, &quot;content&quot;: &quot;Hey, how&#39;&#39;&#39;s it going?&quot;] }&#39; &#x60;&#x60;&#x60; Calculate spend after making call: &#x60;&#x60;&#x60; curl –location &#39;localhost:4000/spend/calculate&#39; –header &#39;Authorization: Bearer sk-1234&#39; –header &#39;Content-Type: application/json&#39; –data &#39;{ &quot;completion_response&quot;: { &quot;id&quot;: &quot;chatcmpl-123&quot;, &quot;object&quot;: &quot;chat.completion&quot;, &quot;created&quot;: 1677652288, &quot;model&quot;: &quot;gpt-3.5-turbo-0125&quot;, &quot;system_fingerprint&quot;: &quot;fp_44709d6fcb&quot;, &quot;choices&quot;: [{ &quot;index&quot;: 0, &quot;message&quot;: { &quot;role&quot;: &quot;assistant&quot;, &quot;content&quot;: &quot;Hello there, how may I assist you today?&quot; }, &quot;logprobs&quot;: null, &quot;finish_reason&quot;: &quot;stop&quot; }] &quot;usage&quot;: { &quot;prompt_tokens&quot;: 9, &quot;completion_tokens&quot;: 12, &quot;total_tokens&quot;: 21 } } }&#39; &#x60;&#x60;&#x60;

Parameters:

  • spend_calculate_request (SpendCalculateRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



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']

  new_options = 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, new_options)
  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

Parameters:

  • ip_address (IPAddress)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


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

Parameters:

  • ip_address (IPAddress)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



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']

  new_options = 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, new_options)
  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 }, } } ] ] }

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Time from which to start viewing spend

  • :end_date (String)

    Time till which to view spend

  • :group_by (String)

    Group spend by internal team or customer or api_key

  • :api_key (String)

    View spend for a specific api_key. Example api_key&#x3D;&#39;sk-1234

  • :internal_user_id (String)

    View spend for a specific internal_user_id. Example internal_user_id&#x3D;&#39;1234

  • :team_id (String)

    View spend for a specific team_id. Example team_id&#x3D;&#39;1234

  • :customer_id (String)

    View spend for a specific customer_id. Example customer_id&#x3D;&#39;1234. Can be used in conjunction with team_id as well.

Returns:



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 [ { &quot;group-by-day&quot;: &quot;2024-05-10&quot;, &quot;teams&quot;: [ { &quot;team_name&quot;: &quot;team-1&quot; &quot;spend&quot;: 10, &quot;keys&quot;: [ &quot;key&quot;: &quot;1213&quot;, &quot;usage&quot;: { &quot;model-1&quot;: { &quot;cost&quot;: 12.50, &quot;input_tokens&quot;: 1000, &quot;output_tokens&quot;: 5000, &quot;requests&quot;: 100 }, &quot;audio-modelname1&quot;: { &quot;cost&quot;: 25.50, &quot;seconds&quot;: 25, &quot;requests&quot;: 50 }, } } ] ] }

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Time from which to start viewing spend

  • :end_date (String)

    Time till which to view spend

  • :group_by (String)

    Group spend by internal team or customer or api_key

  • :api_key (String)

    View spend for a specific api_key. Example api_key&#x3D;&#39;sk-1234

  • :internal_user_id (String)

    View spend for a specific internal_user_id. Example internal_user_id&#x3D;&#39;1234

  • :team_id (String)

    View spend for a specific team_id. Example team_id&#x3D;&#39;1234

  • :customer_id (String)

    View spend for a specific customer_id. Example customer_id&#x3D;&#39;1234. Can be used in conjunction with team_id as well.

Returns:

  • (Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>)

    Array<LiteLLMSpendLogs> data, response status code and response headers



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']

  new_options = 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, new_options)
  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

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Start date in YYYY-MM-DD format

  • :end_date (String)

    End date in YYYY-MM-DD format

  • :model (String)

    Filter by specific model

  • :api_key (String)

    Filter by specific API key

  • :page (Integer)

    Page number for pagination (default to 1)

  • :page_size (Integer)

    Items per page (default to 50)

Returns:



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

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Start date in YYYY-MM-DD format

  • :end_date (String)

    End date in YYYY-MM-DD format

  • :model (String)

    Filter by specific model

  • :api_key (String)

    Filter by specific API key

  • :page (Integer)

    Page number for pagination (default to 1)

  • :page_size (Integer)

    Items per page (default to 50)

Returns:



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']

  new_options = 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, new_options)
  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

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


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 &#x3D; 0 3. LiteLLM_TeamTable spend will be set &#x3D; 0

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



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']

  new_options = 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, new_options)
  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" “`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Time from which to start viewing key spend

  • :end_date (String)

    Time till which to view key spend

  • :tags (String)

    comman separated tags to filter on

Returns:



455
456
457
458
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 455

def global_view_spend_tags_global_spend_tags_get(opts = {})
  data, _status_code, _headers = global_view_spend_tags_global_spend_tags_get_with_http_info(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: &#x60;&#x60;&#x60; curl -X GET &quot;0.0.0.0:4000/spend/tags&quot; -H &quot;Authorization: Bearer sk-1234&quot; &#x60;&#x60;&#x60; Spend with Start Date and End Date &#x60;&#x60;&#x60; curl -X GET &quot;0.0.0.0:4000/spend/tags?start_date&#x3D;2022-01-01&amp;end_date&#x3D;2022-02-01&quot; -H &quot;Authorization: Bearer sk-1234&quot; &#x60;&#x60;&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Time from which to start viewing key spend

  • :end_date (String)

    Time till which to view key spend

  • :tags (String)

    comman separated tags to filter on

Returns:

  • (Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>)

    Array<LiteLLMSpendLogs> data, response status code and response headers



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 global_view_spend_tags_global_spend_tags_get_with_http_info(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']

  new_options = 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, new_options)
  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" “`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :api_key (String)

    Get spend logs based on api key

  • :user_id (String)

    Get spend logs based on user_id

  • :request_id (String)

    request_id to get spend logs for specific request_id. If none passed then pass spend logs for all requests

  • :start_date (String)

    Time from which to start viewing key spend

  • :end_date (String)

    Time till which to view key spend

Returns:



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 &#x60;&#x60;&#x60; curl -X GET &quot;0.0.0.0:8000/spend/logs&quot; -H &quot;Authorization: Bearer sk-1234&quot; &#x60;&#x60;&#x60; Example Request for specific request_id &#x60;&#x60;&#x60; curl -X GET &quot;0.0.0.0:8000/spend/logs?request_id&#x3D;chatcmpl-6dcb2540-d3d7-4e49-bb27-291f863f112e&quot; -H &quot;Authorization: Bearer sk-1234&quot; &#x60;&#x60;&#x60; Example Request for specific api_key &#x60;&#x60;&#x60; curl -X GET &quot;0.0.0.0:8000/spend/logs?api_key&#x3D;sk-Fn8Ej39NkBQmUagFEoUWPQ&quot; -H &quot;Authorization: Bearer sk-1234&quot; &#x60;&#x60;&#x60; Example Request for specific user_id &#x60;&#x60;&#x60; curl -X GET &quot;0.0.0.0:8000/spend/logs?user_id&#x3D;[email protected]&quot; -H &quot;Authorization: Bearer sk-1234&quot; &#x60;&#x60;&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :api_key (String)

    Get spend logs based on api key

  • :user_id (String)

    Get spend logs based on user_id

  • :request_id (String)

    request_id to get spend logs for specific request_id. If none passed then pass spend logs for all requests

  • :start_date (String)

    Time from which to start viewing key spend

  • :end_date (String)

    Time till which to view key spend

Returns:

  • (Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>)

    Array<LiteLLMSpendLogs> data, response status code and response headers



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']

  new_options = 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, new_options)
  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" “`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Time from which to start viewing key spend

  • :end_date (String)

    Time till which to view key spend

Returns:



592
593
594
595
# File 'lib/litellm_client/api/budget_spend_tracking_api.rb', line 592

def view_spend_tags_spend_tags_get(opts = {})
  data, _status_code, _headers = view_spend_tags_spend_tags_get_with_http_info(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: &#x60;&#x60;&#x60; curl -X GET &quot;0.0.0.0:8000/spend/tags&quot; -H &quot;Authorization: Bearer sk-1234&quot; &#x60;&#x60;&#x60; Spend with Start Date and End Date &#x60;&#x60;&#x60; curl -X GET &quot;0.0.0.0:8000/spend/tags?start_date&#x3D;2022-01-01&amp;end_date&#x3D;2022-02-01&quot; -H &quot;Authorization: Bearer sk-1234&quot; &#x60;&#x60;&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Time from which to start viewing key spend

  • :end_date (String)

    Time till which to view key spend

Returns:

  • (Array<(Array<LiteLLMSpendLogs>, Integer, Hash)>)

    Array<LiteLLMSpendLogs> data, response status code and response headers



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 view_spend_tags_spend_tags_get_with_http_info(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']

  new_options = 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, new_options)
  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