Class: LiteLLMClient::InternalUserManagementApi
- Inherits:
-
Object
- Object
- LiteLLMClient::InternalUserManagementApi
- Defined in:
- lib/litellm_client/api/internal_user_management_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#delete_user_user_delete_post(delete_user_request, opts = {}) ⇒ Object
Delete User delete user and associated user keys “‘ curl –location ’0.0.0.0:4000/user/delete’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data-raw ‘{ "user_ids": ["45e3e396-ee08-4a61-a88e-16b3ce7e0849"] }’ “‘ Parameters: - user_ids: List - The list of user id’s to be deleted.
-
#delete_user_user_delete_post_with_http_info(delete_user_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Delete User delete user and associated user keys ``` curl –location '0.0.0.0:4000/user/delete' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data-raw '{ "user_ids": ["45e3e396-ee08-4a61-a88e-16b3ce7e0849"] }' ``` Parameters: - user_ids: List - The list of user id's to be deleted.
-
#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.
-
#get_users_user_list_get(opts = {}) ⇒ UserListResponse
Get Users Get a paginated list of users with filtering and sorting options.
-
#get_users_user_list_get_with_http_info(opts = {}) ⇒ Array<(UserListResponse, Integer, Hash)>
Get Users Get a paginated list of users with filtering and sorting options.
-
#initialize(api_client = ApiClient.default) ⇒ InternalUserManagementApi
constructor
A new instance of InternalUserManagementApi.
-
#new_user_user_new_post(new_user_request, opts = {}) ⇒ NewUserResponse
New User Use this to create a new INTERNAL user with a budget.
-
#new_user_user_new_post_with_http_info(new_user_request, opts = {}) ⇒ Array<(NewUserResponse, Integer, Hash)>
New User Use this to create a new INTERNAL user with a budget.
-
#user_info_user_info_get(opts = {}) ⇒ Object
User Info [10/07/2024] Note: To get all users (+pagination), use ‘/user/list` endpoint.
-
#user_info_user_info_get_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>
User Info [10/07/2024] Note: To get all users (+pagination), use `/user/list` endpoint.
-
#user_update_user_update_post(update_user_request, opts = {}) ⇒ Object
User Update Example curl “‘ curl –location ’0.0.0.0:4000/user/update’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data ‘{ "user_id": "test-litellm-user-4", "user_role": "proxy_admin_viewer" }’ “‘ Parameters: - user_id: Optional - Specify a user id.
-
#user_update_user_update_post_with_http_info(update_user_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
User Update Example curl ``` curl –location '0.0.0.0:4000/user/update' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data '{ "user_id": "test-litellm-user-4", "user_role": "proxy_admin_viewer" }' ``` Parameters: - user_id: Optional - Specify a user id.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ InternalUserManagementApi
Returns a new instance of InternalUserManagementApi.
19 20 21 |
# File 'lib/litellm_client/api/internal_user_management_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/internal_user_management_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#delete_user_user_delete_post(delete_user_request, opts = {}) ⇒ Object
Delete User delete user and associated user keys “‘ curl –location ’0.0.0.0:4000/user/delete’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data-raw ‘{ "user_ids": ["45e3e396-ee08-4a61-a88e-16b3ce7e0849"] }’ “‘ Parameters: - user_ids: List - The list of user id’s to be deleted.
28 29 30 31 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 28 def delete_user_user_delete_post(delete_user_request, opts = {}) data, _status_code, _headers = delete_user_user_delete_post_with_http_info(delete_user_request, opts) data end |
#delete_user_user_delete_post_with_http_info(delete_user_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Delete User delete user and associated user keys ``` curl –location '0.0.0.0:4000/user/delete' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data-raw '{ "user_ids": ["45e3e396-ee08-4a61-a88e-16b3ce7e0849"] }' ``` Parameters: - user_ids: List - The list of user id's to be deleted.
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 87 88 89 90 91 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 39 def delete_user_user_delete_post_with_http_info(delete_user_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InternalUserManagementApi.delete_user_user_delete_post ...' end # verify the required parameter 'delete_user_request' is set if @api_client.config.client_side_validation && delete_user_request.nil? fail ArgumentError, "Missing the required parameter 'delete_user_request' when calling InternalUserManagementApi.delete_user_user_delete_post" end # resource path local_var_path = '/user/delete' # 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 header_params[:'litellm-changed-by'] = opts[:'litellm_changed_by'] if !opts[:'litellm_changed_by'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(delete_user_request) # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"InternalUserManagementApi.delete_user_user_delete_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: InternalUserManagementApi#delete_user_user_delete_post\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
103 104 105 106 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 103 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
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 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 118 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: InternalUserManagementApi.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 InternalUserManagementApi.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 InternalUserManagementApi.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 InternalUserManagementApi.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 => :"InternalUserManagementApi.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: InternalUserManagementApi#get_user_daily_activity_user_daily_activity_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_users_user_list_get(opts = {}) ⇒ UserListResponse
Get Users Get a paginated list of users with filtering and sorting options. Parameters: role: Optional Filter users by role. Can be one of: - proxy_admin - proxy_admin_viewer - internal_user - internal_user_viewer user_ids: Optional Get list of users by user_ids. Comma separated list of user_ids. sso_ids: Optional Get list of users by sso_ids. Comma separated list of sso_ids. user_email: Optional Filter users by partial email match team: Optional Filter users by team id. Will match if user has this team in their teams array. page: int The page number to return page_size: int The number of items per page sort_by: Optional Column to sort by (e.g. ‘user_id’, ‘user_email’, ‘created_at’, ‘spend’) sort_order: Optional Sort order (‘asc’ or ‘desc’)
193 194 195 196 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 193 def get_users_user_list_get(opts = {}) data, _status_code, _headers = get_users_user_list_get_with_http_info(opts) data end |
#get_users_user_list_get_with_http_info(opts = {}) ⇒ Array<(UserListResponse, Integer, Hash)>
Get Users Get a paginated list of users with filtering and sorting options. Parameters: role: Optional Filter users by role. Can be one of: - proxy_admin - proxy_admin_viewer - internal_user - internal_user_viewer user_ids: Optional Get list of users by user_ids. Comma separated list of user_ids. sso_ids: Optional Get list of users by sso_ids. Comma separated list of sso_ids. user_email: Optional Filter users by partial email match team: Optional Filter users by team id. Will match if user has this team in their teams array. page: int The page number to return page_size: int The number of items per page sort_by: Optional Column to sort by (e.g. 'user_id', 'user_email', 'created_at', 'spend') sort_order: Optional Sort order ('asc' or 'desc')
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 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 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 211 def get_users_user_list_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InternalUserManagementApi.get_users_user_list_get ...' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling InternalUserManagementApi.get_users_user_list_get, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling InternalUserManagementApi.get_users_user_list_get, must be smaller than or equal to 100.' 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 InternalUserManagementApi.get_users_user_list_get, must be greater than or equal to 1.' end # resource path local_var_path = '/user/list' # query parameters query_params = opts[:query_params] || {} query_params[:'role'] = opts[:'role'] if !opts[:'role'].nil? query_params[:'user_ids'] = opts[:'user_ids'] if !opts[:'user_ids'].nil? query_params[:'sso_user_ids'] = opts[:'sso_user_ids'] if !opts[:'sso_user_ids'].nil? query_params[:'user_email'] = opts[:'user_email'] if !opts[:'user_email'].nil? query_params[:'team'] = opts[:'team'] if !opts[:'team'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].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] || 'UserListResponse' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"InternalUserManagementApi.get_users_user_list_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: InternalUserManagementApi#get_users_user_list_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#new_user_user_new_post(new_user_request, opts = {}) ⇒ NewUserResponse
New User Use this to create a new INTERNAL user with a budget. Internal Users can access LiteLLM Admin UI to make keys, request access to models. This creates a new user and generates a new api key for the new user. The new api key is returned. Returns user id, budget + new key. Parameters: - user_id: Optional - Specify a user id. If not set, a unique id will be generated. - user_alias: Optional - A descriptive name for you to know who this user id refers to. - teams: Optional - specify a list of team id’s a user belongs to. - user_email: Optional - Specify a user email. - send_invite_email: Optional - Specify if an invite email should be sent. - user_role: Optional - Specify a user role - "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer", "team", "customer". Info about each role here: ‘github.com/BerriAI/litellm/litellm/proxy/_types.py#L20` - max_budget: Optional - Specify max budget for a given user. - budget_duration: Optional - Budget is reset at the end of specified duration. If not set, budget is never reset. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo"). - models: Optional - Model_name’s a user is allowed to call. (if empty, key is allowed to call all models). Set to [‘no-default-models’] to block all model access. Restricting user to only team-based model access. - tpm_limit: Optional - Specify tpm limit for a given user (Tokens per minute) - rpm_limit: Optional - Specify rpm limit for a given user (Requests per minute) - auto_create_key: bool - Default=True. Flag used for returning a key as part of the /user/new response - aliases: Optional - Model aliases for the user - [Docs](litellm.vercel.app/docs/proxy/virtual_keys#model-aliases) - config: Optional - [DEPRECATED PARAM] User-specific config. - allowed_cache_controls: Optional - List of allowed cache control values. Example - ["no-cache", "no-store"]. See all values - docs.litellm.ai/docs/proxy/caching#turn-on–off-caching-per-request- - blocked: Optional - [Not Implemented Yet] Whether the user is blocked. - guardrails: Optional[List] - [Not Implemented Yet] List of active guardrails for the user - permissions: Optional - [Not Implemented Yet] User-specific permissions, eg. turning off pii masking. - metadata: Optional - Metadata for user, store information for user. Example metadata = {"team": "core-infra", "app": "app2", "email": "[email protected]" } - max_parallel_requests: Optional - Rate limit a user based on the number of parallel requests. Raises 429 error, if user’s parallel requests > x. - soft_budget: Optional - Get alerts when user crosses given budget, doesn’t block requests. - model_max_budget: Optional - Model-specific max budget for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-budgets-to-keys) - model_rpm_limit: Optional - Model-specific rpm limit for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-limits-to-keys) - model_tpm_limit: Optional - Model-specific tpm limit for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-limits-to-keys) - spend: Optional - Amount spent by user. Default is 0. Will be updated by proxy whenever user is used. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo"). - team_id: Optional - [DEPRECATED PARAM] The team id of the user. Default is None. - duration: Optional - Duration for the key auto-created on ‘/user/new`. Default is None. - key_alias: Optional - Alias for the key auto-created on `/user/new`. Default is None. - sso_user_id: Optional - The id of the user in the SSO provider. - object_permission: Optional - internal user-specific object permission. Example - ["vector_store_1", "vector_store_2"]. IF null or {} then no object permission. - organizations: List - List of organization id’s the user is a member of Returns: - key: (str) The generated api key for the user - expires: (datetime) Datetime object for when key expires. - user_id: (str) Unique user id - used for tracking spend across multiple keys for same user id. - max_budget: (float|None) Max budget for given user. Usage Example “‘shell curl -X POST "localhost:4000/user/new" -H "Content-Type: application/json" -H "Authorization: Bearer sk-1234" -d ’{ "username": "new_user", "email": "[email protected]" }‘ “`
281 282 283 284 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 281 def new_user_user_new_post(new_user_request, opts = {}) data, _status_code, _headers = new_user_user_new_post_with_http_info(new_user_request, opts) data end |
#new_user_user_new_post_with_http_info(new_user_request, opts = {}) ⇒ Array<(NewUserResponse, Integer, Hash)>
New User Use this to create a new INTERNAL user with a budget. Internal Users can access LiteLLM Admin UI to make keys, request access to models. This creates a new user and generates a new api key for the new user. The new api key is returned. Returns user id, budget + new key. Parameters: - user_id: Optional - Specify a user id. If not set, a unique id will be generated. - user_alias: Optional - A descriptive name for you to know who this user id refers to. - teams: Optional - specify a list of team id's a user belongs to. - user_email: Optional - Specify a user email. - send_invite_email: Optional - Specify if an invite email should be sent. - user_role: Optional - Specify a user role - "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer", "team", "customer". Info about each role here: `github.com/BerriAI/litellm/litellm/proxy/_types.py#L20` - max_budget: Optional - Specify max budget for a given user. - budget_duration: Optional - Budget is reset at the end of specified duration. If not set, budget is never reset. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo"). - models: Optional - Model_name's a user is allowed to call. (if empty, key is allowed to call all models). Set to ['no-default-models'] to block all model access. Restricting user to only team-based model access. - tpm_limit: Optional - Specify tpm limit for a given user (Tokens per minute) - rpm_limit: Optional - Specify rpm limit for a given user (Requests per minute) - auto_create_key: bool - Default=True. Flag used for returning a key as part of the /user/new response - aliases: Optional - Model aliases for the user - [Docs](litellm.vercel.app/docs/proxy/virtual_keys#model-aliases) - config: Optional - [DEPRECATED PARAM] User-specific config. - allowed_cache_controls: Optional - List of allowed cache control values. Example - ["no-cache", "no-store"]. See all values - docs.litellm.ai/docs/proxy/caching#turn-on–off-caching-per-request- - blocked: Optional - [Not Implemented Yet] Whether the user is blocked. - guardrails: Optional[List] - [Not Implemented Yet] List of active guardrails for the user - permissions: Optional - [Not Implemented Yet] User-specific permissions, eg. turning off pii masking. - metadata: Optional - Metadata for user, store information for user. Example metadata = {"team": "core-infra", "app": "app2", "email": "[email protected]" } - max_parallel_requests: Optional - Rate limit a user based on the number of parallel requests. Raises 429 error, if user's parallel requests > x. - soft_budget: Optional - Get alerts when user crosses given budget, doesn't block requests. - model_max_budget: Optional - Model-specific max budget for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-budgets-to-keys) - model_rpm_limit: Optional - Model-specific rpm limit for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-limits-to-keys) - model_tpm_limit: Optional - Model-specific tpm limit for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-limits-to-keys) - spend: Optional - Amount spent by user. Default is 0. Will be updated by proxy whenever user is used. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo"). - team_id: Optional - [DEPRECATED PARAM] The team id of the user. Default is None. - duration: Optional - Duration for the key auto-created on `/user/new`. Default is None. - key_alias: Optional - Alias for the key auto-created on `/user/new`. Default is None. - sso_user_id: Optional - The id of the user in the SSO provider. - object_permission: Optional - internal user-specific object permission. Example - ["vector_store_1", "vector_store_2"]. IF null or {} then no object permission. - organizations: List - List of organization id's the user is a member of Returns: - key: (str) The generated api key for the user - expires: (datetime) Datetime object for when key expires. - user_id: (str) Unique user id - used for tracking spend across multiple keys for same user id. - max_budget: (float|None) Max budget for given user. Usage Example ```shell curl -X POST "localhost:4000/user/new" -H "Content-Type: application/json" -H "Authorization: Bearer sk-1234" -d '{ "username": "new_user", "email": "[email protected]" }' ```
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 291 def new_user_user_new_post_with_http_info(new_user_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InternalUserManagementApi.new_user_user_new_post ...' end # verify the required parameter 'new_user_request' is set if @api_client.config.client_side_validation && new_user_request.nil? fail ArgumentError, "Missing the required parameter 'new_user_request' when calling InternalUserManagementApi.new_user_user_new_post" end # resource path local_var_path = '/user/new' # 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(new_user_request) # return_type return_type = opts[:debug_return_type] || 'NewUserResponse' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"InternalUserManagementApi.new_user_user_new_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: InternalUserManagementApi#new_user_user_new_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#user_info_user_info_get(opts = {}) ⇒ Object
User Info
- 10/07/2024
-
Note: To get all users (+pagination), use ‘/user/list` endpoint. Use this to get user information. (user row + all user key info) Example request “` curl -X GET ’localhost:4000/user/info?user_id=krrish7%40berri.ai’ –header ‘Authorization: Bearer sk-1234’ “‘
349 350 351 352 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 349 def user_info_user_info_get(opts = {}) data, _status_code, _headers = user_info_user_info_get_with_http_info(opts) data end |
#user_info_user_info_get_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>
User Info
- 10/07/2024
-
Note: To get all users (+pagination), use `/user/list` endpoint. Use this to get user information. (user row + all user key info) Example request ``` curl -X GET 'localhost:4000/user/info?user_id=krrish7%40berri.ai' –header 'Authorization: Bearer sk-1234' ```
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 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 359 def user_info_user_info_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InternalUserManagementApi.user_info_user_info_get ...' end # resource path local_var_path = '/user/info' # query parameters query_params = opts[:query_params] || {} query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_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] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"InternalUserManagementApi.user_info_user_info_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: InternalUserManagementApi#user_info_user_info_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#user_update_user_update_post(update_user_request, opts = {}) ⇒ Object
User Update Example curl “‘ curl –location ’0.0.0.0:4000/user/update’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data ‘{ "user_id": "test-litellm-user-4", "user_role": "proxy_admin_viewer" }’ “‘ Parameters: - user_id: Optional - Specify a user id. If not set, a unique id will be generated. - user_email: Optional - Specify a user email. - password: Optional - Specify a user password. - user_alias: Optional - A descriptive name for you to know who this user id refers to. - teams: Optional - specify a list of team id’s a user belongs to. - send_invite_email: Optional - Specify if an invite email should be sent. - user_role: Optional - Specify a user role - "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer", "team", "customer". Info about each role here: ‘github.com/BerriAI/litellm/litellm/proxy/_types.py#L20` - max_budget: Optional - Specify max budget for a given user. - budget_duration: Optional - Budget is reset at the end of specified duration. If not set, budget is never reset. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo"). - models: Optional - Model_name’s a user is allowed to call. (if empty, key is allowed to call all models) - tpm_limit: Optional - Specify tpm limit for a given user (Tokens per minute) - rpm_limit: Optional - Specify rpm limit for a given user (Requests per minute) - auto_create_key: bool - Default=True. Flag used for returning a key as part of the /user/new response - aliases: Optional - Model aliases for the user - [Docs](litellm.vercel.app/docs/proxy/virtual_keys#model-aliases) - config: Optional - [DEPRECATED PARAM] User-specific config. - allowed_cache_controls: Optional - List of allowed cache control values. Example - ["no-cache", "no-store"]. See all values - docs.litellm.ai/docs/proxy/caching#turn-on–off-caching-per-request- - blocked: Optional - [Not Implemented Yet] Whether the user is blocked. - guardrails: Optional[List] - [Not Implemented Yet] List of active guardrails for the user - permissions: Optional - [Not Implemented Yet] User-specific permissions, eg. turning off pii masking. - metadata: Optional - Metadata for user, store information for user. Example metadata = {"team": "core-infra", "app": "app2", "email": "[email protected]" } - max_parallel_requests: Optional - Rate limit a user based on the number of parallel requests. Raises 429 error, if user’s parallel requests > x. - soft_budget: Optional - Get alerts when user crosses given budget, doesn’t block requests. - model_max_budget: Optional - Model-specific max budget for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-budgets-to-keys) - model_rpm_limit: Optional - Model-specific rpm limit for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-limits-to-keys) - model_tpm_limit: Optional - Model-specific tpm limit for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-limits-to-keys) - spend: Optional - Amount spent by user. Default is 0. Will be updated by proxy whenever user is used. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo"). - team_id: Optional - [DEPRECATED PARAM] The team id of the user. Default is None. - duration: Optional - [NOT IMPLEMENTED]. - key_alias: Optional - [NOT IMPLEMENTED]. - object_permission: Optional - internal user-specific object permission. Example - ["vector_store_1", "vector_store_2"]. IF null or {} then no object permission.
409 410 411 412 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 409 def user_update_user_update_post(update_user_request, opts = {}) data, _status_code, _headers = user_update_user_update_post_with_http_info(update_user_request, opts) data end |
#user_update_user_update_post_with_http_info(update_user_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
User Update Example curl ``` curl –location '0.0.0.0:4000/user/update' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data '{ "user_id": "test-litellm-user-4", "user_role": "proxy_admin_viewer" }' ``` Parameters: - user_id: Optional - Specify a user id. If not set, a unique id will be generated. - user_email: Optional - Specify a user email. - password: Optional - Specify a user password. - user_alias: Optional - A descriptive name for you to know who this user id refers to. - teams: Optional - specify a list of team id's a user belongs to. - send_invite_email: Optional - Specify if an invite email should be sent. - user_role: Optional - Specify a user role - "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer", "team", "customer". Info about each role here: `github.com/BerriAI/litellm/litellm/proxy/_types.py#L20` - max_budget: Optional - Specify max budget for a given user. - budget_duration: Optional - Budget is reset at the end of specified duration. If not set, budget is never reset. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo"). - models: Optional - Model_name's a user is allowed to call. (if empty, key is allowed to call all models) - tpm_limit: Optional - Specify tpm limit for a given user (Tokens per minute) - rpm_limit: Optional - Specify rpm limit for a given user (Requests per minute) - auto_create_key: bool - Default=True. Flag used for returning a key as part of the /user/new response - aliases: Optional - Model aliases for the user - [Docs](litellm.vercel.app/docs/proxy/virtual_keys#model-aliases) - config: Optional - [DEPRECATED PARAM] User-specific config. - allowed_cache_controls: Optional - List of allowed cache control values. Example - ["no-cache", "no-store"]. See all values - docs.litellm.ai/docs/proxy/caching#turn-on–off-caching-per-request- - blocked: Optional - [Not Implemented Yet] Whether the user is blocked. - guardrails: Optional[List] - [Not Implemented Yet] List of active guardrails for the user - permissions: Optional - [Not Implemented Yet] User-specific permissions, eg. turning off pii masking. - metadata: Optional - Metadata for user, store information for user. Example metadata = {"team": "core-infra", "app": "app2", "email": "[email protected]" } - max_parallel_requests: Optional - Rate limit a user based on the number of parallel requests. Raises 429 error, if user's parallel requests > x. - soft_budget: Optional - Get alerts when user crosses given budget, doesn't block requests. - model_max_budget: Optional - Model-specific max budget for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-budgets-to-keys) - model_rpm_limit: Optional - Model-specific rpm limit for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-limits-to-keys) - model_tpm_limit: Optional - Model-specific tpm limit for user. [Docs](docs.litellm.ai/docs/proxy/users#add-model-specific-limits-to-keys) - spend: Optional - Amount spent by user. Default is 0. Will be updated by proxy whenever user is used. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo"). - team_id: Optional - [DEPRECATED PARAM] The team id of the user. Default is None. - duration: Optional - [NOT IMPLEMENTED]. - key_alias: Optional - [NOT IMPLEMENTED]. - object_permission: Optional - internal user-specific object permission. Example - ["vector_store_1", "vector_store_2"]. IF null or {} then no object permission.
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 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 |
# File 'lib/litellm_client/api/internal_user_management_api.rb', line 419 def user_update_user_update_post_with_http_info(update_user_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InternalUserManagementApi.user_update_user_update_post ...' end # verify the required parameter 'update_user_request' is set if @api_client.config.client_side_validation && update_user_request.nil? fail ArgumentError, "Missing the required parameter 'update_user_request' when calling InternalUserManagementApi.user_update_user_update_post" end # resource path local_var_path = '/user/update' # 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(update_user_request) # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"InternalUserManagementApi.user_update_user_update_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: InternalUserManagementApi#user_update_user_update_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |