enterprise_ai.llm.management
Source: sdks/python/src/enterprise_ai/llm/management/__init__.py. Back to the Python SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class LlmManagementClient
/v1/llm/projects (LiteLLM teams) and /v1/llm/projects/{project_id}/keys (LiteLLM virtual keys).
Resource
LlmManagementClient.block_key
block_key(project_id: str, key_id: str) -> Any
Block a project key. Blocks the key in LiteLLM: calls with it are refused until it is unblocked. The status becomes blocked. A revoked key answers 409 llm_key_revoked. Audited (llm_key.block). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/keys/{key_id}/block (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. | |
key_id | str | yes | Identifier (UUID) of the key in the platform. |
Returns: Any. Decoded JSON answer of the operation "Block a project key".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.create_key
create_key(project_id: str, key: dict[str, Any] | None = None) -> Any
Generate a project key. Generates a LiteLLM key for the project and answers 201 with the key record plus key (the clear key) and key_shown_once: true, with Cache-Control: no-store. The clear key is in this answer only: it is never stored nor audited. Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/keys (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. | |
key | dict[str, Any] | None | None | no | Settings of the new key sent as the body; empty by default. |
Returns: Any. Decoded JSON answer of the operation "Generate a project key".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.create_project
create_project(project: dict[str, Any]) -> Any
Create an LLM project. Creates an LLM project in the caller's tenant and answers 201 with the project. Requires tenant_admin or platform_admin.
Route: /v1/llm/projects (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project | dict[str, Any] | yes | Identifier of the project the results are restricted to. |
Returns: Any. Decoded JSON answer of the operation "Create an LLM project".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.delete_project
delete_project(project_id: str) -> Any
Delete an LLM project. Deletes the project, its LiteLLM team and its FinOps quotas, and answers 204. Refused with 409 llm_project_has_keys while the project has keys that are not revoked. A LiteLLM error while deleting the team stops the deletion. Audited (llm_project.delete). Requires tenant_admin or platform_admin; unknown id: 404 llm_project_not_found.
Route: /v1/llm/projects/{project_id} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. |
Returns: Any. Decoded JSON answer of the operation "Delete an LLM project".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.get_project
get_project(project_id: str) -> Any
Get an LLM project. One LLM project with its effective models, quota, LiteLLM team, sync status and error, FinOps quotas and key count. Requires tenant_admin or platform_admin; unknown id: 404 llm_project_not_found.
Route: /v1/llm/projects/{project_id} (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. |
Returns: Any. Decoded JSON answer of the operation "Get an LLM project".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.list_keys
list_keys(project_id: str, refresh: bool | None = None) -> Any
List the keys of a project. Keys of a project, newest first, with their alias, display prefix, models, limits, status, spend and expiry; never the clear key. With refresh, the spend of up to 50 keys that are not revoked is read again from LiteLLM and stored; usage_source is then litellm, or stored with litellm_error when LiteLLM did not answer. Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/keys (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. | |
refresh | bool | None | None | no | Read the current spend from LiteLLM before answering (default true); false returns the stored values only. |
Returns: Any. Decoded JSON answer of the operation "List the keys of a project".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.list_projects
list_projects(status: str | None = None) -> Any
List the LLM projects. LLM projects of the tenant by name, each with its effective models (explicit ids plus the registry models of its categories), quota, LiteLLM team and sync state, FinOps quotas and number of keys that are not revoked. One page only (next_cursor is always null). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
status | str | None | None | no | Only projects in this status: active, suspended or archived. |
Returns: Any. Decoded JSON answer of the operation "List the LLM projects".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.revoke_key
revoke_key(project_id: str, key_id: str) -> Any
Revoke a project key. Revokes a key: it is deleted in LiteLLM and kept here with status revoked and its revocation time, for the history. A revoked key cannot be changed again (409 llm_key_revoked). Audited (llm_key.revoke). Requires tenant_admin or platform_admin; unknown key: 404 llm_key_not_found.
Route: /v1/llm/projects/{project_id}/keys/{key_id} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. | |
key_id | str | yes | Identifier (UUID) of the key in the platform (not the LiteLLM token). |
Returns: Any. Decoded JSON answer of the operation "Revoke a project key".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.set_quota
set_quota(project_id: str, quota: dict[str, Any]) -> Any
Set the quota of a project. Replaces the whole quota of the project (omitted fields take their default), rebuilds its FinOps quotas and pushes it to LiteLLM. With hard_stop false, LiteLLM gets no maximum budget (alert only) and the FinOps quotas are soft. An invalid quota answers 422 invalid_quota. Audited (llm_project.quota). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/quota (PUT).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. | |
quota | dict[str, Any] | yes | Initial quota of the project; the defaults of the quota apply when omitted. |
Returns: Any. Decoded JSON answer of the operation "Set the quota of a project".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.status
status() -> Any
Check the LiteLLM admin connection. LiteLLM admin configuration without any secret value: whether it is configured, the admin address, whether the master key is present and where it is read from (setting, environment reference or OpenBao reference), the settings still missing, and a liveness probe (reachable) when it is configured. error_code is litellm_not_configured, litellm_unreachable or null. Requires tenant_admin or platform_admin.
Route: /v1/llm/management/status (GET).
This element takes no parameter.
Returns: Any. Decoded JSON answer of the operation "Check the LiteLLM admin connection".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.sync_project
sync_project(project_id: str) -> Any
Push a project to LiteLLM again. Pushes the project to LiteLLM again (team created or updated) and answers the project with its new sync_status. Unlike the other changes, a failure is returned: 503 litellm_not_configured, 502 litellm_unreachable or 502 litellm_rejected. Audited (llm_project.sync). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/sync (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. |
Returns: Any. Decoded JSON answer of the operation "Push a project to LiteLLM again".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.unblock_key
unblock_key(project_id: str, key_id: str) -> Any
Unblock a project key. Unblocks the key in LiteLLM; the status becomes active again. A revoked key answers 409 llm_key_revoked. Audited (llm_key.unblock). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/keys/{key_id}/unblock (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. | |
key_id | str | yes | Identifier (UUID) of the key in the platform. |
Returns: Any. Decoded JSON answer of the operation "Unblock a project key".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.update_key
update_key(project_id: str, key_id: str, changes: dict[str, Any]) -> Any
Update a project key. Changes the name, models and limits of a key, first in LiteLLM then here. The merged limits are checked against the project: a wider limit answers 422 llm_key_limit_exceeds_project, a model the project does not allow 422 llm_key_model_not_allowed. A revoked key answers 409 llm_key_revoked. Audited (llm_key.update). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id}/keys/{key_id} (PATCH).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. | |
key_id | str | yes | Identifier (UUID) of the key in the platform. | |
changes | dict[str, Any] | yes | Fields of the key to change, sent as the PATCH body; limits can never be wider than the project. |
Returns: Any. Decoded JSON answer of the operation "Update a project key".
Raises: the typed errors of the transport (Errors).
LlmManagementClient.update_project
update_project(project_id: str, changes: dict[str, Any]) -> Any
Update an LLM project. Changes the given fields of the project, rebuilds its FinOps quotas (removed when the project is no longer active or no longer linked) and pushes it to LiteLLM again; a LiteLLM failure does not fail the request but is shown in sync_status and sync_error. Another project with the new name answers 409 llm_project_exists; an unknown tenant project 404 tenant_project_not_found. Audited (llm_project.update). Requires tenant_admin or platform_admin.
Route: /v1/llm/projects/{project_id} (PATCH).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
project_id | str | yes | Identifier (UUID) of the LLM project. | |
changes | dict[str, Any] | yes | Fields of the project to change, sent as the PATCH body. |
Returns: Any. Decoded JSON answer of the operation "Update an LLM project".
Raises: the typed errors of the transport (Errors).