UNPKG

@cotofe/service-of-litellm

Version:

OpenAPI client for @cotofe/service-of-litellm

360 lines (359 loc) 34.8 kB
"use strict"; /** * Platform * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LitellmKeyManagementApi = void 0; const runtime = require("../runtime"); /** * */ class LitellmKeyManagementApi extends runtime.BaseAPI { /** * 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 \'http://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. * Block Key */ blockKeyKeyBlockPostRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (requestParameters.litellmChangedBy != null) { headerParameters['litellm-changed-by'] = String(requestParameters.litellmChangedBy); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = yield token('bearer', []); if (tokenString) { headerParameters.Authorization = `Bearer ${tokenString}`; } } const response = yield this.request({ path: `/key/block`, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.blockKeyRequest, }, initOverrides); return new runtime.JSONApiResponse(response); }); } /** * 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 \'http://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. * Block Key */ blockKeyKeyBlockPost() { return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) { const response = yield this.blockKeyKeyBlockPostRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Retrieve information about a key. Parameters: key: Optional[str] = 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 \"http://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 \"http://0.0.0.0:4000/key/info\" -H \"Authorization: Bearer sk-02Wr4IAlN3NvPXvL5JVvDA\" ``` * Info Key Fn */ infoKeyFnKeyInfoGetRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters.key != null) { queryParameters.key = requestParameters.key; } const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = yield token('bearer', []); if (tokenString) { headerParameters.Authorization = `Bearer ${tokenString}`; } } const response = yield this.request({ path: `/key/info`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); } else { return new runtime.TextApiResponse(response); } }); } /** * Retrieve information about a key. Parameters: key: Optional[str] = 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 \"http://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 \"http://0.0.0.0:4000/key/info\" -H \"Authorization: Bearer sk-02Wr4IAlN3NvPXvL5JVvDA\" ``` * Info Key Fn */ infoKeyFnKeyInfoGet() { return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) { const response = yield this.infoKeyFnKeyInfoGetRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * 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 \"http://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 */ keyHealthKeyHealthPostRaw(initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = yield token('bearer', []); if (tokenString) { headerParameters.Authorization = `Bearer ${tokenString}`; } } const response = yield this.request({ path: `/key/health`, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response); }); } /** * 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 \"http://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 */ keyHealthKeyHealthPost(initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.keyHealthKeyHealthPostRaw(initOverrides); return yield response.value(); }); } /** * Regenerate an existing API key while optionally updating its parameters. Parameters: - key: str (path parameter) - The key to regenerate - data: Optional[RegenerateKeyRequest] - Request body containing optional parameters to update - key_alias: Optional[str] - User-friendly key alias - user_id: Optional[str] - User ID associated with key - team_id: Optional[str] - Team ID associated with key - models: Optional[list] - Model_name\'s a user is allowed to call - tags: Optional[List[str]] - Tags for organizing keys (Enterprise only) - spend: Optional[float] - Amount spent by key - max_budget: Optional[float] - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {\"gpt-4\": {\"budget_limit\": 0.0005, \"time_period\": \"30d\"}} - budget_duration: Optional[str] - Budget reset period (\"30d\", \"1h\", etc.) - soft_budget: Optional[float] - Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional[int] - Rate limit for parallel requests - metadata: Optional[dict] - Metadata for key. Example {\"team\": \"core-infra\", \"app\": \"app2\"} - tpm_limit: Optional[int] - Tokens per minute limit - rpm_limit: Optional[int] - Requests per minute limit - model_rpm_limit: Optional[dict] - Model-specific RPM limits {\"gpt-4\": 100, \"claude-v1\": 200} - model_tpm_limit: Optional[dict] - Model-specific TPM limits {\"gpt-4\": 100000, \"claude-v1\": 200000} - allowed_cache_controls: Optional[list] - List of allowed cache control values - duration: Optional[str] - Key validity duration (\"30d\", \"1h\", etc.) - permissions: Optional[dict] - Key-specific permissions - guardrails: Optional[List[str]] - List of active guardrails for the key - blocked: Optional[bool] - Whether the key is blocked Returns: - GenerateKeyResponse containing the new key and its updated parameters Example: ```bash curl --location --request POST \'http://localhost:4000/key/sk-1234/regenerate\' --header \'Authorization: Bearer sk-1234\' --header \'Content-Type: application/json\' --data-raw \'{ \"max_budget\": 100, \"metadata\": {\"team\": \"core-infra\"}, \"models\": [\"gpt-4\", \"gpt-3.5-turbo\"] }\' ``` Note: This is an Enterprise feature. It requires a premium license to use. * Regenerate Key Fn */ regenerateKeyFnKeyKeyRegeneratePostRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.key == null) { throw new runtime.RequiredError('key', 'Required parameter "key" was null or undefined when calling regenerateKeyFnKeyKeyRegeneratePost().'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (requestParameters.litellmChangedBy != null) { headerParameters['litellm-changed-by'] = String(requestParameters.litellmChangedBy); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = yield token('bearer', []); if (tokenString) { headerParameters.Authorization = `Bearer ${tokenString}`; } } const response = yield this.request({ path: `/key/{key}/regenerate`.replace(`{${'key'}}`, encodeURIComponent(String(requestParameters.key))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.regenerateKeyRequest, }, initOverrides); return new runtime.JSONApiResponse(response); }); } /** * Regenerate an existing API key while optionally updating its parameters. Parameters: - key: str (path parameter) - The key to regenerate - data: Optional[RegenerateKeyRequest] - Request body containing optional parameters to update - key_alias: Optional[str] - User-friendly key alias - user_id: Optional[str] - User ID associated with key - team_id: Optional[str] - Team ID associated with key - models: Optional[list] - Model_name\'s a user is allowed to call - tags: Optional[List[str]] - Tags for organizing keys (Enterprise only) - spend: Optional[float] - Amount spent by key - max_budget: Optional[float] - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {\"gpt-4\": {\"budget_limit\": 0.0005, \"time_period\": \"30d\"}} - budget_duration: Optional[str] - Budget reset period (\"30d\", \"1h\", etc.) - soft_budget: Optional[float] - Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional[int] - Rate limit for parallel requests - metadata: Optional[dict] - Metadata for key. Example {\"team\": \"core-infra\", \"app\": \"app2\"} - tpm_limit: Optional[int] - Tokens per minute limit - rpm_limit: Optional[int] - Requests per minute limit - model_rpm_limit: Optional[dict] - Model-specific RPM limits {\"gpt-4\": 100, \"claude-v1\": 200} - model_tpm_limit: Optional[dict] - Model-specific TPM limits {\"gpt-4\": 100000, \"claude-v1\": 200000} - allowed_cache_controls: Optional[list] - List of allowed cache control values - duration: Optional[str] - Key validity duration (\"30d\", \"1h\", etc.) - permissions: Optional[dict] - Key-specific permissions - guardrails: Optional[List[str]] - List of active guardrails for the key - blocked: Optional[bool] - Whether the key is blocked Returns: - GenerateKeyResponse containing the new key and its updated parameters Example: ```bash curl --location --request POST \'http://localhost:4000/key/sk-1234/regenerate\' --header \'Authorization: Bearer sk-1234\' --header \'Content-Type: application/json\' --data-raw \'{ \"max_budget\": 100, \"metadata\": {\"team\": \"core-infra\"}, \"models\": [\"gpt-4\", \"gpt-3.5-turbo\"] }\' ``` Note: This is an Enterprise feature. It requires a premium license to use. * Regenerate Key Fn */ regenerateKeyFnKeyKeyRegeneratePost(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.regenerateKeyFnKeyKeyRegeneratePostRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Regenerate an existing API key while optionally updating its parameters. Parameters: - key: str (path parameter) - The key to regenerate - data: Optional[RegenerateKeyRequest] - Request body containing optional parameters to update - key_alias: Optional[str] - User-friendly key alias - user_id: Optional[str] - User ID associated with key - team_id: Optional[str] - Team ID associated with key - models: Optional[list] - Model_name\'s a user is allowed to call - tags: Optional[List[str]] - Tags for organizing keys (Enterprise only) - spend: Optional[float] - Amount spent by key - max_budget: Optional[float] - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {\"gpt-4\": {\"budget_limit\": 0.0005, \"time_period\": \"30d\"}} - budget_duration: Optional[str] - Budget reset period (\"30d\", \"1h\", etc.) - soft_budget: Optional[float] - Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional[int] - Rate limit for parallel requests - metadata: Optional[dict] - Metadata for key. Example {\"team\": \"core-infra\", \"app\": \"app2\"} - tpm_limit: Optional[int] - Tokens per minute limit - rpm_limit: Optional[int] - Requests per minute limit - model_rpm_limit: Optional[dict] - Model-specific RPM limits {\"gpt-4\": 100, \"claude-v1\": 200} - model_tpm_limit: Optional[dict] - Model-specific TPM limits {\"gpt-4\": 100000, \"claude-v1\": 200000} - allowed_cache_controls: Optional[list] - List of allowed cache control values - duration: Optional[str] - Key validity duration (\"30d\", \"1h\", etc.) - permissions: Optional[dict] - Key-specific permissions - guardrails: Optional[List[str]] - List of active guardrails for the key - blocked: Optional[bool] - Whether the key is blocked Returns: - GenerateKeyResponse containing the new key and its updated parameters Example: ```bash curl --location --request POST \'http://localhost:4000/key/sk-1234/regenerate\' --header \'Authorization: Bearer sk-1234\' --header \'Content-Type: application/json\' --data-raw \'{ \"max_budget\": 100, \"metadata\": {\"team\": \"core-infra\"}, \"models\": [\"gpt-4\", \"gpt-3.5-turbo\"] }\' ``` Note: This is an Enterprise feature. It requires a premium license to use. * update key */ regenerateKeyFnKeyRegeneratePostRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters.key != null) { queryParameters.key = requestParameters.key; } const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (requestParameters.litellmChangedBy != null) { headerParameters['litellm-changed-by'] = String(requestParameters.litellmChangedBy); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = yield token('bearer', []); if (tokenString) { headerParameters.Authorization = `Bearer ${tokenString}`; } } const response = yield this.request({ path: `/key/update`, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.regenerateKeyRequest, }, initOverrides); return new runtime.JSONApiResponse(response); }); } /** * Regenerate an existing API key while optionally updating its parameters. Parameters: - key: str (path parameter) - The key to regenerate - data: Optional[RegenerateKeyRequest] - Request body containing optional parameters to update - key_alias: Optional[str] - User-friendly key alias - user_id: Optional[str] - User ID associated with key - team_id: Optional[str] - Team ID associated with key - models: Optional[list] - Model_name\'s a user is allowed to call - tags: Optional[List[str]] - Tags for organizing keys (Enterprise only) - spend: Optional[float] - Amount spent by key - max_budget: Optional[float] - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {\"gpt-4\": {\"budget_limit\": 0.0005, \"time_period\": \"30d\"}} - budget_duration: Optional[str] - Budget reset period (\"30d\", \"1h\", etc.) - soft_budget: Optional[float] - Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional[int] - Rate limit for parallel requests - metadata: Optional[dict] - Metadata for key. Example {\"team\": \"core-infra\", \"app\": \"app2\"} - tpm_limit: Optional[int] - Tokens per minute limit - rpm_limit: Optional[int] - Requests per minute limit - model_rpm_limit: Optional[dict] - Model-specific RPM limits {\"gpt-4\": 100, \"claude-v1\": 200} - model_tpm_limit: Optional[dict] - Model-specific TPM limits {\"gpt-4\": 100000, \"claude-v1\": 200000} - allowed_cache_controls: Optional[list] - List of allowed cache control values - duration: Optional[str] - Key validity duration (\"30d\", \"1h\", etc.) - permissions: Optional[dict] - Key-specific permissions - guardrails: Optional[List[str]] - List of active guardrails for the key - blocked: Optional[bool] - Whether the key is blocked Returns: - GenerateKeyResponse containing the new key and its updated parameters Example: ```bash curl --location --request POST \'http://localhost:4000/key/sk-1234/regenerate\' --header \'Authorization: Bearer sk-1234\' --header \'Content-Type: application/json\' --data-raw \'{ \"max_budget\": 100, \"metadata\": {\"team\": \"core-infra\"}, \"models\": [\"gpt-4\", \"gpt-3.5-turbo\"] }\' ``` Note: This is an Enterprise feature. It requires a premium license to use. * update key */ regenerateKeyFnKeyRegeneratePost() { return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) { const response = yield this.regenerateKeyFnKeyRegeneratePostRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Regenerate an existing API key while optionally updating its parameters. Parameters: - key: str (path parameter) - The key to regenerate - data: Optional[RegenerateKeyRequest] - Request body containing optional parameters to update - key_alias: Optional[str] - User-friendly key alias - user_id: Optional[str] - User ID associated with key - team_id: Optional[str] - Team ID associated with key - models: Optional[list] - Model_name\'s a user is allowed to call - tags: Optional[List[str]] - Tags for organizing keys (Enterprise only) - spend: Optional[float] - Amount spent by key - max_budget: Optional[float] - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {\"gpt-4\": {\"budget_limit\": 0.0005, \"time_period\": \"30d\"}} - budget_duration: Optional[str] - Budget reset period (\"30d\", \"1h\", etc.) - soft_budget: Optional[float] - Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional[int] - Rate limit for parallel requests - metadata: Optional[dict] - Metadata for key. Example {\"team\": \"core-infra\", \"app\": \"app2\"} - tpm_limit: Optional[int] - Tokens per minute limit - rpm_limit: Optional[int] - Requests per minute limit - model_rpm_limit: Optional[dict] - Model-specific RPM limits {\"gpt-4\": 100, \"claude-v1\": 200} - model_tpm_limit: Optional[dict] - Model-specific TPM limits {\"gpt-4\": 100000, \"claude-v1\": 200000} - allowed_cache_controls: Optional[list] - List of allowed cache control values - duration: Optional[str] - Key validity duration (\"30d\", \"1h\", etc.) - permissions: Optional[dict] - Key-specific permissions - guardrails: Optional[List[str]] - List of active guardrails for the key - blocked: Optional[bool] - Whether the key is blocked Returns: - GenerateKeyResponse containing the new key and its updated parameters Example: ```bash curl --location --request POST \'http://localhost:4000/key/sk-1234/regenerate\' --header \'Authorization: Bearer sk-1234\' --header \'Content-Type: application/json\' --data-raw \'{ \"max_budget\": 100, \"metadata\": {\"team\": \"core-infra\"}, \"models\": [\"gpt-4\", \"gpt-3.5-turbo\"] }\' ``` Note: This is an Enterprise feature. It requires a premium license to use. * Regenerate Key Fn */ regenerateKeyFnKeyRegeneratePost_1Raw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters.key != null) { queryParameters.key = requestParameters.key; } const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (requestParameters.litellmChangedBy != null) { headerParameters['litellm-changed-by'] = String(requestParameters.litellmChangedBy); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = yield token('bearer', []); if (tokenString) { headerParameters.Authorization = `Bearer ${tokenString}`; } } const response = yield this.request({ path: `/key/regenerate`, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.regenerateKeyRequest, }, initOverrides); return new runtime.JSONApiResponse(response); }); } /** * Regenerate an existing API key while optionally updating its parameters. Parameters: - key: str (path parameter) - The key to regenerate - data: Optional[RegenerateKeyRequest] - Request body containing optional parameters to update - key_alias: Optional[str] - User-friendly key alias - user_id: Optional[str] - User ID associated with key - team_id: Optional[str] - Team ID associated with key - models: Optional[list] - Model_name\'s a user is allowed to call - tags: Optional[List[str]] - Tags for organizing keys (Enterprise only) - spend: Optional[float] - Amount spent by key - max_budget: Optional[float] - Max budget for key - model_max_budget: Optional[Dict[str, BudgetConfig]] - Model-specific budgets {\"gpt-4\": {\"budget_limit\": 0.0005, \"time_period\": \"30d\"}} - budget_duration: Optional[str] - Budget reset period (\"30d\", \"1h\", etc.) - soft_budget: Optional[float] - Soft budget limit (warning vs. hard stop). Will trigger a slack alert when this soft budget is reached. - max_parallel_requests: Optional[int] - Rate limit for parallel requests - metadata: Optional[dict] - Metadata for key. Example {\"team\": \"core-infra\", \"app\": \"app2\"} - tpm_limit: Optional[int] - Tokens per minute limit - rpm_limit: Optional[int] - Requests per minute limit - model_rpm_limit: Optional[dict] - Model-specific RPM limits {\"gpt-4\": 100, \"claude-v1\": 200} - model_tpm_limit: Optional[dict] - Model-specific TPM limits {\"gpt-4\": 100000, \"claude-v1\": 200000} - allowed_cache_controls: Optional[list] - List of allowed cache control values - duration: Optional[str] - Key validity duration (\"30d\", \"1h\", etc.) - permissions: Optional[dict] - Key-specific permissions - guardrails: Optional[List[str]] - List of active guardrails for the key - blocked: Optional[bool] - Whether the key is blocked Returns: - GenerateKeyResponse containing the new key and its updated parameters Example: ```bash curl --location --request POST \'http://localhost:4000/key/sk-1234/regenerate\' --header \'Authorization: Bearer sk-1234\' --header \'Content-Type: application/json\' --data-raw \'{ \"max_budget\": 100, \"metadata\": {\"team\": \"core-infra\"}, \"models\": [\"gpt-4\", \"gpt-3.5-turbo\"] }\' ``` Note: This is an Enterprise feature. It requires a premium license to use. * Regenerate Key Fn */ regenerateKeyFnKeyRegeneratePost_1() { return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) { const response = yield this.regenerateKeyFnKeyRegeneratePost_1Raw(requestParameters, initOverrides); return yield response.value(); }); } /** * 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 \'http://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. * key generate */ unblockKeyKeyUnblockPostRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (requestParameters.litellmChangedBy != null) { headerParameters['litellm-changed-by'] = String(requestParameters.litellmChangedBy); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = yield token('bearer', []); if (tokenString) { headerParameters.Authorization = `Bearer ${tokenString}`; } } const response = yield this.request({ path: `/key/generate`, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.blockKeyRequest, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); } else { return new runtime.TextApiResponse(response); } }); } /** * 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 \'http://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. * key generate */ unblockKeyKeyUnblockPost() { return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) { const response = yield this.unblockKeyKeyUnblockPostRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * 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 \'http://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. * Unblock Key */ unblockKeyKeyUnblockPost_2Raw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (requestParameters.litellmChangedBy != null) { headerParameters['litellm-changed-by'] = String(requestParameters.litellmChangedBy); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = yield token('bearer', []); if (tokenString) { headerParameters.Authorization = `Bearer ${tokenString}`; } } const response = yield this.request({ path: `/key/unblock`, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.blockKeyRequest, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); } else { return new runtime.TextApiResponse(response); } }); } /** * 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 \'http://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. * Unblock Key */ unblockKeyKeyUnblockPost_2() { return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) { const response = yield this.unblockKeyKeyUnblockPost_2Raw(requestParameters, initOverrides); return yield response.value(); }); } } exports.LitellmKeyManagementApi = LitellmKeyManagementApi;