Class: LiteLLMClient::KeyManagementApi
- Inherits:
-
Object
- Object
- LiteLLMClient::KeyManagementApi
- Defined in:
- lib/litellm_client/api/key_management_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#block_key_key_block_post(block_key_request, opts = {}) ⇒ LiteLLMVerificationToken
Block Key Block an Virtual key from making any requests.
-
#block_key_key_block_post_with_http_info(block_key_request, opts = {}) ⇒ Array<(LiteLLMVerificationToken, Integer, Hash)>
Block Key Block an Virtual key from making any requests.
-
#delete_key_fn_key_delete_post(key_request, opts = {}) ⇒ Object
Delete Key Fn Delete a key from the key management system.
-
#delete_key_fn_key_delete_post_with_http_info(key_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Delete Key Fn Delete a key from the key management system.
-
#generate_key_fn_key_generate_post(generate_key_request, opts = {}) ⇒ GenerateKeyResponse
Generate Key Fn Generate an API key based on the provided data.
-
#generate_key_fn_key_generate_post_with_http_info(generate_key_request, opts = {}) ⇒ Array<(GenerateKeyResponse, Integer, Hash)>
Generate Key Fn Generate an API key based on the provided data.
-
#info_key_fn_key_info_get(opts = {}) ⇒ Object
Info Key Fn Retrieve information about a key.
-
#info_key_fn_key_info_get_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>
Info Key Fn Retrieve information about a key.
-
#initialize(api_client = ApiClient.default) ⇒ KeyManagementApi
constructor
A new instance of KeyManagementApi.
-
#key_health_key_health_post(opts = {}) ⇒ KeyHealthResponse
Key Health Check the health of the key Checks: - If key based logging is configured correctly - sends a test log Usage Pass the key in the request header “‘bash curl -X POST "localhost:4000/key/health" -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" “` Response when logging callbacks are setup correctly: “`json { "key": "healthy", "logging_callbacks": { "callbacks": [ "gcs_bucket" ], "status": "healthy", "details": "No logger exceptions triggered, system is healthy. Manually check if logs were sent to [’gcs_bucket’]" } } “‘ Response when logging callbacks are not setup correctly: “`json { "key": "unhealthy", "logging_callbacks": { "callbacks": [ "gcs_bucket" ], "status": "unhealthy", "details": "Logger exceptions triggered, system is unhealthy: Failed to load vertex credentials. Check to see if credentials containing partial/invalid information." } } “`.
-
#key_health_key_health_post_with_http_info(opts = {}) ⇒ Array<(KeyHealthResponse, Integer, Hash)>
Key Health Check the health of the key Checks: - If key based logging is configured correctly - sends a test log Usage Pass the key in the request header ```bash curl -X POST "localhost:4000/key/health" -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" ``` Response when logging callbacks are setup correctly: ```json { "key": "healthy", "logging_callbacks": { "callbacks": [ "gcs_bucket" ], "status": "healthy", "details": "No logger exceptions triggered, system is healthy. Manually check if logs were sent to ['gcs_bucket']" } } ``` Response when logging callbacks are not setup correctly: ```json { "key": "unhealthy", "logging_callbacks": { "callbacks": [ "gcs_bucket" ], "status": "unhealthy", "details": "Logger exceptions triggered, system is unhealthy: Failed to load vertex credentials. Check to see if credentials containing partial/invalid information." } } ```.
-
#list_keys_key_list_get(opts = {}) ⇒ KeyListResponseObject
List Keys List all keys for a given user / team / organization.
-
#list_keys_key_list_get_with_http_info(opts = {}) ⇒ Array<(KeyListResponseObject, Integer, Hash)>
List Keys List all keys for a given user / team / organization.
-
#regenerate_key_fn_key_key_regenerate_post(key, opts = {}) ⇒ GenerateKeyResponse
Regenerate Key Fn Regenerate an existing API key while optionally updating its parameters.
-
#regenerate_key_fn_key_key_regenerate_post_with_http_info(key, opts = {}) ⇒ Array<(GenerateKeyResponse, Integer, Hash)>
Regenerate Key Fn Regenerate an existing API key while optionally updating its parameters.
-
#regenerate_key_fn_key_regenerate_post(opts = {}) ⇒ GenerateKeyResponse
Regenerate Key Fn Regenerate an existing API key while optionally updating its parameters.
-
#regenerate_key_fn_key_regenerate_post_with_http_info(opts = {}) ⇒ Array<(GenerateKeyResponse, Integer, Hash)>
Regenerate Key Fn Regenerate an existing API key while optionally updating its parameters.
-
#unblock_key_key_unblock_post(block_key_request, opts = {}) ⇒ Object
Unblock Key Unblock a Virtual key to allow it to make requests again.
-
#unblock_key_key_unblock_post_with_http_info(block_key_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Unblock Key Unblock a Virtual key to allow it to make requests again.
-
#update_key_fn_key_update_post(update_key_request, opts = {}) ⇒ Object
Update Key Fn Update an existing API key’s parameters.
-
#update_key_fn_key_update_post_with_http_info(update_key_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Update Key Fn Update an existing API key's parameters.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ KeyManagementApi
Returns a new instance of KeyManagementApi.
19 20 21 |
# File 'lib/litellm_client/api/key_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/key_management_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#block_key_key_block_post(block_key_request, opts = {}) ⇒ LiteLLMVerificationToken
Block Key Block an Virtual key from making any requests. Parameters: - key: str - The key to block. Can be either the unhashed key (sk-…) or the hashed key value Example: “‘bash curl –location ’0.0.0.0:4000/key/block’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data ‘{ "key": "sk-Fn8Ej39NxjAXrvpUGKghGw" }’ “‘ Note: This is an admin-only endpoint. Only proxy admins can block keys.
28 29 30 31 |
# File 'lib/litellm_client/api/key_management_api.rb', line 28 def block_key_key_block_post(block_key_request, opts = {}) data, _status_code, _headers = block_key_key_block_post_with_http_info(block_key_request, opts) data end |
#block_key_key_block_post_with_http_info(block_key_request, opts = {}) ⇒ Array<(LiteLLMVerificationToken, Integer, Hash)>
Block Key Block an Virtual key from making any requests. Parameters: - key: str - The key to block. Can be either the unhashed key (sk-…) or the hashed key value Example: ```bash curl –location '0.0.0.0:4000/key/block' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data '{ "key": "sk-Fn8Ej39NxjAXrvpUGKghGw" }' ``` Note: This is an admin-only endpoint. Only proxy admins can block keys.
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/key_management_api.rb', line 39 def block_key_key_block_post_with_http_info(block_key_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KeyManagementApi.block_key_key_block_post ...' end # verify the required parameter 'block_key_request' is set if @api_client.config.client_side_validation && block_key_request.nil? fail ArgumentError, "Missing the required parameter 'block_key_request' when calling KeyManagementApi.block_key_key_block_post" end # resource path local_var_path = '/key/block' # 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(block_key_request) # return_type return_type = opts[:debug_return_type] || 'LiteLLMVerificationToken' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"KeyManagementApi.block_key_key_block_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: KeyManagementApi#block_key_key_block_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_key_fn_key_delete_post(key_request, opts = {}) ⇒ Object
Delete Key Fn
- Delete a key from the key management system. Parameters
-
keys (List): A list of keys or hashed keys to delete. Example ["sk-QWrxEynunsNpV1zT48HIrw", "837e17519f44683334df5291321d97b8bf1098cd490e49e215f6fea935aa28be"] - key_aliases (List): A list of key aliases to delete. Can be passed instead of ‘keys`.Example ["alias1", "alias2"] Returns: - deleted_keys (List): A list of deleted keys. Example ["sk-QWrxEynunsNpV1zT48HIrw", "837e17519f44683334df5291321d97b8bf1098cd490e49e215f6fea935aa28be"] Example: “`bash curl –location ’0.0.0.0:4000/key/delete’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data ‘{ "keys": ["sk-QWrxEynunsNpV1zT48HIrw"] }’ “‘ Raises: HTTPException: If an error occurs during key deletion.
-
99 100 101 102 |
# File 'lib/litellm_client/api/key_management_api.rb', line 99 def delete_key_fn_key_delete_post(key_request, opts = {}) data, _status_code, _headers = delete_key_fn_key_delete_post_with_http_info(key_request, opts) data end |
#delete_key_fn_key_delete_post_with_http_info(key_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Delete Key Fn
- Delete a key from the key management system. Parameters
-
keys (List): A list of keys or hashed keys to delete. Example ["sk-QWrxEynunsNpV1zT48HIrw", "837e17519f44683334df5291321d97b8bf1098cd490e49e215f6fea935aa28be"] - key_aliases (List): A list of key aliases to delete. Can be passed instead of `keys`.Example ["alias1", "alias2"] Returns: - deleted_keys (List): A list of deleted keys. Example ["sk-QWrxEynunsNpV1zT48HIrw", "837e17519f44683334df5291321d97b8bf1098cd490e49e215f6fea935aa28be"] Example: ```bash curl –location '0.0.0.0:4000/key/delete' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data '{ "keys": ["sk-QWrxEynunsNpV1zT48HIrw"] }' ``` Raises: HTTPException: If an error occurs during key deletion.
-
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 155 156 157 158 159 160 161 162 |
# File 'lib/litellm_client/api/key_management_api.rb', line 110 def delete_key_fn_key_delete_post_with_http_info(key_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KeyManagementApi.delete_key_fn_key_delete_post ...' end # verify the required parameter 'key_request' is set if @api_client.config.client_side_validation && key_request.nil? fail ArgumentError, "Missing the required parameter 'key_request' when calling KeyManagementApi.delete_key_fn_key_delete_post" end # resource path local_var_path = '/key/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(key_request) # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"KeyManagementApi.delete_key_fn_key_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: KeyManagementApi#delete_key_fn_key_delete_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#generate_key_fn_key_generate_post(generate_key_request, opts = {}) ⇒ GenerateKeyResponse
Generate Key Fn Generate an API key based on the provided data. Docs: docs.litellm.ai/docs/proxy/virtual_keys Parameters: - duration: Optional - Specify the length of time the token is valid for. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"). - key_alias: Optional - User defined key alias - key: Optional - User defined key value. If not set, a 16-digit unique sk-key is created for you. - team_id: Optional - The team id of the key - user_id: Optional - The user id of the key - budget_id: Optional - The budget id associated with the key. Created by calling ‘/budget/new`. - models: Optional - Model_name’s a user is allowed to call. (if empty, key is allowed to call all models) - aliases: Optional - Any alias mappings, on top of anything in the config.yaml model list. - docs.litellm.ai/docs/proxy/virtual_keys#managing-auth—upgradedowngrade-models - config: Optional - any key-specific configs, overrides config in config.yaml - spend: Optional - Amount spent by key. Default is 0. Will be updated by proxy whenever key is used. docs.litellm.ai/docs/proxy/virtual_keys#managing-auth—tracking-spend - send_invite_email: Optional - Whether to send an invite email to the user_id, with the generate key - max_budget: Optional - Specify max budget for a given key. - 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"). - max_parallel_requests: Optional - Rate limit a user based on the number of parallel requests. Raises 429 error, if user’s parallel requests > x. - metadata: Optional - Metadata for key, store information for key. Example metadata = {"team": "core-infra", "app": "app2", "email": "[email protected]" } - guardrails: Optional[List] - List of active guardrails for the key - permissions: Optional - key-specific permissions. Currently just used for turning off pii masking (if connected). Example - false - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {"budget_limit": 0.0005, "time_period": "30d"}}. IF null or {} then no model specific budget. - model_rpm_limit: Optional - key-specific model rpm limit. Example - 1000, "gpt-3.5-turbo": 1000. IF null or {} then no model specific rpm limit. - model_tpm_limit: Optional - key-specific model tpm limit. Example - 1000, "gpt-3.5-turbo": 1000. IF null or {} then no model specific tpm limit. - 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 - Whether the key is blocked. - rpm_limit: Optional - Specify rpm limit for a given key (Requests per minute) - tpm_limit: Optional - Specify tpm limit for a given key (Tokens per minute) - soft_budget: Optional - Specify soft budget for a given key. Will trigger a slack alert when this soft budget is reached. - tags: Optional[List] - Tags for [tracking spend](litellm.vercel.app/docs/proxy/enterprise#tracking-spend-for-custom-tags) and/or doing [tag-based routing](litellm.vercel.app/docs/proxy/tag_routing). - enforced_params: Optional[List] - List of enforced params for the key (Enterprise only). [Docs](docs.litellm.ai/docs/proxy/enterprise#enforce-required-params-for-llm-requests) - allowed_routes: Optional - List of allowed routes for the key. Store the actual route or store a wildcard pattern for a set of routes. Example - ["/chat/completions", "/embeddings", "/keys/*"] - object_permission: Optional - key-specific object permission. Example - ["vector_store_1", "vector_store_2"]. IF null or {} then no object permission. Examples: 1. Allow users to turn on/off pii masking “‘bash curl –location ’0.0.0.0:4000/key/generate’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data ‘{ "permissions": true }’ “‘ Returns: - key: (str) The generated api key - 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.
170 171 172 173 |
# File 'lib/litellm_client/api/key_management_api.rb', line 170 def generate_key_fn_key_generate_post(generate_key_request, opts = {}) data, _status_code, _headers = generate_key_fn_key_generate_post_with_http_info(generate_key_request, opts) data end |
#generate_key_fn_key_generate_post_with_http_info(generate_key_request, opts = {}) ⇒ Array<(GenerateKeyResponse, Integer, Hash)>
Generate Key Fn Generate an API key based on the provided data. Docs: docs.litellm.ai/docs/proxy/virtual_keys Parameters: - duration: Optional - Specify the length of time the token is valid for. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"). - key_alias: Optional - User defined key alias - key: Optional - User defined key value. If not set, a 16-digit unique sk-key is created for you. - team_id: Optional - The team id of the key - user_id: Optional - The user id of the key - budget_id: Optional - The budget id associated with the key. Created by calling `/budget/new`. - models: Optional - Model_name's a user is allowed to call. (if empty, key is allowed to call all models) - aliases: Optional - Any alias mappings, on top of anything in the config.yaml model list. - docs.litellm.ai/docs/proxy/virtual_keys#managing-auth—upgradedowngrade-models - config: Optional - any key-specific configs, overrides config in config.yaml - spend: Optional - Amount spent by key. Default is 0. Will be updated by proxy whenever key is used. docs.litellm.ai/docs/proxy/virtual_keys#managing-auth—tracking-spend - send_invite_email: Optional - Whether to send an invite email to the user_id, with the generate key - max_budget: Optional - Specify max budget for a given key. - 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"). - max_parallel_requests: Optional - Rate limit a user based on the number of parallel requests. Raises 429 error, if user's parallel requests > x. - metadata: Optional - Metadata for key, store information for key. Example metadata = {"team": "core-infra", "app": "app2", "email": "[email protected]" } - guardrails: Optional[List] - List of active guardrails for the key - permissions: Optional - key-specific permissions. Currently just used for turning off pii masking (if connected). Example - false - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {"budget_limit": 0.0005, "time_period": "30d"}}. IF null or {} then no model specific budget. - model_rpm_limit: Optional - key-specific model rpm limit. Example - 1000, "gpt-3.5-turbo": 1000. IF null or {} then no model specific rpm limit. - model_tpm_limit: Optional - key-specific model tpm limit. Example - 1000, "gpt-3.5-turbo": 1000. IF null or {} then no model specific tpm limit. - 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 - Whether the key is blocked. - rpm_limit: Optional - Specify rpm limit for a given key (Requests per minute) - tpm_limit: Optional - Specify tpm limit for a given key (Tokens per minute) - soft_budget: Optional - Specify soft budget for a given key. Will trigger a slack alert when this soft budget is reached. - tags: Optional[List] - Tags for [tracking spend](litellm.vercel.app/docs/proxy/enterprise#tracking-spend-for-custom-tags) and/or doing [tag-based routing](litellm.vercel.app/docs/proxy/tag_routing). - enforced_params: Optional[List] - List of enforced params for the key (Enterprise only). [Docs](docs.litellm.ai/docs/proxy/enterprise#enforce-required-params-for-llm-requests) - allowed_routes: Optional - List of allowed routes for the key. Store the actual route or store a wildcard pattern for a set of routes. Example - ["/chat/completions", "/embeddings", "/keys/*"] - object_permission: Optional - key-specific object permission. Example - ["vector_store_1", "vector_store_2"]. IF null or {} then no object permission. Examples: 1. Allow users to turn on/off pii masking ```bash curl –location '0.0.0.0:4000/key/generate' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data '{ "permissions": true }' ``` Returns: - key: (str) The generated api key - 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.
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 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/litellm_client/api/key_management_api.rb', line 181 def generate_key_fn_key_generate_post_with_http_info(generate_key_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KeyManagementApi.generate_key_fn_key_generate_post ...' end # verify the required parameter 'generate_key_request' is set if @api_client.config.client_side_validation && generate_key_request.nil? fail ArgumentError, "Missing the required parameter 'generate_key_request' when calling KeyManagementApi.generate_key_fn_key_generate_post" end # resource path local_var_path = '/key/generate' # 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(generate_key_request) # return_type return_type = opts[:debug_return_type] || 'GenerateKeyResponse' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"KeyManagementApi.generate_key_fn_key_generate_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: KeyManagementApi#generate_key_fn_key_generate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#info_key_fn_key_info_get(opts = {}) ⇒ Object
Info Key Fn Retrieve information about a key. Parameters: key: Optional = Query parameter representing the key in the request user_api_key_dict: UserAPIKeyAuth = Dependency representing the user’s API key Returns: Dict containing the key and its associated information Example Curl: “‘ curl -X GET "0.0.0.0:4000/key/info?key=sk-02Wr4IAlN3NvPXvL5JVvDA" -H "Authorization: Bearer sk-1234" “` Example Curl - if no key is passed, it will use the Key Passed in Authorization Header “` curl -X GET "0.0.0.0:4000/key/info" -H "Authorization: Bearer sk-02Wr4IAlN3NvPXvL5JVvDA" “`
240 241 242 243 |
# File 'lib/litellm_client/api/key_management_api.rb', line 240 def info_key_fn_key_info_get(opts = {}) data, _status_code, _headers = info_key_fn_key_info_get_with_http_info(opts) data end |
#info_key_fn_key_info_get_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>
Info Key Fn Retrieve information about a key. Parameters: key: Optional = Query parameter representing the key in the request user_api_key_dict: UserAPIKeyAuth = Dependency representing the user's API key Returns: Dict containing the key and its associated information Example Curl: ``` curl -X GET "0.0.0.0:4000/key/info?key=sk-02Wr4IAlN3NvPXvL5JVvDA" -H "Authorization: Bearer sk-1234" ``` Example Curl - if no key is passed, it will use the Key Passed in Authorization Header ``` curl -X GET "0.0.0.0:4000/key/info" -H "Authorization: Bearer sk-02Wr4IAlN3NvPXvL5JVvDA" ```
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 |
# File 'lib/litellm_client/api/key_management_api.rb', line 250 def info_key_fn_key_info_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KeyManagementApi.info_key_fn_key_info_get ...' end # resource path local_var_path = '/key/info' # query parameters query_params = opts[:query_params] || {} query_params[:'key'] = opts[:'key'] if !opts[:'key'].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 => :"KeyManagementApi.info_key_fn_key_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: KeyManagementApi#info_key_fn_key_info_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#key_health_key_health_post(opts = {}) ⇒ KeyHealthResponse
Key Health Check the health of the key Checks: - If key based logging is configured correctly - sends a test log Usage Pass the key in the request header “‘bash curl -X POST "localhost:4000/key/health" -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" “` Response when logging callbacks are setup correctly: “`json { "key": "healthy", "logging_callbacks": { "callbacks": [ "gcs_bucket" ], "status": "healthy", "details": "No logger exceptions triggered, system is healthy. Manually check if logs were sent to [’gcs_bucket’]" } } “‘ Response when logging callbacks are not setup correctly: “`json { "key": "unhealthy", "logging_callbacks": { "callbacks": [ "gcs_bucket" ], "status": "unhealthy", "details": "Logger exceptions triggered, system is unhealthy: Failed to load vertex credentials. Check to see if credentials containing partial/invalid information." } } “`
299 300 301 302 |
# File 'lib/litellm_client/api/key_management_api.rb', line 299 def key_health_key_health_post(opts = {}) data, _status_code, _headers = key_health_key_health_post_with_http_info(opts) data end |
#key_health_key_health_post_with_http_info(opts = {}) ⇒ Array<(KeyHealthResponse, Integer, Hash)>
Key Health Check the health of the key Checks: - If key based logging is configured correctly - sends a test log Usage Pass the key in the request header ```bash curl -X POST "localhost:4000/key/health" -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" ``` Response when logging callbacks are setup correctly: ```json { "key": "healthy", "logging_callbacks": { "callbacks": [ "gcs_bucket" ], "status": "healthy", "details": "No logger exceptions triggered, system is healthy. Manually check if logs were sent to ['gcs_bucket']" } } ``` Response when logging callbacks are not setup correctly: ```json { "key": "unhealthy", "logging_callbacks": { "callbacks": [ "gcs_bucket" ], "status": "unhealthy", "details": "Logger exceptions triggered, system is unhealthy: Failed to load vertex credentials. Check to see if credentials containing partial/invalid information." } } ```
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 343 344 345 346 347 348 349 350 |
# File 'lib/litellm_client/api/key_management_api.rb', line 308 def key_health_key_health_post_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KeyManagementApi.key_health_key_health_post ...' end # resource path local_var_path = '/key/health' # 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] || 'KeyHealthResponse' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"KeyManagementApi.key_health_key_health_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: KeyManagementApi#key_health_key_health_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_keys_key_list_get(opts = {}) ⇒ KeyListResponseObject
367 368 369 370 |
# File 'lib/litellm_client/api/key_management_api.rb', line 367 def list_keys_key_list_get(opts = {}) data, _status_code, _headers = list_keys_key_list_get_with_http_info(opts) data end |
#list_keys_key_list_get_with_http_info(opts = {}) ⇒ Array<(KeyListResponseObject, Integer, Hash)>
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 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 447 448 449 450 451 452 |
# File 'lib/litellm_client/api/key_management_api.rb', line 387 def list_keys_key_list_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KeyManagementApi.list_keys_key_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 KeyManagementApi.list_keys_key_list_get, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100 fail ArgumentError, 'invalid value for "opts[:"size"]" when calling KeyManagementApi.list_keys_key_list_get, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1 fail ArgumentError, 'invalid value for "opts[:"size"]" when calling KeyManagementApi.list_keys_key_list_get, must be greater than or equal to 1.' end # resource path local_var_path = '/key/list' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil? query_params[:'team_id'] = opts[:'team_id'] if !opts[:'team_id'].nil? query_params[:'organization_id'] = opts[:'organization_id'] if !opts[:'organization_id'].nil? query_params[:'key_hash'] = opts[:'key_hash'] if !opts[:'key_hash'].nil? query_params[:'key_alias'] = opts[:'key_alias'] if !opts[:'key_alias'].nil? query_params[:'return_full_object'] = opts[:'return_full_object'] if !opts[:'return_full_object'].nil? query_params[:'include_team_keys'] = opts[:'include_team_keys'] if !opts[:'include_team_keys'].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] || 'KeyListResponseObject' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"KeyManagementApi.list_keys_key_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: KeyManagementApi#list_keys_key_list_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#regenerate_key_fn_key_key_regenerate_post(key, opts = {}) ⇒ GenerateKeyResponse
Regenerate Key Fn Regenerate an existing API key while optionally updating its parameters. Parameters: - key: str (path parameter) - The key to regenerate - data: Optional - Request body containing optional parameters to update - key_alias: Optional - User-friendly key alias - user_id: Optional - User ID associated with key - team_id: Optional - Team ID associated with key - models: Optional - Model_name’s a user is allowed to call - tags: Optional[List] - Tags for organizing keys (Enterprise only) - spend: Optional - Amount spent by key - max_budget: Optional - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {"budget_limit": 0.0005, "time_period": "30d"} - budget_duration: Optional - Budget reset period ("30d", "1h", etc.) - soft_budget: Optional - Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional - Rate limit for parallel requests - metadata: Optional - Metadata for key. Example "core-infra", "app": "app2" - tpm_limit: Optional - Tokens per minute limit - rpm_limit: Optional - Requests per minute limit - model_rpm_limit: Optional - Model-specific RPM limits 100, "claude-v1": 200 - model_tpm_limit: Optional - Model-specific TPM limits 100000, "claude-v1": 200000 - allowed_cache_controls: Optional - List of allowed cache control values - duration: Optional - Key validity duration ("30d", "1h", etc.) - permissions: Optional - Key-specific permissions - guardrails: Optional[List] - List of active guardrails for the key - blocked: Optional - Whether the key is blocked Returns: - GenerateKeyResponse containing the new key and its updated parameters Example: “‘bash curl –location –request POST ’localhost:4000/key/sk-1234/regenerate’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data-raw ‘{ "max_budget": 100, "metadata": "core-infra", "models": ["gpt-4", "gpt-3.5-turbo"] }’ “‘ Note: This is an Enterprise feature. It requires a premium license to use.
461 462 463 464 |
# File 'lib/litellm_client/api/key_management_api.rb', line 461 def regenerate_key_fn_key_key_regenerate_post(key, opts = {}) data, _status_code, _headers = regenerate_key_fn_key_key_regenerate_post_with_http_info(key, opts) data end |
#regenerate_key_fn_key_key_regenerate_post_with_http_info(key, opts = {}) ⇒ Array<(GenerateKeyResponse, Integer, Hash)>
Regenerate Key Fn Regenerate an existing API key while optionally updating its parameters. Parameters: - key: str (path parameter) - The key to regenerate - data: Optional - Request body containing optional parameters to update - key_alias: Optional - User-friendly key alias - user_id: Optional - User ID associated with key - team_id: Optional - Team ID associated with key - models: Optional - Model_name's a user is allowed to call - tags: Optional[List] - Tags for organizing keys (Enterprise only) - spend: Optional - Amount spent by key - max_budget: Optional - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {"budget_limit": 0.0005, "time_period": "30d"} - budget_duration: Optional - Budget reset period ("30d", "1h", etc.) - soft_budget: Optional - Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional - Rate limit for parallel requests - metadata: Optional - Metadata for key. Example "core-infra", "app": "app2" - tpm_limit: Optional - Tokens per minute limit - rpm_limit: Optional - Requests per minute limit - model_rpm_limit: Optional - Model-specific RPM limits 100, "claude-v1": 200 - model_tpm_limit: Optional - Model-specific TPM limits 100000, "claude-v1": 200000 - allowed_cache_controls: Optional - List of allowed cache control values - duration: Optional - Key validity duration ("30d", "1h", etc.) - permissions: Optional - Key-specific permissions - guardrails: Optional[List] - List of active guardrails for the key - blocked: Optional - Whether the key is blocked Returns: - GenerateKeyResponse containing the new key and its updated parameters Example: ```bash curl –location –request POST 'localhost:4000/key/sk-1234/regenerate' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data-raw '{ "max_budget": 100, "metadata": "core-infra", "models": ["gpt-4", "gpt-3.5-turbo"] }' ``` Note: This is an Enterprise feature. It requires a premium license to use.
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 513 514 515 516 517 518 519 520 521 |
# File 'lib/litellm_client/api/key_management_api.rb', line 473 def regenerate_key_fn_key_key_regenerate_post_with_http_info(key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KeyManagementApi.regenerate_key_fn_key_key_regenerate_post ...' end # resource path local_var_path = '/key/{key}/regenerate'.sub('{' + 'key' + '}', CGI.escape(key.to_s)) # 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(opts[:'regenerate_key_request']) # return_type return_type = opts[:debug_return_type] || 'GenerateKeyResponse' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"KeyManagementApi.regenerate_key_fn_key_key_regenerate_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: KeyManagementApi#regenerate_key_fn_key_key_regenerate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#regenerate_key_fn_key_regenerate_post(opts = {}) ⇒ GenerateKeyResponse
Regenerate Key Fn Regenerate an existing API key while optionally updating its parameters. Parameters: - key: str (path parameter) - The key to regenerate - data: Optional - Request body containing optional parameters to update - key_alias: Optional - User-friendly key alias - user_id: Optional - User ID associated with key - team_id: Optional - Team ID associated with key - models: Optional - Model_name’s a user is allowed to call - tags: Optional[List] - Tags for organizing keys (Enterprise only) - spend: Optional - Amount spent by key - max_budget: Optional - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {"budget_limit": 0.0005, "time_period": "30d"} - budget_duration: Optional - Budget reset period ("30d", "1h", etc.) - soft_budget: Optional - Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional - Rate limit for parallel requests - metadata: Optional - Metadata for key. Example "core-infra", "app": "app2" - tpm_limit: Optional - Tokens per minute limit - rpm_limit: Optional - Requests per minute limit - model_rpm_limit: Optional - Model-specific RPM limits 100, "claude-v1": 200 - model_tpm_limit: Optional - Model-specific TPM limits 100000, "claude-v1": 200000 - allowed_cache_controls: Optional - List of allowed cache control values - duration: Optional - Key validity duration ("30d", "1h", etc.) - permissions: Optional - Key-specific permissions - guardrails: Optional[List] - List of active guardrails for the key - blocked: Optional - Whether the key is blocked Returns: - GenerateKeyResponse containing the new key and its updated parameters Example: “‘bash curl –location –request POST ’localhost:4000/key/sk-1234/regenerate’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data-raw ‘{ "max_budget": 100, "metadata": "core-infra", "models": ["gpt-4", "gpt-3.5-turbo"] }’ “‘ Note: This is an Enterprise feature. It requires a premium license to use.
530 531 532 533 |
# File 'lib/litellm_client/api/key_management_api.rb', line 530 def regenerate_key_fn_key_regenerate_post(opts = {}) data, _status_code, _headers = regenerate_key_fn_key_regenerate_post_with_http_info(opts) data end |
#regenerate_key_fn_key_regenerate_post_with_http_info(opts = {}) ⇒ Array<(GenerateKeyResponse, Integer, Hash)>
Regenerate Key Fn Regenerate an existing API key while optionally updating its parameters. Parameters: - key: str (path parameter) - The key to regenerate - data: Optional - Request body containing optional parameters to update - key_alias: Optional - User-friendly key alias - user_id: Optional - User ID associated with key - team_id: Optional - Team ID associated with key - models: Optional - Model_name's a user is allowed to call - tags: Optional[List] - Tags for organizing keys (Enterprise only) - spend: Optional - Amount spent by key - max_budget: Optional - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {"budget_limit": 0.0005, "time_period": "30d"} - budget_duration: Optional - Budget reset period ("30d", "1h", etc.) - soft_budget: Optional - Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional - Rate limit for parallel requests - metadata: Optional - Metadata for key. Example "core-infra", "app": "app2" - tpm_limit: Optional - Tokens per minute limit - rpm_limit: Optional - Requests per minute limit - model_rpm_limit: Optional - Model-specific RPM limits 100, "claude-v1": 200 - model_tpm_limit: Optional - Model-specific TPM limits 100000, "claude-v1": 200000 - allowed_cache_controls: Optional - List of allowed cache control values - duration: Optional - Key validity duration ("30d", "1h", etc.) - permissions: Optional - Key-specific permissions - guardrails: Optional[List] - List of active guardrails for the key - blocked: Optional - Whether the key is blocked Returns: - GenerateKeyResponse containing the new key and its updated parameters Example: ```bash curl –location –request POST 'localhost:4000/key/sk-1234/regenerate' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data-raw '{ "max_budget": 100, "metadata": "core-infra", "models": ["gpt-4", "gpt-3.5-turbo"] }' ``` Note: This is an Enterprise feature. It requires a premium license to use.
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 585 586 587 588 589 590 591 |
# File 'lib/litellm_client/api/key_management_api.rb', line 542 def regenerate_key_fn_key_regenerate_post_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KeyManagementApi.regenerate_key_fn_key_regenerate_post ...' end # resource path local_var_path = '/key/regenerate' # query parameters query_params = opts[:query_params] || {} query_params[:'key'] = opts[:'key'] if !opts[:'key'].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'] # 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(opts[:'regenerate_key_request']) # return_type return_type = opts[:debug_return_type] || 'GenerateKeyResponse' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"KeyManagementApi.regenerate_key_fn_key_regenerate_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: KeyManagementApi#regenerate_key_fn_key_regenerate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#unblock_key_key_unblock_post(block_key_request, opts = {}) ⇒ Object
Unblock Key Unblock a Virtual key to allow it to make requests again. Parameters: - key: str - The key to unblock. Can be either the unhashed key (sk-…) or the hashed key value Example: “‘bash curl –location ’0.0.0.0:4000/key/unblock’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data ‘{ "key": "sk-Fn8Ej39NxjAXrvpUGKghGw" }’ “‘ Note: This is an admin-only endpoint. Only proxy admins can unblock keys.
599 600 601 602 |
# File 'lib/litellm_client/api/key_management_api.rb', line 599 def unblock_key_key_unblock_post(block_key_request, opts = {}) data, _status_code, _headers = unblock_key_key_unblock_post_with_http_info(block_key_request, opts) data end |
#unblock_key_key_unblock_post_with_http_info(block_key_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Unblock Key Unblock a Virtual key to allow it to make requests again. Parameters: - key: str - The key to unblock. Can be either the unhashed key (sk-…) or the hashed key value Example: ```bash curl –location '0.0.0.0:4000/key/unblock' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data '{ "key": "sk-Fn8Ej39NxjAXrvpUGKghGw" }' ``` Note: This is an admin-only endpoint. Only proxy admins can unblock keys.
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 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 |
# File 'lib/litellm_client/api/key_management_api.rb', line 610 def unblock_key_key_unblock_post_with_http_info(block_key_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KeyManagementApi.unblock_key_key_unblock_post ...' end # verify the required parameter 'block_key_request' is set if @api_client.config.client_side_validation && block_key_request.nil? fail ArgumentError, "Missing the required parameter 'block_key_request' when calling KeyManagementApi.unblock_key_key_unblock_post" end # resource path local_var_path = '/key/unblock' # 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(block_key_request) # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"KeyManagementApi.unblock_key_key_unblock_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: KeyManagementApi#unblock_key_key_unblock_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_key_fn_key_update_post(update_key_request, opts = {}) ⇒ Object
Update Key Fn Update an existing API key’s parameters. Parameters: - key: str - The key to update - key_alias: Optional - User-friendly key alias - user_id: Optional - User ID associated with key - team_id: Optional - Team ID associated with key - budget_id: Optional - The budget id associated with the key. Created by calling ‘/budget/new`. - models: Optional - Model_name’s a user is allowed to call - tags: Optional[List] - Tags for organizing keys (Enterprise only) - enforced_params: Optional[List] - List of enforced params for the key (Enterprise only). [Docs](docs.litellm.ai/docs/proxy/enterprise#enforce-required-params-for-llm-requests) - spend: Optional - Amount spent by key - max_budget: Optional - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {"budget_limit": 0.0005, "time_period": "30d"} - budget_duration: Optional - Budget reset period ("30d", "1h", etc.) - soft_budget: Optional - [TODO] Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional - Rate limit for parallel requests - metadata: Optional - Metadata for key. Example "core-infra", "app": "app2" - tpm_limit: Optional - Tokens per minute limit - rpm_limit: Optional - Requests per minute limit - model_rpm_limit: Optional - Model-specific RPM limits 100, "claude-v1": 200 - model_tpm_limit: Optional - Model-specific TPM limits 100000, "claude-v1": 200000 - allowed_cache_controls: Optional - List of allowed cache control values - duration: Optional - Key validity duration ("30d", "1h", etc.) - permissions: Optional - Key-specific permissions - send_invite_email: Optional - Send invite email to user_id - guardrails: Optional[List] - List of active guardrails for the key - blocked: Optional - Whether the key is blocked - aliases: Optional - Model aliases for the key - [Docs](litellm.vercel.app/docs/proxy/virtual_keys#model-aliases) - config: Optional - [DEPRECATED PARAM] Key-specific config. - temp_budget_increase: Optional - Temporary budget increase for the key (Enterprise only). - temp_budget_expiry: Optional - Expiry time for the temporary budget increase (Enterprise only). - allowed_routes: Optional - List of allowed routes for the key. Store the actual route or store a wildcard pattern for a set of routes. Example - ["/chat/completions", "/embeddings", "/keys/*"] - object_permission: Optional - key-specific object permission. Example - ["vector_store_1", "vector_store_2"]. IF null or {} then no object permission. Example: “‘bash curl –location ’0.0.0.0:4000/key/update’ –header ‘Authorization: Bearer sk-1234’ –header ‘Content-Type: application/json’ –data ‘{ "key": "sk-1234", "key_alias": "my-key", "user_id": "user-1234", "team_id": "team-1234", "max_budget": 100, "metadata": "any-val", }’ “‘
670 671 672 673 |
# File 'lib/litellm_client/api/key_management_api.rb', line 670 def update_key_fn_key_update_post(update_key_request, opts = {}) data, _status_code, _headers = update_key_fn_key_update_post_with_http_info(update_key_request, opts) data end |
#update_key_fn_key_update_post_with_http_info(update_key_request, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Update Key Fn Update an existing API key's parameters. Parameters: - key: str - The key to update - key_alias: Optional - User-friendly key alias - user_id: Optional - User ID associated with key - team_id: Optional - Team ID associated with key - budget_id: Optional - The budget id associated with the key. Created by calling `/budget/new`. - models: Optional - Model_name's a user is allowed to call - tags: Optional[List] - Tags for organizing keys (Enterprise only) - enforced_params: Optional[List] - List of enforced params for the key (Enterprise only). [Docs](docs.litellm.ai/docs/proxy/enterprise#enforce-required-params-for-llm-requests) - spend: Optional - Amount spent by key - max_budget: Optional - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {"budget_limit": 0.0005, "time_period": "30d"} - budget_duration: Optional - Budget reset period ("30d", "1h", etc.) - soft_budget: Optional - [TODO] Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional - Rate limit for parallel requests - metadata: Optional - Metadata for key. Example "core-infra", "app": "app2" - tpm_limit: Optional - Tokens per minute limit - rpm_limit: Optional - Requests per minute limit - model_rpm_limit: Optional - Model-specific RPM limits 100, "claude-v1": 200 - model_tpm_limit: Optional - Model-specific TPM limits 100000, "claude-v1": 200000 - allowed_cache_controls: Optional - List of allowed cache control values - duration: Optional - Key validity duration ("30d", "1h", etc.) - permissions: Optional - Key-specific permissions - send_invite_email: Optional - Send invite email to user_id - guardrails: Optional[List] - List of active guardrails for the key - blocked: Optional - Whether the key is blocked - aliases: Optional - Model aliases for the key - [Docs](litellm.vercel.app/docs/proxy/virtual_keys#model-aliases) - config: Optional - [DEPRECATED PARAM] Key-specific config. - temp_budget_increase: Optional - Temporary budget increase for the key (Enterprise only). - temp_budget_expiry: Optional - Expiry time for the temporary budget increase (Enterprise only). - allowed_routes: Optional - List of allowed routes for the key. Store the actual route or store a wildcard pattern for a set of routes. Example - ["/chat/completions", "/embeddings", "/keys/*"] - object_permission: Optional - key-specific object permission. Example - ["vector_store_1", "vector_store_2"]. IF null or {} then no object permission. Example: ```bash curl –location '0.0.0.0:4000/key/update' –header 'Authorization: Bearer sk-1234' –header 'Content-Type: application/json' –data '{ "key": "sk-1234", "key_alias": "my-key", "user_id": "user-1234", "team_id": "team-1234", "max_budget": 100, "metadata": "any-val", }' ```
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 |
# File 'lib/litellm_client/api/key_management_api.rb', line 681 def update_key_fn_key_update_post_with_http_info(update_key_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KeyManagementApi.update_key_fn_key_update_post ...' end # verify the required parameter 'update_key_request' is set if @api_client.config.client_side_validation && update_key_request.nil? fail ArgumentError, "Missing the required parameter 'update_key_request' when calling KeyManagementApi.update_key_fn_key_update_post" end # resource path local_var_path = '/key/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 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(update_key_request) # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['APIKeyHeader'] = opts.merge( :operation => :"KeyManagementApi.update_key_fn_key_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: KeyManagementApi#update_key_fn_key_update_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |